Child pages
  • Graphical Modeling with Graphiti

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Add a Text element to states in the  StateAddFeature in order to display the name of each state.
  2. Create a new class StateDirectEditingFeature extending AbstractDirectEditingFeature and register it by overriding getDirectEditingFeature in the TuringFeatureProvider. 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.
  3. Create a new class StateUpdateFeature extending AbstractUpdateFeature and register it by overriding getUpdateFeature in the TuringFeatureProvider. 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 isAutoUpdateAtRuntime (resp. Startup / Reset) in the TuringDiagramTypeProvider and returning true. The update feature can be invoked explicitly in other features by calling the superclass method updatePictogramElement.
  4. Create a new class StateLayoutFeature extending AbstractLayoutFeature and register it by overriding getLayoutFeature in the TuringFeatureProvider. 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 layoutPictogramElement.

 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).