100 likes | 172 Views
Spraying The Natural Way of Creating Graphiti. Jos Warmer, Independent jos.warmer@openmodeling.nl Karsten Thoms, Itemis karsten.thoms@itemis.de. Graphiti Approach. No code generation but: Uses a runtime engine Programmed using a Java API Easy (relatively) to understand code. But ….
E N D
Spraying The Natural Way of Creating Graphiti Jos Warmer, Independent jos.warmer@openmodeling.nl Karsten Thoms, Itemis karsten.thoms@itemis.de
Graphiti Approach • No code generation but: • Uses a runtime engine • Programmed using a Java API • Easy (relatively) to understand code
But … • Programming the editor in Java is much (often simple but repetitive) work. • E.g. for one shape for one metaclass: • At least five feature classes: AddFeature, CreateFeature, DeleteFeature, LayoutFeature, UpdateFeature • Features all need to be configured in the FeatureProvider • Need to configure palette in the ToolBehaviourProvider • Need to configure used images in ImageProvider • Repeat this for e.g. ten metaclasses ……….
The Spray Graphiti Generator • Started a research project • Got a government grant • Became useful before being finished • Project for Visual Insurance Product Modeling language • Spray had to be adapted to the PMW project • Became partly generic, partly project specific • Resulting Editors are used by non IT users in production • Works well (at least for PMW )
The Spray Graphiti Generator • Spray has become open source in July • At: http://code.google.com/a/eclipselabs.org/p/spray/ • Version 0.1 was the generalized version used for PMW • EPL License • Current status • Spray is in startup phase • Much work done on infrastructure • Plans • … growing Spray by adding more features as we go ….. • … getting more users and more feedback …..
Define visualization for metaclassBusinessClass Icon shown in palette The Spray DSL Contents of the container References to properties of metaclass classBusinessClassicon “class.gif": container(fill = dark_green ) [ text( ) { "<<“ + eClass.name + ">> "+ name}; line(color = black width = 2); reference propertiesattribute dataType; line(color= RGB(255,138,141)); text( )"::"+ description; ] references[ superclass : connection(); ] behavior[ createpalette"Shapes" ; doWithBusinessClass"Do It With“ ; ] List of referred objects Behaviour for Product shape References of businessclass shown as connections Will be in palette to create in named compartment Custom behavior
Define visualization for metaclass Association The Spray DSL class Association icon “association.gif“ : connection(width = 2) [ from source to target fromTexttext()source.name toTexttext()targetMultiplicity.name ] Shown as a connection (line) Source and target are references in class Association Text to show at the “’from’ and ‘to’ to” side, also options for middle of connection
Spray Generator • Using textual model to define graphical editor • Xtext 2, Xtend 2, Xbase • Mixing generated and handwritten code by design • Uses Generation Gap pattern • Allows full access to Graphiti API • Managed by simply moving a generated file from “src-gen” to “src” folder • Generation of code from Spray DSL remains possible in full project life-cycle.
Spray Vision Making developing graphical DSL’s as easy as it is to develop textual DSL’s with e.g. Xtext.
Demo • Karsten will show a short demo by creating a simple Graphiti editor from scratch