Jump to: navigation, search

Difference between revisions of "Graphical Modeling Framework/Models/GMFGraph"

(CustomLayout explanation from news group added)
(copied newsgroup posting)
Line 9: Line 9:
  
 
=== How can I use CustomLayout and what is purpose of the CustomAttribute  ===
 
=== How can I use CustomLayout and what is purpose of the CustomAttribute  ===
[news://news.eclipse.org/eeokii$qnr$1@utils.eclipse.org Newsgroup thread]
+
From [news://news.eclipse.org/eeokii$qnr$1@utils.eclipse.org 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 ===
 
=== There's a legacy GEF figure code and I'd like to use it with GMF ===

Revision as of 07:48, 19 September 2006

Scenarios

Scalable/resizable figures

Newsgroup post


How can I start with CustomFigures

Newsgroup thread

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:

  1. Create separate ResourceGallery, set implementation bundle to "com.xyz.misc"
  2. Create figures structure.
  3. 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.
  4. 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".

  1. Create one more custom attribute, name = "myIntParam" (derived from field name), value = "42", isDirectAccess = true.
  2. 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