Simple collapsefeature [message #889810] |
Tue, 19 June 2012 13:55  |
Eclipse User |
|
|
|
Hi,
i try to implement a simple collapsefeature, by resizing the eclass. Now my Problem, I can´t uncollapse the eclass to the origin size. Because of I can´t save the origin size in a variable. I think there is build eveytime I use it a now feature by the featureprovider. That means I can´t store the height and width in variables. Knows somebody a way to retore the origin size?
Thanks a lot
Greetings Patrick
|
|
|
Re: Simple collapsefeature [message #889860 is a reply to message #889810] |
Tue, 19 June 2012 22:23   |
Eclipse User |
|
|
|
hi,
i think you could easily achieve this by using "User-Defined Properties" as described in [1].
in your case before collapsing the compartment, you would save the current values, e.g.
PictogramElement pe = ...; // compartment
int width = pe.getGraphicsAlgorithm().getWidth();
int height = pe.getGraphicsAlgorithm().getHeight();
Graphiti.getPeService().setPropertyValue(pe, "initial_width", String.valueOf(width));
Graphiti.getPeService().setPropertyValue(pe, "initial_height", String.valueOf(height));
during re-expanding you can access those values by
PictogramElement pe = ...; // compartment
int width = 0;
String widthValue = Graphiti.getPeService().getPropertyValue(pe, "initial_width");
if(widthValue != null) {
width = Integer.parseInt(widthValue);
}
int height = 0;
String heightValue = Graphiti.getPeService().getPropertyValue(pe, "initial_height");
if(heightValue != null) {
height= Integer.parseInt(heightValue );
}
pe.getGraphicsAlgorithm().setWidth(width);
pe.getGraphicsAlgorithm().setHeight(height);
greetings,
aljoscha
[1] (add http) help.eclipse.org/indigo/topic/org.eclipse.graphiti.doc/resources/docu/gfw/user-defined-properties.htm
|
|
|
|
|
|
|
|
|
Re: Simple collapsefeature [message #892248 is a reply to message #889810] |
Wed, 27 June 2012 09:45   |
Eclipse User |
|
|
|
Hi Michael,
I use the setPropertyValue function of PeService. It works fine, as long as my diagram stays open, but when I close it, and open it again, the properties seem to be lost.
Graphiti.getPeService().setPropertyValue(pe, "initial_width", String.valueOf(width));
Graphiti.getPeService().setPropertyValue(pe, "initial_height", String.valueOf(height));
Graphiti.getPeService().setPropertyValue(pe, "isCollapsed", "true");
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05542 seconds