Changes for page Graphical Modeling with Graphiti
Last modified by msp on 2025/01/30 12:03
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -218,7 +218,7 @@ 218 218 } 219 219 {{/code}} 220 220 ))) 221 -1. Test the features in the diagram editor. You should now be able to select "State" in the editor's palette. Use this to create a few states. Note that if you create a state and later change the graphical representation in StateAddFeature, the previously created state will still look the same, since the add feature code is only applied to new states created from the palette. 221 +1. Test the features in the diagram editor. You should now be able to select "State" in the editor's palette. Use this to create a few states. Note that if you create a state and later change the graphical representation in {{code language="none"}}StateAddFeature{{/code}}, the previously created state will still look the same, since the add feature code is only applied to new states created from the palette. 222 222 223 223 = Creating and Adding Connections = 224 224 ... ... @@ -384,7 +384,11 @@ 384 384 385 385 = Handling Text Labels = 386 386 387 -The last section of this tutorial is about text labels in the graphical editor. We will use such labels for state names and transition specifications. The steps required for these tasks are given only coarsely here, since you should now be able to find out yourself about the details using the [[Graphiti documentation>>url:http://www.eclipse.org/graphiti/documentation/||shape="rect"]].387 +The last section of this tutorial is about text labels in the graphical editor. We will use such labels for displaying state names. The steps required for these tasks are given only coarsely here, since you should now be able to find out yourself about the details using the [[Graphiti documentation>>url:http://www.eclipse.org/graphiti/documentation/||shape="rect"]]. 388 388 389 389 1. Add a {{code language="none"}}Text{{/code}} element to states in the {{code language="none"}}StateAddFeature{{/code}} in order to display the name of each state. 390 -1. Create a new class {{code language="none"}}StateDirectEditingFeature{{/code}} extending {{code language="none"}}AbstractDirectEditingFeature{{/code}} and register it by overriding {{code language="none"}}getDirectEditingFeature{{/code}} in the {{code language="none"}}TuringFeatureProvider{{/code}}. This new feature is responsible for connecting the edited text with the name attribute of states. 390 +1. Create a new class {{code language="none"}}StateDirectEditingFeature{{/code}} extending {{code language="none"}}AbstractDirectEditingFeature{{/code}} and register it by overriding {{code language="none"}}getDirectEditingFeature{{/code}} in the {{code language="none"}}TuringFeatureProvider{{/code}}. This new feature is responsible for connecting the name attribute of states with the in-diagram text editing box, i.e. retrieving the current text from the attribute and updating it after the user has entered a new value. 391 +1. Create a new class {{code language="none"}}StateUpdateFeature{{/code}} extending {{code language="none"}}AbstractUpdateFeature{{/code}} and register it by overriding {{code language="none"}}getUpdateFeature{{/code}} in the {{code language="none"}}TuringFeatureProvider{{/code}}. This new feature is responsible for updating the displayed text when the corresponding attribute in the domain model is changed outside the Graphiti editor. For example you could open the Turing Machine model with the //Sample Reflective Ecore Model Editor //in order to modify attributes. You can activate automatic updates of the diagram by extending {{code language="none"}}isAutoUpdateAtRuntime{{/code}} (resp. {{code language="none"}}Startup{{/code}} / {{code language="none"}}Reset{{/code}}) in the {{code language="none"}}TuringDiagramTypeProvider{{/code}} and returning {{code language="none"}}true{{/code}}. The update feature can be invoked explicitly in other features by calling the superclass method {{code language="none"}}updatePictogramElement{{/code}}. 392 +1. Create a new class {{code language="none"}}StateLayoutFeature{{/code}} extending {{code language="none"}}AbstractLayoutFeature{{/code}} and register it by overriding {{code language="none"}}getLayoutFeature{{/code}} in the {{code language="none"}}TuringFeatureProvider{{/code}}. This new feature is responsible for updating the position and size of graphics algorithms of a state when the state is resized in the graphical editor or when the displayed text for the state name is updated. The layout feature can be invoked explicitly in other features by calling the superclass method {{code language="none"}}layoutPictogramElement{{/code}}. 393 + 394 +Implement all created feature classes such that the editor behaves correctly when state names are modified or states are resized. You should aim for a good look-and-feel of your Turing Machine editor. If you like, you may also implement transition labels for displaying triggers and actions of transitions (not required for finishing the tutorial).
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 - 36045881 +8650915 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/ 3604588/Graphical Modeling with Graphiti1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/8650915/Graphical Modeling with Graphiti