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

q
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

1

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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)

slide-2
SLIDE 2

2

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Overview of GMF models

slide-3
SLIDE 3

3

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Language concepts

State

name enterAction and exitAction sub-states

Transition

event condition action

ExternalTransition

source and target states

slide-4
SLIDE 4

4

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Graphical syntax

State

node syntactical type rounded rectangle label compartment for

substates

Transition

connection syntactical type line with arrow

between source and target states

label combining event, condition and action

slide-5
SLIDE 5

5

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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

slide-6
SLIDE 6

6

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Graphical transition syntax

Syntactical type

Transition link

Figure

polyline

label polyline decoration @ target

points defining the arrow head shape

  • 1,-1

0,0

  • 1, 1
slide-7
SLIDE 7

7

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Tool palette structure

Tools

Create State tool Create Transition tool

slide-8
SLIDE 8

8

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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

has irrelevant and unnecessary details

slide-9
SLIDE 9

9

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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 Transition source/target references to source and target label mapping: Transition event, condition and action attributes

to label, with view and edit pattern (syntax)

slide-10
SLIDE 10

10

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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

Try editor... and edit models... until satisfied

slide-11
SLIDE 11

11

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create project

slide-12
SLIDE 12

12

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create Ecore (Tools) Diagram

slide-13
SLIDE 13

13

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Edit domain model diagram

slide-14
SLIDE 14

14

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create the generator model...

slide-15
SLIDE 15

15

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create the generator model...

slide-16
SLIDE 16

16

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create the generator model...

slide-17
SLIDE 17

17

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Generate model and edit support code

slide-18
SLIDE 18

18

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create gmfgraph model

slide-19
SLIDE 19

19

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create state and transition figures...

slide-20
SLIDE 20

20

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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

slide-21
SLIDE 21

21

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create state node and transition connection with labels

slide-22
SLIDE 22

22

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create gmftool

slide-23
SLIDE 23

23

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create gmfmap

slide-24
SLIDE 24

24

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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:

slide-25
SLIDE 25

25

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Canvas mapping

Defines the top-level mapping

domain model: The diagram represents (the content of) a

StateMachine from the EPackage stateexample

slide-26
SLIDE 26

26

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

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

Children and Containment Feature are the same in this case,

since there’s only one node type

slide-27
SLIDE 27

27

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Node mapping

Defines one mapping from domain element to

graph(ical) node element

contains sub-mappings for content/children, e.g. labels and

compartments

slide-28
SLIDE 28

28

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Link mapping

Defines one mapping from domain element to

graph(ical) link element

contains sub-mappings for

content, e.g. labels Note the order!

slide-29
SLIDE 29

29

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Generate gmfgen

Combines information

in the other models

Includes extra details

that can be customized

slide-30
SLIDE 30

30

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Generate diagram editor

Creates a so-called

plugin project for the diagram editor

slide-31
SLIDE 31

31

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Test the generated editor

Run as a new

Eclipse instances

Create new project

slide-32
SLIDE 32

32

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

Create new stateexample diagram

slide-33
SLIDE 33

33

TDT4250 - Model-driven Development of Information Systems, Autumn 2009

Q

It works!