Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to create a Custom Layout
How to create a Custom Layout [message #50650] Tue, 19 September 2006 06:04 Go to next message
Eclipse UserFriend
Hi,

How can I create a CustomLayout? Are thery any tutorial, guides? Which
class should I sub-class, what methods should I overwrite, etc.

Regards,
Trifonov
Re: How to create a Custom Layout [message #50792 is a reply to message #50650] Tue, 19 September 2006 07:33 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

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.

I can try to answer the second one.

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

Regards,
Michael

"Trifonov" <ttrifonov@sbnd.net> wrote in message
news:92b38e73bf4046fb44141c93c1a58247$1@www.eclipse.org...
> Hi,
>
> How can I create a CustomLayout? Are thery any tutorial, guides? Which
> class should I sub-class, what methods should I overwrite, etc.
>
> Regards,
> Trifonov
>
Re: How to create a Custom Layout [message #51446 is a reply to message #50650] Tue, 19 September 2006 15:54 Go to previous message
Eclipse UserFriend
Originally posted by: liam.morley.baesystems.com

I have the GMF Help installed, and it seems to have plenty of information. I
haven't personally looked into creating custom layouts, but "GMF Developer
Guide > Examples Guide > Runtime > Layout Service" might help you out.
Here's a copy-and-paste of the introduction:

"This guide describes the Layout Service example in the SDK. This example
demonstrates a how to create a custom provider for the Layout Service which
can be invoked from with-in a diagram editor."

There's also a tutorial on "Modifying a Container to Support Automatic
Layout", and maybe one or two others.

Liam Morley


"Trifonov" <ttrifonov@sbnd.net> wrote in message
news:92b38e73bf4046fb44141c93c1a58247$1@www.eclipse.org...
> Hi,
>
> How can I create a CustomLayout? Are thery any tutorial, guides? Which
> class should I sub-class, what methods should I overwrite, etc.
>
> Regards,
> Trifonov
>
Previous Topic:Automatic update yields file not found errors
Next Topic:Installation Issues
Goto Forum:
  


Current Time: Wed Apr 30 11:30:15 EDT 2025

Powered by FUDForum. Page generated in 0.06785 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top