Non-deterministic behaviour in CustomFeature [message #1219318] |
Tue, 03 December 2013 05:15  |
Eclipse User |
|
|
|
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 #1228920 is a reply to message #1219318] |
Wed, 08 January 2014 05:50  |
Eclipse User |
|
|
|
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 
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
[Updated on: Wed, 08 January 2014 06:14] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03761 seconds