Jump to: navigation, search

Difference between revisions of "STP/BPMN Component/Reusing the modeler"

(Displaying the annotation on the diagram)
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Annotating the stp.bpmn domain model ==
+
This page is deprecated. Please use the [STP/BPMN_Component/EclipseCon2008 EclipseCon 2008 tutorial] instead.
  
This paragraph explains how to add to the bpmn diagram custom data.
+
== Annotating the stp.bpmn Domain Model ==
 +
 
 +
This topic explains how to add to the bpmn diagram custom data.
 
It also describes how to display and interact with that custom data.
 
It also describes how to display and interact with that custom data.
  
The reader needs to be familiar with EMF and in some cases to GMF/GEF.
+
The reader should be familiar with the [http://www.eclipse.org/emf/ Eclipse Modeling Framework (EMF)] and in some cases the [http://www.eclipse.org/gmf/ Graphical Modeling Framework (GMF)] and the [http://www.eclipse.org/gmf/ Graphical Editing Framework (GEF)].
  
 
Every element of the domain model of the stp.bpmn modeler is an EMF EModelElement.
 
Every element of the domain model of the stp.bpmn modeler is an EMF EModelElement.
Line 10: Line 12:
  
 
Here are various techniques to use that ability.
 
Here are various techniques to use that ability.
=== Display the value of the annotation ===
+
=== Displaying the Value of the Annotation ===
 
By default the EAnnotations added to the bpmn objects are displayed in the properties view inside the 'BPMN' tabulation.
 
By default the EAnnotations added to the bpmn objects are displayed in the properties view inside the 'BPMN' tabulation.
  
Line 23: Line 25:
 
[[Image:Bpmn view.jpg]]
 
[[Image:Bpmn view.jpg]]
  
=== Displaying the annotation on the diagram ===
+
=== Displaying the Annotation on the Diagram ===
 
Once the model has annotations it is possible to display in the diagram that the model element associated to a particular shape or connection has been annotated.
 
Once the model has annotations it is possible to display in the diagram that the model element associated to a particular shape or connection has been annotated.
 
In order to do this, we have implemented an extension point: org.eclipse.stp.bpmn.diagram.EAnnotationDecorator.
 
In order to do this, we have implemented an extension point: org.eclipse.stp.bpmn.diagram.EAnnotationDecorator.
 
You can have a look at it here : http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.stp.bpmn/org.eclipse.stp.bpmn.diagram/schema/EAnnotationDecorator.exsd?cvsroot=STP_Project
 
You can have a look at it here : http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.stp.bpmn/org.eclipse.stp.bpmn.diagram/schema/EAnnotationDecorator.exsd?cvsroot=STP_Project
 
--[[User:Atoulme.intalio.com|Atoulme.intalio.com]] 15:31, 2 December 2006 (EST) will change to direct link when in documentation
 
--[[User:Atoulme.intalio.com|Atoulme.intalio.com]] 15:31, 2 December 2006 (EST) will change to direct link when in documentation
 +
 
The EAnnotation decorator extension point register a decorator for an annotation source. It then instanciates the IEAnnotation class declared in the extension point.
 
The EAnnotation decorator extension point register a decorator for an annotation source. It then instanciates the IEAnnotation class declared in the extension point.
 
See http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.stp.bpmn/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/dnd/IEAnnotationDecorator.java?cvsroot=STP_Project
 
See http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.stp.bpmn/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/dnd/IEAnnotationDecorator.java?cvsroot=STP_Project
 +
 
--[[User:Atoulme.intalio.com|Atoulme.intalio.com]] 15:31, 2 December 2006 (EST) will change by direct link when in documentation
 
--[[User:Atoulme.intalio.com|Atoulme.intalio.com]] 15:31, 2 December 2006 (EST) will change by direct link when in documentation
  
 
[[Image:Decorated icon.jpg]]
 
[[Image:Decorated icon.jpg]]
  
=== Annotate the stp.bpmn: Drag and Drop ===
+
=== Annotating the stp.bpmn: Drag and Drop ===
 
It is possible to drag and drop things to attach annotations to the stp.bpmn domain model.
 
It is possible to drag and drop things to attach annotations to the stp.bpmn domain model.
Use the extension point: org.eclipse.stp.bpmn.diagram.EAnnotationDragAndDrop
+
 
 +
You will have to declare a IDNDHandler instance in your extension point that will provide callback method when the drop edit policy on the shape is asked for a command. The javadoc is pretty much explicit there. However, when coding the doPerformDrop method, you will have to use the GMF and GEF standards on the context handling.
 +
You are in a read-only context in this case, so you should add commands to the CompoundCommand that is given to you in parameter.
 +
If those commands are found to be non-executable, the drop will be canceled.
 +
 
 +
http://dev.eclipse.org/svnroot/stp/org.eclipse.stp.bpmn-modeler/org.eclipse.stp.bpmn/trunk/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/dnd/IDnDHandler.java
 +
 
 
The object dragged must be "IAdaptable" to an EAnnotation.
 
The object dragged must be "IAdaptable" to an EAnnotation.
 
The implementation of the extension point will define if the drop can execute and will show feedback in a balloon figure.
 
The implementation of the extension point will define if the drop can execute and will show feedback in a balloon figure.
This extension point is only giving access to the domain model.
 
  
To extend the drag and drop, you will need to declare three extension points.
+
   
--[[User:Atoulme.intalio.com|Atoulme.intalio.com]] 00:54, 2 December 2006 (EST)
+
[[Image:FeedbackonDnD.jpg]]
TODO add links to the  respective docs
+
  
    <extension point="org.eclipse.stp.bpmn.diagram.EAnnotationDragAndDrop">
+
== More on the drag and drop extensibility ==
      <DropHandler
+
 
            class="org.eclipse.stp.bpmn.dnd.file.FileDndHandler"
+
A simple implementation is provided in the org.eclipse.stp.bpmn.diagram plugin.
            source="genericFile">
+
An article is being drafted to present it: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=165083
      </DropHandler>
+
  </extension>
+
  <extension
+
        point="org.eclipse.stp.bpmn.diagram.EAnnotationDecorator">
+
      <decorator
+
            class="org.eclipse.stp.bpmn.dnd.file.FileEAnnotationDecorator"
+
            source="genericFile">
+
      </decorator>
+
  </extension>
+
  <extension
+
        point="org.eclipse.core.runtime.adapters">
+
      <factory
+
            adaptableType="org.eclipse.core.resources.IFile"
+
            class="org.eclipse.stp.bpmn.dnd.file.File2AnnotationAdapterFactory">
+
        <adapter
+
              type="org.eclipse.emf.ecore.EAnnotation">
+
        </adapter>
+
      </factory>
+
  </extension>
+
  
 
=== Other needs ===
 
=== Other needs ===
Line 78: Line 67:
  
 
As we identify implementation of those services that are specialized to the stp.bpmn model they will be exposed as extension points.
 
As we identify implementation of those services that are specialized to the stp.bpmn model they will be exposed as extension points.
 +
 +
== Forbidding element types ==
 +
 +
We have extended our object model to now include more BPMN element types, like data object, group, and the text annotation. We are still in the process of implementing it.
 +
 +
In the mean time, we want downstream editors to be able to forbid them. To do that, we have added some methods on BpmnDiagramEditDomain to set types that should be removed.
 +
 +
Those should be set when initializing the domain, when initializing the editor's graphical viewer.
 +
 +
==Links==
 +
 +
Return to the [[STP BPMN Modeler Status]] topic.
 +
 +
Return to the [http://www.eclipse.org/stp/bpmn/index.php STP BPMN Modeler Overview].
 +
 +
[[Category:BPMN]]
 +
[[Category:SOA]]
 +
[[Category:STP]]

Latest revision as of 06:16, 17 August 2009

This page is deprecated. Please use the [STP/BPMN_Component/EclipseCon2008 EclipseCon 2008 tutorial] instead.

Annotating the stp.bpmn Domain Model

This topic explains how to add to the bpmn diagram custom data. It also describes how to display and interact with that custom data.

The reader should be familiar with the Eclipse Modeling Framework (EMF) and in some cases the Graphical Modeling Framework (GMF) and the Graphical Editing Framework (GEF).

Every element of the domain model of the stp.bpmn modeler is an EMF EModelElement. This means that it can be attached arbitrary annotations.

Here are various techniques to use that ability.

Displaying the Value of the Annotation

By default the EAnnotations added to the bpmn objects are displayed in the properties view inside the 'BPMN' tabulation.

EAnnotations are tied to their EModelElement through the source property which is a String. EAnnotations contain a HashMap of Strings to Strings.

The BPMN properties view display a table with two columns: The first column is the source of the EAnnotation concatenated to the key of the Details HashMap.

The second column is the value of the Details HashMap. You can edit this value and it will mark the editor dirty.

Bpmn view.jpg

Displaying the Annotation on the Diagram

Once the model has annotations it is possible to display in the diagram that the model element associated to a particular shape or connection has been annotated. In order to do this, we have implemented an extension point: org.eclipse.stp.bpmn.diagram.EAnnotationDecorator. You can have a look at it here : http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.stp.bpmn/org.eclipse.stp.bpmn.diagram/schema/EAnnotationDecorator.exsd?cvsroot=STP_Project --Atoulme.intalio.com 15:31, 2 December 2006 (EST) will change to direct link when in documentation

The EAnnotation decorator extension point register a decorator for an annotation source. It then instanciates the IEAnnotation class declared in the extension point. See http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.stp.bpmn/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/dnd/IEAnnotationDecorator.java?cvsroot=STP_Project

--Atoulme.intalio.com 15:31, 2 December 2006 (EST) will change by direct link when in documentation

Decorated icon.jpg

Annotating the stp.bpmn: Drag and Drop

It is possible to drag and drop things to attach annotations to the stp.bpmn domain model.

You will have to declare a IDNDHandler instance in your extension point that will provide callback method when the drop edit policy on the shape is asked for a command. The javadoc is pretty much explicit there. However, when coding the doPerformDrop method, you will have to use the GMF and GEF standards on the context handling. You are in a read-only context in this case, so you should add commands to the CompoundCommand that is given to you in parameter. If those commands are found to be non-executable, the drop will be canceled.

http://dev.eclipse.org/svnroot/stp/org.eclipse.stp.bpmn-modeler/org.eclipse.stp.bpmn/trunk/org.eclipse.stp.bpmn.diagram/customsrc/org/eclipse/stp/bpmn/dnd/IDnDHandler.java

The object dragged must be "IAdaptable" to an EAnnotation. The implementation of the extension point will define if the drop can execute and will show feedback in a balloon figure.


FeedbackonDnD.jpg

More on the drag and drop extensibility

A simple implementation is provided in the org.eclipse.stp.bpmn.diagram plugin. An article is being drafted to present it: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=165083

Other needs

The hardcore way to customize the editor consist of making your own BPMN Editor with its own EditPart factory. All you need to do is extend the stp.bpmn Editor and EditPartFactory.

We have made many packages public for now.

Also GMF validation services are very useful when adding extra rules are to analyze the code.

As we identify implementation of those services that are specialized to the stp.bpmn model they will be exposed as extension points.

Forbidding element types

We have extended our object model to now include more BPMN element types, like data object, group, and the text annotation. We are still in the process of implementing it.

In the mean time, we want downstream editors to be able to forbid them. To do that, we have added some methods on BpmnDiagramEditDomain to set types that should be removed.

Those should be set when initializing the domain, when initializing the editor's graphical viewer.

Links

Return to the STP BPMN Modeler Status topic.

Return to the STP BPMN Modeler Overview.