|
Re: Simple collapsefeature [message #889860 is a reply to message #889810] |
Wed, 20 June 2012 02:23 |
Aljoscha Hark Messages: 24 Registered: March 2012 |
Junior Member |
|
|
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 13:45 |
Miriam Baran Messages: 16 Registered: May 2012 |
Junior Member |
|
|
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.04543 seconds