q
play

Q 1 TDT4250 - Model-driven Development of Information Systems, - PowerPoint PPT Presentation

TDT4250 - Model-driven Development of Information Systems, Autumn 2009 GMF Graphical Modeling Framework Provides a DSL, runtime and tools for building graphical editors EMF is used for defining the language concepts


  1. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 GMF – Graphical Modeling Framework � � Provides a DSL, runtime and tools for building graphical editors � � EMF is used for defining the language concepts � � Other models cover: � � graphical structure and syntax (gmfgraph) � � editing tools (gmftool) � � mapping from language concepts to graphical syntax (gmfmap) � � together these implicitly define the generator model (gmfgen) Q 1

  2. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Overview of GMF models Q 2

  3. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Language concepts � � State � � name � � enterAction and exitAction � � sub-states � � Transition � � event � � condition � � action � � ExternalTransition Q � � source and target states 3

  4. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Graphical syntax � � State � � node syntactical type � � rounded rectangle � � label � � compartment for substates � � Transition � � connection syntactical type � � line with arrow between source and target states Q � � label combining event, condition and action 4

  5. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Graphical state syntax � � Syntactical types � � State node � � Substates compartment � � Figure � � rounded rectangle � � label � � rectangle (invisible) � � inset to provide target area along edges � � border layout, with label @ north and compartment @ center Q 5

  6. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Graphical transition syntax � � Syntactical type � � Transition link � � Figure � � polyline � � label � � polyline decoration @ target -1,-1 � � points defining the arrow head shape 0,0 -1, 1 Q 6

  7. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Tool palette structure � � Tools � � Create State tool � � Create Transition tool Q 7

  8. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Mapping from concepts to syntax � � Defines � � how to traverse the object structure to generate the diagram and keep it updated when the object structure changes � � top-level diagram elements � � contained elements � � what information in the objects go where in the diagram � � labels � � Lot’s of details are necessary � � a complete specification has to be detailed � � the model has necessary details, while the (generated) code Q has irrelevant and unnecessary details 8

  9. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Mapping from concepts to syntax � � Top level elements � � state � � State � � node mapping: State class to state node � � label mapping: State name attribute to label figure � � child reference and compartment mapping: State subStates reference to compartment � � Transition � � link mapping: ExternalTransition class to transition connection � � Transitions are children of states Q � � Transition source/target references to source and target � � label mapping: Transition event, condition and action attributes to label, with view and edit pattern (syntax) 9

  10. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 A GMF-based editor in slow motion... � � Create project, domain model and edit support � � Create Ecore model � � Generate edit support code � � Create GMF models and generate � � gmfgraph � � gmftool � � gmfmap � � gmfgen � � Generate diagram editor code Q � � Try editor... and edit models... until satisfied 10

  11. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create project Q 11

  12. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create Ecore (Tools) Diagram Q 12

  13. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Edit domain model diagram Q 13

  14. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create the generator model... Q 14

  15. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create the generator model... Q 15

  16. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create the generator model... Q 16

  17. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Generate model and edit support code Q 17

  18. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create gmfgraph model Q 18

  19. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create state and transition figures... Q 19

  20. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create state and transition figures... details To create arrow head, you must add points to the polyline decoration using New Child > Template Point Template Point type is at the bottom... Q 20

  21. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create state node and transition connection with labels Q 21

  22. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create gmftool Q 22

  23. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create gmfmap Q 23

  24. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 gmfmap links information in other models � � domain model (ecore) – what part of the domain is shown in the diagram � � graph model (gmfgraph) – which domain elements are mapped to which graphical elements � � tool model (gmftool) – which tools are used to create which domain elements � � These models must be loaded into the editor: Q 24

  25. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Canvas mapping � � Defines the top-level mapping � � domain model: The diagram represents (the content of) a StateMachine from the EPackage stateexample Q 25

  26. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Top level references � � Defines the top-level content of the diagram, i.e. where to start traversing the model � � Child (next slide) – the mapping for this node type � � Children Feature – the EReference (domain model) that links to these top-level objects � � Containment Feature – the EReference that contains these top-level objects Q � � Children and Containment Feature are the same in this case, since there’s only one node type 26

  27. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Node mapping � � Defines one mapping from domain element to graph(ical) node element � � contains sub-mappings for content/children, e.g. labels and compartments Q 27

  28. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Link mapping � � Defines one mapping from domain element to graph(ical) link element � � contains sub-mappings for content, e.g. labels Q Note the order! 28

  29. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Generate gmfgen � � Combines information in the other models � � Includes extra details that can be customized Q 29

  30. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Generate diagram editor � � Creates a so-called plugin project for the diagram editor Q 30

  31. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Test the generated editor � � Run as a new Eclipse instances � � Create new project Q 31

  32. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 Create new stateexample diagram Q 32

  33. TDT4250 - Model-driven Development of Information Systems, Autumn 2009 It works! Q 33

Recommend


More recommend