|
|
Re: Moving ContainerShape onto Shape [message #1419297 is a reply to message #1411072] |
Mon, 08 September 2014 11:46 |
Martin Hanysz Messages: 30 Registered: November 2013 |
Member |
|
|
Dear Michael,
Thanks for having a look at this. I double checked my layout and update code and couldn't find anything that would mess with the GraphicsAlgorithm of the label or its rendering. I also tried the example you mentioned and noticed that the text of an EClass is a simple Text and not a MultiText. SO I tried to reproduce my problem in the tutorial example.
Here's what I tried:
1. changed the code so TutorialAddEClassFeature#add(...) creates a ContainerShape for the text in line 99
final Shape shape = peCreateService.createContainerShape(containerShape, false);
2. changed the code so TutorialAddEClassFeature#add(...) creates a MultiText in line 102
final MultiText text = gaService.createMultiText(shape, addedClass.getName());
Step 2 breaks the direct editing of the example and some other things so I decided to do only step 1 and manually edited the diagram file to make the text a MultiText (set xsi:type="al:MultiText") and have a value (set value="Test").
This is the final XML I get in the example:
<children xsi:type="pi:ContainerShape" visible="true">
<graphicsAlgorithm xsi:type="al:MultiText" lineStyle="UNSPECIFIED" width="100" height="20" style="/0/@styles.0/@styles.1" horizontalAlignment="UNSPECIFIED" verticalAlignment="UNSPECIFIED" value="Test"/>
<link businessObjects="/1"/>
</children>
This is the XML I get from my application:
<children xsi:type="pi:ContainerShape" visible="true" active="true">
<properties key="isLabelPictogramElement" value="true"/>
<graphicsAlgorithm xsi:type="al:MultiText" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="78" height="14" x="111" y="82" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="New Channel">
<properties key="fullTextValue" value="New Channel"/>
</graphicsAlgorithm>
</children>
The main difference seems to be the usage of styles, but both versions won't render any text.
Do you have any ideas why MultiTexts are not rendered when they are the GA of container shapes? I'd appreciate any hints.
EDIT:
To further drill down the reproduction of the issue, consider the following CustomFeature:
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.features.context.ICustomContext;
import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
import org.eclipse.graphiti.mm.algorithms.MultiText;
import org.eclipse.graphiti.mm.pictograms.Shape;
import org.eclipse.graphiti.services.Graphiti;
public class TestCustomFeature extends AbstractCustomFeature {
public TestCustomFeature(IFeatureProvider fp) {
super(fp);
}
@Override
public boolean canExecute(ICustomContext context) {
return true;
}
@Override
public void execute(ICustomContext context) {
Shape container = Graphiti.getPeCreateService().createShape(getDiagram(), true);
MultiText ga = Graphiti.getGaCreateService().createMultiText(container, "Test");
ga.setHeight(100);
ga.setWidth(100);
ga.setX(context.getX());
ga.setY(context.getY());
}
}
Once you change it to create a ContainerShape the text will not be rendered anymore.
Shape container = Graphiti.getPeCreateService().createContainerShape(getDiagram(), true);
Best regards,
Martin
[Updated on: Mon, 08 September 2014 12:03] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02514 seconds