Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Non-deterministic behaviour in CustomFeature
Non-deterministic behaviour in CustomFeature [message #1219318] Tue, 03 December 2013 10:15 Go to next message
Soeren M is currently offline Soeren MFriend
Messages: 77
Registered: September 2011
Member
Hey,

I wrote my own collapse feature and it seems that it doesnt work as expected.
What I do is, I just set the visibility to false of close to all children. (That works correct)
But if I expand it I have two kinds of behaviour:

1. If there is a single Connection-child, everything works fine.
2. If there is no Connection inside, some childs only get visible if I move the parent.

Ive debuged it and everything seems correct, every child is visible.

The code is nothing special:
for (Shape s : cs.getChildren()) {
	...
	} else {
		s.setVisible(true);
		for (Connection c : s.getAnchors().get(0).getIncomingConnections()) {
			c.setVisible(true);
			c.getConnectionDecorators().get(0).setVisible(true);
		}
		for (Connection c : s.getAnchors().get(0).getOutgoingConnections()) {
			c.setVisible(true);
			c.getConnectionDecorators().get(0).setVisible(true);
		}
	}
}
Re: Non-deterministic behaviour in CustomFeature [message #1219730 is a reply to message #1219318] Thu, 05 December 2013 15:13 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Soeren,

the refresh of the diagram is triggered by doing any change to the model (in
this case the Pictograms model). I would assume that in the case when there
are no connections inside, you do not make any changes. Have you checked
that?

Michael
Re: Non-deterministic behaviour in CustomFeature [message #1219839 is a reply to message #1219318] Fri, 06 December 2013 08:51 Go to previous messageGo to next message
Soeren M is currently offline Soeren MFriend
Messages: 77
Registered: September 2011
Member
hmmm,

but which changes do I do if there are Connections inside?
I only change the visibility, nothing more happens during the expand.
What Ive posted is the whole method, the upper part of it is to skip the Text and Polygonline.

Maybe it isnt clear what I mean with "some childs only get visible if I move the parent".

Lets say there are three childs in it and collapse (I just set the size to a minimum) it three times in a row without touching or moving anything, then there are not always the same childs visible.
It changes everytime and seems completely random to me.

  • Attachment: initial.png
    (Size: 5.57KB, Downloaded 52 times)
  • Attachment: 2nd.png
    (Size: 4.70KB, Downloaded 45 times)
  • Attachment: 3rd.png
    (Size: 3.58KB, Downloaded 64 times)
  • Attachment: 4th.png
    (Size: 3.61KB, Downloaded 61 times)
Re: Non-deterministic behaviour in CustomFeature [message #1222058 is a reply to message #1219839] Thu, 19 December 2013 15:21 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1635
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hm,

strange, can you provide this in a small example to reproduce?

Michael
Re: Non-deterministic behaviour in CustomFeature [message #1228920 is a reply to message #1219318] Wed, 08 January 2014 10:50 Go to previous message
Soeren M is currently offline Soeren MFriend
Messages: 77
Registered: September 2011
Member
Sorry that I didnt answered you. Had a lot of stuff to do here.

Ive just created an example project and made a small example and I cant reproduce this behaviour.

Thats a little bit annoying for me, but good for you Wink

EDIT: I got it now. And I now where the error comes from... In the example its a little bit hacked, but the flow is the same.

I think those lines messed it up:

IGaService gaService = Graphiti.getGaService();
GraphicsAlgorithm ga = context.getPictogramElements()[0].getGraphicsAlgorithm();
int x = ga.getX();
int y = ga.getY();
							
Rectangle roundedRectangle = gaService.createRectangle(cs);
roundedRectangle.setForeground(manageColor(E_CLASS_FOREGROUND));
roundedRectangle.setBackground(manageColor(E_CLASS_BACKGROUND));
roundedRectangle.setLineWidth(2);
gaService.setLocationAndSize(roundedRectangle, x, y, 100, 50);


In the end, I dont know why I did this, what I remember is that the state moves his position. Thats the only idea why I did it this way...

I changed it to the normal way:

ga.setWidth(100 * (cs.getChildren().size() - 1));
ga.setHeight(50 * cs.getChildren().size());
ga.setBackground(manageColor(E_CLASS_BACKGROUND));
ga.setForeground(manageColor(new ColorConstant(98, 131, 167)));


Thanks for the hint with a small example, I think without it I would have never figured it out. TY Smile

[Updated on: Wed, 08 January 2014 11:14]

Report message to a moderator

Previous Topic:Load with absolute path in ImageProvider
Next Topic:ScrollingGraphicalViewer: Auto right scroll when width increases
Goto Forum:
  


Current Time: Sun Nov 23 16:11:46 GMT 2014

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

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