|
|
|
|
|
|
|
|
Re: Dynamically update the layout of a customTaskElement [message #1735399 is a reply to message #1735016] |
Sat, 18 June 2016 07:13   |
Eclipse User |
|
|
|
Hi Bob,
thanks for your answer.
Ok this sounds like I did something completely wrong in my custom PropertySections. I usually override the createBindings method.
When I bind an Attribute which is simply a new custom attribute assigned to my custom task object I can use the standard method call: this.bindAttribute()
But in case I want to bind one of my extinsionElement properties this results in the unexpected behavior where no updateNeeded() method is triggered. See the following example:
@Override
public void createBindings(EObject be) {
setTitle("Workflow");
// ProcessID (send an updateNeeded event)
this.bindAttribute(attributesComposite, be, "processid");
// Summary (did not send an updateNeeded event!)
Value itemValue = ImixsBPMNPlugin.getItemValueByName((BaseElement) be,
"txtworkflowsummary", null, "");
TextObjectEditor valueEditor = new TextObjectEditor(this, itemValue,
ImixsBPMNPlugin.IMIXS_ITEMVALUE);
valueEditor.createControl(attributesComposite, "Summary");
}
The xml result looks like this :
<bpmn2:task id="Task_1" imixs:processid="1111" name="Task 1">
<bpmn2:extensionElements>
<imixs:item name="txtworkflowsummary" type="xs:string">
<imixs:value><![CDATA[som data]]></imixs:value>
</imixs:item>
</bpmn2:extensionElements>
Everything looks fine and I can change the values by typing in the TextObjectEditor. And this will indicate the 'Dirty' Flag in the eclipse editor tab. And the value is stored correctyl when I save the model, and displayed correctly when I open it.
So it did not look to bad so far. But the updateNeeded method is not called during typing. This is a different behavior when I am typing the value of an attribute which is not part of the extensionElements (like imixs:processid in my example) .
The tutorial seems a little bit outdated in the meantime. Because the method ModelDecorator.addExtensionAttributeValue(myTask, feature, taskConfig, true); is deprecated.
https://wiki.eclipse.org/BPMN2-Modeler/DeveloperTutorials/CustomPropertyTabs
In my own code I use the InsertionAdapter intead to add a extensionAttribute and a custom property:
extensionAttribute = Bpmn2Factory.eINSTANCE
.createExtensionAttributeValue();
// insert the extension into the base element
InsertionAdapter
.add(be, Bpmn2Package.eINSTANCE
.getBaseElement_ExtensionValues(),
extensionAttribute);
// we need to execute to avoid the generation of empty
// extensionElements
InsertionAdapter.executeIfNeeded(extensionAttribute);
// insert the item into the extension
InsertionAdapter.add(extensionAttribute,
ImixsBPMNPlugin.IMIXS_ITEM_FEATURE, item);
Maybe this is the source of the wrong behavior?
===
Ralph
|
|
|
|
Re: Dynamically update the layout of a customTaskElement [message #1735933 is a reply to message #1735407] |
Thu, 23 June 2016 13:30  |
Eclipse User |
|
|
|
Hi Ralph,
I don't know if you've figured this out yet, and I'm not really sure what the problem could be with update() but here's a bit of info that might help:
All DetailComposites register as ResourceSetListeners (see ListAndDetailCompositeBase#setBusinessObject()). If a model change happens somewhere (either on the canvas, or in a different tab or widget or view), the DetailComposite passes the notification on to all of its children, which are subclasses of ObjectEditors (see ListAndDetailCompositeBase#resourceSetChanged()) These are responsible for checking if the change affects them and redrawing themselves. For example, if you add a new Message type to the model, the combo boxes that are used to select a Message are updated to include the new Message. This is also where the label decorators (ERROR or WARNING icons next to the label of an ObjectEditor) are updated (see ObjectEditor#updateLabelDecorator()).
Is it possible that somewhere along the line, your ObjectEditor isn't updating itself in response to a model change?
HTH,
Bob
|
|
|
Powered by
FUDForum. Page generated in 0.06038 seconds