Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Move the Parent ContainerShape from its Children(Move the Parent ContainerShape from its Children)
Move the Parent ContainerShape from its Children [message #1585790] Mon, 26 January 2015 13:36 Go to next message
Ken Mersado is currently offline Ken MersadoFriend
Messages: 19
Registered: October 2014
Junior Member
Hi Guys,

I am new in Graphiti and I am trying to implement a logic. I have a ContainerShape and an Invisible Rectangle which holds one or many children.

What I am trying to do is that, to allow the user to move the parent Container through its child. (Please see attached image)

Im trying to look at the MoveFeature but it seems like I'm in the wrong page. Is this possible in Graphiti? Can i have some tips on how to implement it.

  • Attachment: sample.png
    (Size: 9.62KB, Downloaded 144 times)
Re: Move the Parent ContainerShape from its Children [message #1586163 is a reply to message #1585790] Mon, 26 January 2015 17:58 Go to previous message
Marek Jagielski is currently offline Marek JagielskiFriend
Messages: 85
Registered: April 2012

In my diagrams I have ports inside tasks:
like here:
I can move ports separately as well as they follow when I move parent shape.

With MoveFeature you are on the right page. You can use DefaultMoveFeature and as for me it should already work as you expect.

In my case, I needed to make some coding to make my labels to follow my shapes as they are NOT children shapes.
For internal ports I created MoveInternalPortFeature extends DefaultMoveShapeFeature. My customization was related also to labels and to constraints that internal ports can be only on bounds. Coordinates are relative to parent position.

Of course you should return correct MoveFeature in YourDefaultFeatureProvider. In my case:
	public IMoveShapeFeature getMoveShapeFeature(IMoveShapeContext context) {
		Shape shape = context.getShape();
		String labelProperty = Graphiti.getPeService().getPropertyValue(shape,	SicConstants.LABEL_PROPERTY);
		if(Boolean.parseBoolean(labelProperty)) return new MoveLabelFeature(getFeatureProvider());
		Object bo = getFeatureProvider().getBusinessObjectForPictogramElement(shape);

		IMoveShapeFeature feature = ModelerGuiExtensionManager.INSTANCE.getMoveShapeFeature(context, getFeatureProvider());
		if(feature != null) return feature;
		else if (bo instanceof InternalPort)     return new MoveInternalPortFeature(getFeatureProvider());
		else if (bo instanceof BaseElement)      return new MoveElementFeature(getFeatureProvider());
		else                                     return new DefaultMoveShapeFeature(getFeatureProvider());

Previous Topic:Properties view doesn't work for DnD element
Next Topic:Graphiti and EMFStore
Goto Forum:

Current Time: Wed Sep 26 08:42:24 GMT 2018

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

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

Back to the top