|
Re: Move the Parent ContainerShape from its Children [message #1586163 is a reply to message #1585790] |
Mon, 26 January 2015 12:58  |
Eclipse User |
|
|
|
Hi,
In my diagrams I have ports inside tasks:
like here: https://raw.githubusercontent.com/systemincloud/sic-examples-ext-vip/master/com.systemincloud.ext.vip.examples.uc.defog/src/main/resources/tasks/hasselt/Defog.png
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());
}
Marek
|
|
|
Powered by
FUDForum. Page generated in 0.03401 seconds