Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Collapse/expand
Collapse/expand [message #900357] Mon, 06 August 2012 11:27 Go to next message
Rui Domingues is currently offline Rui Domingues
Messages: 186
Registered: October 2010
Senior Member
Hi everyone.

There are any examples of collapse/expand behaviour implementation?
it that possible?

Thanks
Re: Collapse/expand [message #900459 is a reply to message #900357] Tue, 07 August 2012 03:56 Go to previous messageGo to next message
Miriam Baran is currently offline Miriam Baran
Messages: 16
Registered: May 2012
Junior Member
Hi,
I implemented such a behavior. You will need a custom Feature for this. Decide of a default collapsed size. First you will remember the initial size in properties of your pictogram-element
		PictogramElement pe = moduleShape;
		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));
		Graphiti.getPeService().setPropertyValue(pe, "isCollapsed", "true");

then resize it
                ResizeShapeContext context1 = new ResizeShapeContext(moduleShape);
		context1.setSize(100, 100);
		context1.setLocation(moduleShape.getGraphicsAlgorithm().getX(), moduleShape.getGraphicsAlgorithm().getY());
		IResizeShapeFeature rsf = getFeatureProvider().getResizeShapeFeature(context1);
		if (rsf.canExecute(context1)) {
			rsf.execute(context1);
		}
		addConnectionOccurences(moduleShape);

and set its children invisible if you need to. Good Luck
Re: Collapse/expand [message #900552 is a reply to message #900459] Tue, 07 August 2012 09:46 Go to previous message
Rui Domingues is currently offline Rui Domingues
Messages: 186
Registered: October 2010
Senior Member
Thanks for replying. I'm gonna try.
Previous Topic:Cannot modify resource set without a write transaction
Next Topic:DirectEditing in two or more texts
Goto Forum:
  


Current Time: Wed Jul 09 21:49:48 EDT 2014

Powered by FUDForum. Page generated in 0.02349 seconds