Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Filtering out nodes and connections from a diagram results in dangling connections in filtered state
Filtering out nodes and connections from a diagram results in dangling connections in filtered state [message #199379] Fri, 14 October 2005 15:43 Go to next message
Eclipse UserFriend
Originally posted by: smeier.xxx.xxx

This is a multi-part message in MIME format.
--------------020302080804040600070606
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi there.

I have a problem which was often discussed in this newsgroup, but I
couldn't manage, sorry. I use GEF 3.1 for a diagram editor which can
create nested nodes and connections that can connect arbitrary nodes as
shown in the example attachment, situation a.

I'd like to filter out, for example, the inner node X in the diagram and
I want also filter out the connection y. This is shown in situation b.
in the attachement.

Unfortunately it results something like in situation c. with a dangling
connection but the node is filtered out correctly.

The code I use is the following in the edit part of the node.

I have a propertyChange method which listens for specific events. When
changing the visibility property of the node, the
refreshSourceConncetions() and refreshNodes() are called.

public void propertyChange(PropertyChangeEvent evt) {
String prop = evt.getPropertyName();

if (ModelElement.VISIBILITY_PROP.equals(prop)) {
refreshChildren();
refreshSourceConnections();
} else if (NodeContainer.ZOOMED_PROP.equals(prop)) {
refreshChildren();
refreshSourceConnections();
refreshVisuals();
} else if (Node.SIZE_PROP.equals(prop) ||
Node.LOCATION_PROP.equals(prop)) {
refreshVisuals();
} else if (Node.NAME_PROP.equals(prop)) {
....
}
}

I have overridden the getModelChildren() and the
getModelSourceConnections() which provide now a filtered list of all
visible nodes and visible source connections respectively.
Somehow like this:

protected List getModelChildren() {
FilteredArrayList list = new
FilteredArrayList(
(ArrayList)getCastedObjectModel().getChildren());

list.setFilter(new ModelElementVisibilityFilter());
return list;
}

protected List getModelSourceConnections() {
FilteredArrayList list = new
FilteredArrayList(
(ArrayList)getCastedModel().getSourceConnections());

list.setFilter(new ModelElementVisibilityFilter());
return list;
}

The used classes which provide the filter service work correctly and the
visible properties of the corresponding connections and nodes are set
properly (ie. to false) before calling the methods refreshChildren() and
refreshConnections().


The filtering of the nodes works, in contrast to connections which
dangle somehow after the filter operation. When debugging GEF, it looks
as if the edit parts of the connection are thrown away in the
refreshSourceConnections() method, but somehow there are still some
remaining artifacts of them.

What's wrong?

thanx & regards
Silvio


--------------020302080804040600070606
Content-Type: image/gif; x-mac-type="47494666"; x-mac-creator="4D655361";
name="Untitled-1.gif"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="Untitled-1.gif"

R0lGODlh3wF0AsQfAMDAwD8/P0BAQICAgAAAAL+/v39/f/Dw8ODg4KCgoLCw sDAwMGBgYJCQ
kCAgINDQ0HBwcFBQUBAQEC8vL4+Pj+/v7w8PD09PT9/f38/Pzx8fH19fX29v b5+fn///////
/yH5BAEAAB8ALAAAAADfAXQCAAX/4CeOImCeaKqubOu+cMweZG3feK7vfO// wKBwSCwaj8ik
cnkjBJ7QqHRKrVqv2Kx2agEwv+CweEwum89oIMHDbrvf8Lh8Tq/b7/CAN83v +/+AgYJoa3iG
h4iJh3qDjY6PkJGSX4WKlpeYd4yTnJ2en6BplZmkpZiboamqq6ytIqOmsbJ2 qK62t7i5ZrCz
vb5stbrCw8TFOry/yabBxs3Oz6zIytOXzNDX2NmD0tTdi3va4eLjZdze53XW 5Ovs7T7m6PF5
4O719vev8vq09Pj+/9rg7ZOnDqDBg7oEDkRXEKHDh6kULvTWEKLFi5AkTqRW EaPHj300blTW
EaTJk2FE/478VRKly5dFVK7s1RKmzZs7ZL4pQKCnz59AgwodSpRogUQ1cSpd +kGnmwIBZnoI
cBRRUqZYXzptA1UqVaT9soplupVN15lfrYYdy9ZmWQ9nV6b91rYuzrdxR841 dNWuX4B4o6Kt
SvevYZCBvRLmu/aw44OJB4N9TPlhZLmL8fStzBnbZUUcKLDBcKFCpr2aG3de Te5zogwWTAcQ
fTqzJtWsc2dznYiDgQITSqG+rbt460x5FVWwMCGDcNv8jEsPiFwwpgsalkFP h3u691y8EQG/
YOD55O/oi4U/NKEABgsYSA2Pnr5+wuqYOgg2s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j6gDf6gF b6gHX6jo96j+
iqgNf6gPb6gRX6gTn5S5RKYY30ukkvEc70vwfWPMlKUiP/IkX6XbFGTrhVwo /16XvvL77fL/
DfMDLvN/TvODbvOHjvOLrvOPzvOT7vMtD2Qp31zO/lxDL11Cz/KbDvRLn/Qv 7/QxD/WDMy/1
NU/1N2/1OY/1O6/1Pc/1P+/1Qf9jR29dYN/0Yq/0n870aV/2a3/2T+/2UQ/3 Uy/3VU/3V2/3
WY/3W6/3Xc/3X+/3Ye9jY69dbD/qam/4hX/qh6/4ib/qi+/4jf/qjy/5kT/r k2/5lX/rl6/5
mb/rm+/5Qn9foj/6pE8ARQ9XIQAAOw==
--------------020302080804040600070606--
Re: Filtering out nodes and connections from a diagram results in dangling connections in filtered [message #199441 is a reply to message #199379] Sat, 15 October 2005 10:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: smeier.xxx.xxx

Hi

In the meantime I noticed, that the editpart seems to be deleted from
the editparts but it is still drawn. It is not possible to select the line.

So what might be the problem.

regards
Silvio


Silvio Meier wrote:
> Hi there.
>
> I have a problem which was often discussed in this newsgroup, but I
> couldn't manage, sorry. I use GEF 3.1 for a diagram editor which can
> create nested nodes and connections that can connect arbitrary nodes as
> shown in the example attachment, situation a.
>
> I'd like to filter out, for example, the inner node X in the diagram and
> I want also filter out the connection y. This is shown in situation b.
> in the attachement.
>
> Unfortunately it results something like in situation c. with a dangling
> connection but the node is filtered out correctly.
>
> The code I use is the following in the edit part of the node.
>
> I have a propertyChange method which listens for specific events. When
> changing the visibility property of the node, the
> refreshSourceConncetions() and refreshNodes() are called.
>
> public void propertyChange(PropertyChangeEvent evt) {
> String prop = evt.getPropertyName();
>
> if (ModelElement.VISIBILITY_PROP.equals(prop)) {
> refreshChildren();
> refreshSourceConnections();
> } else if (NodeContainer.ZOOMED_PROP.equals(prop)) {
> refreshChildren();
> refreshSourceConnections();
> refreshVisuals();
> } else if (Node.SIZE_PROP.equals(prop) ||
> Node.LOCATION_PROP.equals(prop)) {
> refreshVisuals();
> } else if (Node.NAME_PROP.equals(prop)) {
> ....
> }
> }
>
> I have overridden the getModelChildren() and the
> getModelSourceConnections() which provide now a filtered list of all
> visible nodes and visible source connections respectively.
> Somehow like this:
>
> protected List getModelChildren() {
> FilteredArrayList list = new
> FilteredArrayList(
> (ArrayList)getCastedObjectModel().getChildren());
>
> list.setFilter(new ModelElementVisibilityFilter());
> return list;
> }
>
> protected List getModelSourceConnections() {
> FilteredArrayList list = new
> FilteredArrayList(
> (ArrayList)getCastedModel().getSourceConnections());
>
> list.setFilter(new ModelElementVisibilityFilter());
> return list;
> }
>
> The used classes which provide the filter service work correctly and the
> visible properties of the corresponding connections and nodes are set
> properly (ie. to false) before calling the methods refreshChildren() and
> refreshConnections().
>
>
> The filtering of the nodes works, in contrast to connections which
> dangle somehow after the filter operation. When debugging GEF, it looks
> as if the edit parts of the connection are thrown away in the
> refreshSourceConnections() method, but somehow there are still some
> remaining artifacts of them.
>
> What's wrong?
>
> thanx & regards
> Silvio
>
>
> ------------------------------------------------------------ ------------
>
Re: Filtering out nodes and connections from a diagram results in dangling connections in filtered [message #199547 is a reply to message #199441] Mon, 17 October 2005 08:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: markus.nosse.gmx.net

Hi Silvio,

I ran across a similar problem when I tried to make nodes collapse and
expandable. Remeber what is required to get a connection between two
editparts: you have to override getModelSourceConnections and
getModelTargetConnections.

If your filter eliminates a source edit part of some connection, this
connection must be removed from the target edit part as well. So I'd say
that refreshing the target nodes of filtered connections will result in
the desired behavior.

-- markus

Silvio Meier wrote:
> Hi
>
> In the meantime I noticed, that the editpart seems to be deleted from
> the editparts but it is still drawn. It is not possible to select the line.
>
> So what might be the problem.
>
> regards
> Silvio
>
>
> Silvio Meier wrote:
>
>> Hi there.
>>
>> I have a problem which was often discussed in this newsgroup, but I
>> couldn't manage, sorry. I use GEF 3.1 for a diagram editor which can
>> create nested nodes and connections that can connect arbitrary nodes
>> as shown in the example attachment, situation a.
>>
>> I'd like to filter out, for example, the inner node X in the diagram
>> and I want also filter out the connection y. This is shown in
>> situation b. in the attachement.
>>
>> Unfortunately it results something like in situation c. with a
>> dangling connection but the node is filtered out correctly.
>>
>> The code I use is the following in the edit part of the node.
>>
>> I have a propertyChange method which listens for specific events. When
>> changing the visibility property of the node, the
>> refreshSourceConncetions() and refreshNodes() are called.
>>
>> public void propertyChange(PropertyChangeEvent evt) {
>> String prop = evt.getPropertyName();
>>
>> if (ModelElement.VISIBILITY_PROP.equals(prop)) {
>> refreshChildren();
>> refreshSourceConnections();
>> } else if (NodeContainer.ZOOMED_PROP.equals(prop)) {
>> refreshChildren();
>> refreshSourceConnections();
>> refreshVisuals();
>> } else if (Node.SIZE_PROP.equals(prop) ||
>> Node.LOCATION_PROP.equals(prop)) {
>> refreshVisuals();
>> } else if (Node.NAME_PROP.equals(prop)) {
>> ....
>> }
>> }
>>
>> I have overridden the getModelChildren() and the
>> getModelSourceConnections() which provide now a filtered list of all
>> visible nodes and visible source connections respectively.
>> Somehow like this:
>>
>> protected List getModelChildren() {
>> FilteredArrayList list = new
>> FilteredArrayList(
>> (ArrayList)getCastedObjectModel().getChildren());
>>
>> list.setFilter(new ModelElementVisibilityFilter());
>> return list;
>> }
>>
>> protected List getModelSourceConnections() {
>> FilteredArrayList list = new
>> FilteredArrayList(
>> (ArrayList)getCastedModel().getSourceConnections());
>>
>> list.setFilter(new ModelElementVisibilityFilter());
>> return list;
>> }
>>
>> The used classes which provide the filter service work correctly and
>> the visible properties of the corresponding connections and nodes are
>> set properly (ie. to false) before calling the methods
>> refreshChildren() and refreshConnections().
>>
>>
>> The filtering of the nodes works, in contrast to connections which
>> dangle somehow after the filter operation. When debugging GEF, it
>> looks as if the edit parts of the connection are thrown away in the
>> refreshSourceConnections() method, but somehow there are still some
>> remaining artifacts of them.
>>
>> What's wrong?
>>
>> thanx & regards
>> Silvio
>>
>>
>> ------------------------------------------------------------ ------------
>>
Re: Filtering out nodes and connections from a diagram results in dangling connections in filtered [message #199651 is a reply to message #199547] Mon, 17 October 2005 17:54 Go to previous message
Eclipse UserFriend
Originally posted by: smeier.xxx.xxx

Hi Markus

Thank you. Seems to be logical but shouldn't this do the
refreshSourceConnection() method implementation of the GEF, because this
method is responsible for removing the corresponding ConnectionEditParts?

cheers
Silvio


Markus wrote:
> Hi Silvio,
>
> I ran across a similar problem when I tried to make nodes collapse and
> expandable. Remeber what is required to get a connection between two
> editparts: you have to override getModelSourceConnections and
> getModelTargetConnections.
>
> If your filter eliminates a source edit part of some connection, this
> connection must be removed from the target edit part as well. So I'd say
> that refreshing the target nodes of filtered connections will result in
> the desired behavior.
>
> -- markus
>
> Silvio Meier wrote:
>
>> Hi
>>
>> In the meantime I noticed, that the editpart seems to be deleted from
>> the editparts but it is still drawn. It is not possible to select the
>> line.
>>
>> So what might be the problem.
>>
>> regards
>> Silvio
>>
>>
>> Silvio Meier wrote:
>>
>>> Hi there.
>>>
>>> I have a problem which was often discussed in this newsgroup, but I
>>> couldn't manage, sorry. I use GEF 3.1 for a diagram editor which can
>>> create nested nodes and connections that can connect arbitrary nodes
>>> as shown in the example attachment, situation a.
>>>
>>> I'd like to filter out, for example, the inner node X in the diagram
>>> and I want also filter out the connection y. This is shown in
>>> situation b. in the attachement.
>>>
>>> Unfortunately it results something like in situation c. with a
>>> dangling connection but the node is filtered out correctly.
>>>
>>> The code I use is the following in the edit part of the node.
>>>
>>> I have a propertyChange method which listens for specific events.
>>> When changing the visibility property of the node, the
>>> refreshSourceConncetions() and refreshNodes() are called.
>>>
>>> public void propertyChange(PropertyChangeEvent evt) {
>>> String prop = evt.getPropertyName();
>>>
>>> if (ModelElement.VISIBILITY_PROP.equals(prop)) {
>>> refreshChildren();
>>> refreshSourceConnections();
>>> } else if (NodeContainer.ZOOMED_PROP.equals(prop)) {
>>> refreshChildren();
>>> refreshSourceConnections();
>>> refreshVisuals();
>>> } else if (Node.SIZE_PROP.equals(prop) ||
>>> Node.LOCATION_PROP.equals(prop)) {
>>> refreshVisuals();
>>> } else if (Node.NAME_PROP.equals(prop)) {
>>> ....
>>> }
>>> }
>>>
>>> I have overridden the getModelChildren() and the
>>> getModelSourceConnections() which provide now a filtered list of all
>>> visible nodes and visible source connections respectively.
>>> Somehow like this:
>>>
>>> protected List getModelChildren() {
>>> FilteredArrayList list = new
>>> FilteredArrayList(
>>> (ArrayList)getCastedObjectModel().getChildren());
>>>
>>> list.setFilter(new ModelElementVisibilityFilter());
>>> return list;
>>> }
>>>
>>> protected List getModelSourceConnections() {
>>> FilteredArrayList list = new
>>> FilteredArrayList(
>>> (ArrayList)getCastedModel().getSourceConnections());
>>>
>>> list.setFilter(new ModelElementVisibilityFilter());
>>> return list;
>>> }
>>>
>>> The used classes which provide the filter service work correctly and
>>> the visible properties of the corresponding connections and nodes
>>> are set properly (ie. to false) before calling the methods
>>> refreshChildren() and refreshConnections().
>>>
>>>
>>> The filtering of the nodes works, in contrast to connections which
>>> dangle somehow after the filter operation. When debugging GEF, it
>>> looks as if the edit parts of the connection are thrown away in the
>>> refreshSourceConnections() method, but somehow there are still some
>>> remaining artifacts of them.
>>>
>>> What's wrong?
>>>
>>> thanx & regards
>>> Silvio
>>>
>>>
>>> ------------------------------------------------------------ ------------
>>>
Previous Topic:problem with repaint()
Next Topic:fillGradient on a Figure
Goto Forum:
  


Current Time: Tue Apr 23 10:54:50 GMT 2024

Powered by FUDForum. Page generated in 0.03257 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top