Graphical Modeling Framework/Models/GMFGraph
- 1 Scenarios
- 1.1 Scalable/resizable figures
- 1.2 How can I start with CustomFigures
- 1.3 How can I use CustomLayout and what is purpose of the CustomAttribute
- 1.4 There's a legacy GEF figure code and I'd like to use it with GMF
- 1.5 I need a figure that is similar to UML package
- 1.6 How to create several figures at once
How can I start with CustomFigures
How can I use CustomLayout and what is purpose of the CustomAttribute
From Newsgroup thread
gmfgraph.CustomLayout is just a gate to the custom implementation of the org.eclipse.draw2d.LayoutManager class. Thus there is in fact 2 questions -- how to write draw2d Layout manager and how to plug it into the gmfgraph. This covers only the latter.
Imagine you have com.xyz.SuperLayout class in the com.xyz.misc plugin. The SuperLayout class has method setBoolParam(boolean) and public instance field int myIntParam; It also expects the instanceof superLayoutData that has setter setStringParam(String s).
To plug this into gmfgraph you need:
- Create separate ResourceGallery, set implementation bundle to "com.xyz.misc"
- Create figures structure.
- In the container node create CustomLayout, set fqn = "com.xyz.SuperLayout". Note that bundleName property of CustomLayout is deprecated and not used, it does not make sense to change it.
- In the just created Custom Layout create custom attribute, set name = boolParam (or BoolParam -- it doesnot make sense) -- the name is derived
from setter name, value = (say) "false" or "42 / 2 >= 21".
- Create one more custom attribute, name = "myIntParam" (derived from field name), value = "42", isDirectAccess = true.
- In the child figure create CustomLayoutData, set fqn = "com.xyz.SuperLayutData", repeat step 4 for custom attribute "StringParam" if needed.
Note that values set at the steps 4, 5 are considered opaque and just generated into the setter call or assignment statement as is. Thus, to set the string value "MG" for custom attribute StringParam you need to set value = "MG" (with quotes).
There's a legacy GEF figure code and I'd like to use it with GMF
tbd (check for MapMode, etc)
I need a figure that is similar to UML package
There's no need to use custom figure, just use some GMFGraph magic...tbd TODO put link to newsgroup discussion If you like to have custom anchor behaviour (e.g. no link attaching to package title box), you need to hand code it (there was a posting in the newsgroup).
How to create several figures at once
I.e. when creating some element, few additional should be created as well. tbd Need to find better place for this, as it's not gmfgraph topic