Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Stardust/Enhancing and Embedding Stardust/Browser Modeler/Change Protocol

< Stardust‎ | Enhancing and Embedding Stardust‎ | Browser Modeler
Revision as of 03:30, 18 November 2012 by Marc.thing-it.com (Talk | contribs) (Change Protocol)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Change Protocol

The Browser Modeler uses a specific protocol to submit changes in the JavaScript objects in the client via REST to the server.

Hereby, every change e.g.

  • creation and deletion of an element,
  • a change on a shape's geometry (position, size),
  • a change of properties of an element

is immediately submitted to the server via REST. Hereby, only the changed data themselves and information on which objects are changed are submitted - not all data of all changed objects.

After this, the change is processed on the server. Processing the change may cause other changes depending on the server-side, e.g. changing the type of a data may cause data mappings using this data to become invalid. These server-side changes are calculated and send back to the initiating client and possibly other clients registered for the same modeling session and connected via Web Socketsto receive push of changes.

Changes received on the client are dispatched to listeners for these changes, usually the Modeler Outline, Process Diagrams, Properties Pages.

Usually, programmers especially those just creating Extensions to Lightdust Extension Points do not have to think about the above. Service functions are provided by base classes of Views, Properties Pages and Diagram Elements to deal with the protocol. The main tasks for these programmers are

  • submitting well-defined changes and
  • reacting on updates of elements in the resspective components (Modeler Outline, Views, Properties Pages and Diagram Elements).

E.g for submitting changes in a Properties Page TestPropertiesPage for Activities you may define

	function ActivityTestPropertiesPage(propertiesPanel) {
		var propertiesPage = m_propertiesPage.createPropertiesPage(
				propertiesPanel, "testPropertiesPage", m_i18nUtils.getProperty("modeler.propertyPages.testPropertiesPage.title"),
				"../../images/icons/test-properties-page.png");
 
		m_utils.inheritFields(this, propertiesPage);
		m_utils.inheritMethods(ActivityDisplayPropertiesPage.prototype,
				propertiesPage);

and just invoke the method submitChanges()

this.nameInput = jQuery("#testPropertiesPage #nameInput");
 
this.nameInput.change({page: this}, function(event){
   event.data.page.submitChanges({modelElement : {name: event.data.page.nameInput}});
})

Note, that we need to apply the change to the Model Element because the Element the Activity Properties Page is dealing with is the Activity Symbol and modelElement is the Activity of that symbol.

Direct Submission of Changes

To directly submit changes you may invoke

   m_commandsController.submitCommand(m_command
					.createUpdateModelElementCommand(model.id, element.getElementUuid(), changes));};

whereby model is the Model you are working on, element the Model or Diagram Element and changes a JavaScript object only containing the changes to be submitted.

Back to the top