Skip to main content
Jump to: navigation, search

Papyrus/Mars Work Description/Improvments/Stereotype support/Solution Implementation

Stereotype Display: Solution Implementation

Architecture

Technically, the DecorationNode will be extended to create StereotypeLabel element into notation file. As well as for the stereotype properties.

Demo is available here

Notation Model Structure

Structure into Notation file would be:

DecorationNode[type=StereotypeLabel][stereotype ="SysML::Allocations::Allocated"]
BasicCompartment[type=StereotypeCompartment][stereotype="SysML::Allocations::Allocated"]
    DecorationNode[type=StereotypeProperty][property ="allocatedFrom=0..*" ]
    DecorationNode[type=StereotypeProperty][property ="allocatedTo=0..*" ]
BasicCompartment[type=StereotypeBrace][stereotype="SysML::Allocations::Allocated"]
    DecorationNode[type=StereotypeBraceProperty][property ="allocatedFrom=0..*" ]
    DecorationNode[type=StereotypeBraceProperty][property ="allocatedTo=0..*" ]

Structure for the stereotype name Label:

DecorationNode (type = StereotypeLabel)
    stereotype(String: "SysML::Allocations::Allocated")
    element(Stereotype: "SysML::Allocations::Allocated")
    depth (String: None, Full, Auto, -1,-2,-3,...)

Structure of the property (to be defined):

BasicCompartment (type = StereotypeCompartment)
    stereotype(String: "SysML::Allocations::Allocated")
    element(Stereotype: "SysML::Allocations::Allocated")
    DecorationNode (type = StereotypeProperty)
       element( UML Property : AllocatedFrom )

EditPolicies Hierarchy

Here is the Class diagram that could be the solution for the new architecture:

ASEditPolicy.JPG

Legend:

  • AS = AppliedStereotype
  • green block = new
  • red block = modified
  • blue block = not changed

Property View Design

As also listed in the requirements, the Graphical User Interface should be improve in order to be clearer than the previous interface. The main different with the previsous structure is that the location of the properties is not exclusive anymore. The User can then choose to display some properties at different locations:

  • In a Compartment
  • In a Comment
  • In Braces

Here is the first suggestion for the Stereotype Display:

StereotypeTable.JPG

This will be implement during the Objective 5.

Intermediate Objectives

To plan the several steps of this whole improvement, it will be splitted into sub-goals.

All the objectives will be first fulfill for the Named Elements (like the Classes, Packages, ...) Once the new structure in place for those elements, it will be done for the other types of elements.

  • Objective 1: Display all the stereotypes thanks to DecorationNode with one Label by stereotype.
  • Objective 2:
    • 2a. Hide stereotypes thanks to CSS.
    • 2b. Display Qualified Name of some stereotypes thanks to CSS.
  • Objective 3: Display all the properties into the compartment thanks to the DecorationNode into the notation file.
  • Objective 4:
    • 4a. Hide the properties thanks to the CSS
    • 4b. Display properties into braces thanks to the CSS
    • 4c. Display properties into comment thanks to CSS.
  • Objective 5: Create the graphical user interface into the Appearence Tab
  • Objective 6: Propage objectives 1 to 5 to the other element throught their own edit policied.
  • Objective 7: Plan a model transformation for a compatibility with old models using EAnnotation.


The following section details the progression of each Objective.

Objective 1

Display all the stereotypes thanks to DecorationNode with one Label by stereotype. (Done)

To fulfill this objective, the following steps should be completed:

  1. Create and Delete StereotypeLabel through a Recording Command
  2. Create / Delete objects when stereotype is applied or deleted.
  3. Display the Label through the different EditPolicies
    • For Node Label: AppliedStereotypeNodeLabelDisplayEditPolicy
  4. Delete all usage of EAnnotation for the Stereotypes


Note: Done , means that the task is done but not already comitted. The entire Objective 1 will be committed at once when completed.

Objective 2

2a. Hide stereotypes thanks to CSS (Done)
  1. Manage the isVisible parameter into the display of the Stereotype Label
  2. Edit the CSS DOM Tree to match the NamedStyle Value
2b. Display Qualified Name of some stereotypes thanks to CSS (Done)
  1. Manage the QualifiedName depth into the display of the Stereotype Label
  2. Retrieve the "depth" value from the CSS

Objective 3

Display all the properties into the compartment thanks to the DecorationNode into the notation file.(Done)
To fulfill this objective, the following steps should be completed:
  1. Create and Delete StereotypeProperty through a Recording Command
  2. Create / Delete objects when stereotype is applied or deleted.
  3. Display the Properties through the different EditPolicies
    • For Node Label: AppliedStereotypeNodeLabelDisplayEditPolicy

Objective 4

4a. Hide the properties thanks to the CSS (Done)
  1. Modify the CSS DOM tree to match the NamedStyle Selectors For "StereotypeProperty".
  2. Catch the CSS value to hide the corresponded Property.
  3. Modify the CSS DOM tree to match the NamedStyle Selectors For "StereotypeCompartment".
  4. Catch the CSS value to hide the corresponded Compartment.
Encountered issues:
  1. StereotypeProperties Labels are not created when CSS doesn't show the compartment
    • Solution: Notify "AppliedStereotypePropertyEditPolicy" when stereotype is applied. Using StereotypeElementListener instead of PapyrusStereotypeListener
  2. Error when refresh figure with an empty Property textFlow
    • Solution: Add condition on Text value during TextFlow creation into the AppliedStereotypeMultilinePropertyEditPart
4b. Display properties into braces thanks to CSS.(Done)
  1. Add The Location NamedStyle into Notation File
  2. Catch the CSS Value for the Location
  3. Calculate the New Text to display with Braces
4c. Display properties into a comment thanks to CSS.(Done)
  1. Create the Comment Object.
  2. Create the link between Comment and EditPart
  3. Calculate the text to display into the Comment
  4. Manage CSS property to display or hide properties into Comment
  5. Edit the Comment text content with the new text value
  6. Update Content when Stereotypes Applied or unapplied
  7. Delete Comment when empty
Encountered issues:
  1. CSS application have unstable behavior.
  2. When a compartment is empty, the only way to not show it is to use the CSS attribute visible:false;
  3. To be able to Hide Brace Properties independently of Compartment Properties, the Properties Structure should be dupplicated for Brace Properties
    1. See Bug 461559
  4. To manage several Stereotype Application, the related Element of the node should be the Stereotype and not it's application
    1. See Bug 461561

Objective 5

(463605)

Create the Graphical Interface to display Labels and Properties to override the CSS.
This feature depends on the Task 463834 to allow table into the Property View.
  • In the meantime, the current property view has been connected to the New structure, with some lacks.
5a. Show a Stereotype Table with a stereotype and its Properties (464409) (Done)
5b. Add the required Column into the Tables (Done)
5c. Insert the table as a Property View (Done)
5d. Add commands to Expand / Collapse (Done)
5e. Add commands to Select All / Deselect All (Done)

Objective 6

Propage objectives 1 to 5 to the other element throught their own edit policied.
  • For External Node : AppliedStereotypeExternelNodeEditPolicy
    • Done
  • For External Node label: AppliedStereotypeExternelNodeLabelEditPolicy
    • Done
  • For Icon: AppliedStereotypeIconDisplayEditPolicy
    • Done
  • For Link Label: AppliedStereotypeLinkLabelDisplayEditPolicy
    • Done

Objective 7

Plan a model transformation for a compatibility with old models using EAnnotation (463903).
7a. Create EditPolicy to migrate Label
  • Done
7b. Create EditPolicy to migrate Properties in brace and in Compartment
  • Done
7c. Create EditPolicy to migrate Properties in Comment
  • Done
7d. Create EditPolicy to migrate the specific cases
  • Done

Open Points and Lessons learned

Open Points

  • How an EditPolicy can be called when the Refresh (F5) of the EditPart is executed? It is required to refresh visual after applying a CSS.
    • It appears that the super Class GraphicalEditPolicy doesn't implement a refresh method, contrary to the internal class GraphicalEditPolicyEx
    • But this class is internal to GMF, so how make the refresh working for the Papyrus editPolicies.
  • What are the general Use Cases for this new feature?

Lessons learned

  • How a CSS selector can match on Notation Element likes [type="StereotypeLabel"] where "StereotypeLabel" is the type of a DecorationNode.
    • Clue : The class CSSDOMSemanticElementHelper defines rules to match the sementic Element of a notation view.
  • How to define the way the CSS selector match elements?
    • Clue: The method doGetAttribute in the class GMFUMLElementAdapter return the corresponding element.

Back to the top