showing properties on diagram [message #1404523] |
Sat, 02 August 2014 23:45 |
mhammad makni Messages: 66 Registered: June 2013 |
Member |
|
|
Hi Robert,
I'm wondering if I can show other properties of a shape on the diagram like the property "name".
assume that I created MyEventDefinition shape which has two properties named value and visibility, in the next step I want to show the values of these two properties above the shape, for example the instance of MyEventDefinition id="MyEventDefinition_1" value="1" visibility="true" presented on the diagram has to be accompanied with the values of its properties as follows (1,true).
according to graphiti docs, we should implement decoration method in AddFeature class, so I viewed an example of showing the property name in AddTaskFeature class presented below.
protected void decorateShape(IAddContext context, ContainerShape containerShape, T businessObject) {
Shape textShape = peService.createShape(containerShape, false);
MultiText text = gaService.createDefaultMultiText(getDiagram(), textShape, businessObject.getName());
gaService.setLocationAndSize(text, 0, 0, context.getWidth(), context.getHeight());
StyleUtil.applyStyle(text, businessObject);
text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
text.setVerticalAlignment(Orientation.ALIGNMENT_CENTER);
// text.setFont(gaService.manageFont(getDiagram(), GaServiceImpl.DEFAULT_FONT, 8, false, true));
link(textShape, businessObject);
}
at this level I deduced that I should put together the text formed by this kind of sequence: String s="("+businessObject.getValue()+","+businessObject.getVisibility()+")"
after that, I tried to implement decoration method in AddEventDefinitionFeature class, and unfortunately there is no decoration method to implement.
so I'm having two problems:
-how should I form the text, and here I insist on how do I get the value of a property ex:("businessObject.getValue()" should I do the cast to MyEventDefinition or what?)
-should I create a decoration method in AddEventDefinitionFeature or there is another alternative.
I hope that I was clear so you can get me.
if it doesn't disturb you , I'm asking you to develop a new shape that fit these needs.
waiting for your response.
thank you very much.
|
|
|
Re: showing properties on diagram [message #1406916 is a reply to message #1404523] |
Mon, 11 August 2014 12:38 |
|
Hi Mhammad,
In your explanation you did not mention how or if you are extending the BPMN2 EventDefinition object. In the org.eclipse.bpmn2.modeler.examples.customtask plugin is an example that defines a MyEventDefinition which is a <customTask> extension (see plugin.xml).
You should be able to do something similar and then in your custom FeatureContainer provide an AddFeature which allows you to override decorateShape().
HTH,
Bob
|
|
|
|
Powered by
FUDForum. Page generated in 0.02739 seconds