...
- Add a
Text
element to states in theStateAddFeature
in order to display the name of each state. - Create a new class
StateDirectEditingFeature
extendingAbstractDirectEditingFeature
and register it by overridinggetDirectEditingFeature
in theTuringFeatureProvider
. 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. - Create a new class
StateUpdateFeature
extendingAbstractUpdateFeature
and register it by overridinggetUpdateFeature
in theTuringFeatureProvider
. 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 extendingisAutoUpdateAtRuntime
(resp.Startup
/Reset
) in theTuringDiagramTypeProvider
and returningtrue
. The update feature can be invoked explicitly in other features by calling the superclass methodupdatePictogramElement
. - Create a new class
StateLayoutFeature
extendingAbstractLayoutFeature
and register it by overridinggetLayoutFeature
in theTuringFeatureProvider
. 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 methodlayoutPictogramElement
.
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).