Editing Properties on a Different Element (Properties Panel)

Hey!

I have a quick question on what is the best approach in editing properties for another element while in the context of the properties panel.

Say I have two elements A and B. They contain a common property called Owner (String). In the properties panel I have a place to input the value. Lets say I open up the properties panel for B and input “Test” how can I persist the same value to element A also while in the context of the properties panel for element B?
Is the XML that is generated based off the element object and it looks into the “businessObject” field for property values?

NOTE So far I have been able to retrieve the other element A and alter it’s business object but I have been unsuccessfully in actually getting the value persisted into the xml side of things.

Thanks!
Nick

Hi Nick,

can you show us a bit of code? Did you create a custom entry? It would also be helpful if you could show us how you managed to get access to element A if element B is selected and you’re in the scope of B.

Hey Pedesen,

Just to answer some questions I created a custom entry and I created my own property provider that is being used by the properties panel. Within the entry I have code similar to what is written below.

var bo = getBusinessObject(element);
var sourceRef = bo.sourceRef;

if(sourceRef && (is(sourceRef, "bpmn:ExclusiveGateway") || is(sourceRef, "bpmn:InclusiveGateway"))){
  //For each outgoing on the sourceRef I push to an array to get the reference to the other outgoing edges.
}

elementRegistry.get(bo.id);

NOTE I am also using the elementRegistry that the PropertiesProvider has access to to get the backing “element” by ID from the ModdleElement

Basically I am getting the business object for a SequenceEdge and I am looking for “sibling” sequence edges from the same sourceRef in this case it would be a Gateway. I have a property on SequenceEdge that in certain cases should be shared between the edges and I want to make changes to a siblings values.

I then use the edges just like any other businessObject at this point since they are ModdleElements.

If there is a way for me to push out a cmd or something to actually update the backing xml for these edges that would be great!

Right now I am trying to inject the injector into my PropertiesProvider and use that to inject the UpdateBusinessObjectHandler cmd but I feel like that may be incorrect.

Okay, so if I understood you right, you have an array of “sibling” sequence edges you want to update.

If you are inside the set method of your custom entry you can return a list of command ready objects:

entry.set(element, values) {

  // collect the edges and store them in a sequenceEdges array

  var commands = [];

  forEach(sequenceEdges, function(edge) {
    commands.push(cmdHelper.updateBusinessObject(edge, edge.businessObject, { owner: 'Bob' }));
  }

  return commands;
}

The set method should return this command array which is then getting executed here:

This makes sure all sequence edges are getting updated at once.

Hope that helps :slight_smile:

I must have skipped over that isArray check when I was looking at the Properties Panel source code.

I was able to resolve it another way by injecting the modeling object into my properties provider and doing the update properties. The only reason I am doing this is because I am updating the sibling edges outside of the set method. This is being called from Java with GWT. It works perfectly so this is resolved unless I am using a very stupid way of updating the properties and there is a better way instead of using the modeling object!

Thanks for the help!