Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Setting the Layout for the Compartment Figure
Setting the Layout for the Compartment Figure [message #216075] Thu, 22 January 2009 06:55 Go to next message
Abhishek Chakraborty is currently offline Abhishek ChakrabortyFriend
Messages: 82
Registered: July 2009
Location: Cologne, Germany
Member

hi ,

I m trying to set a grid layout for my compartment figure, but it is not
reflecting in it. Kindly suggest a way by which i can set the Layout.

i have tried to set the layout in the gmfgraph model ,still the result is
same.
The only thing that i am able to change is the listlayout from the gmfgen
model.


Thanks,
Abhishek Chakraborty


Regards,
Abhishek Chakraborty
Re: Setting the Layout for the Compartment Figure [message #216098 is a reply to message #216075] Thu, 22 January 2009 10:04 Go to previous messageGo to next message
Lavanya K C is currently offline Lavanya K CFriend
Messages: 23
Registered: July 2009
Junior Member
You can try overriding createFigure() method of XXXCompartmentEditpart

public IFigure createFigure() {
ResizableCompartmentFigure rcf = (ResizableCompartmentFigure)
super.createFigure();
rcf.getContentPane().setLayoutManager(new GridLayout());
return rcf;
}
And you need to install a custom layout edit policy.

Hope this helps.

Lavanya.
Re: Setting the Layout for the Compartment Figure [message #216170 is a reply to message #216098] Thu, 22 January 2009 17:54 Go to previous message
Abhishek Chakraborty is currently offline Abhishek ChakrabortyFriend
Messages: 82
Registered: July 2009
Location: Cologne, Germany
Member

Hi lavanya,

first of all thanks for your reply , i tried your solution but it didn't
work too.

i searched thru the web and came to this in GMF archived newsgroup, i
think the problem is still there.



* Q: I need to align the elements in compartment in single row (using
the

mindmap example - the 'Threads' shoul be in a single row) but when I use
layout for the figure that represent the compartment - the element inside
doesn't respect that layout...

the List Layout trye/false in gmfgen doesn't work for me.. if it is true
the elements are aligned in a columns and only the labels were used, if it
is false - the XY Layout is used.

Can somebody give me any hints how to solve it?

after some debug I noticed that the compartment is another figure and
that's why the compartment doesn't respect the parent figure's layout
manager.

It seems that there is a lack of Layout managers for compartment - there
are only 2 layout managers for Compartment - in gmfgen - List Layout -
true (FlowLayout vertical) and false(XYLayout).

How can I use other layout? I need flowlayout but horizontal...

* A: As I may understand it is hard to set custom layout for
ResizableCompartmentFigure, due to the internal dependencies. Say,
ResizableCompartmentEditPart assumes that the figure has a layoutManager
that accepts Float's (ratios) as constraints. Probably someone from
runtime team could clarify this more deeper.

But if you just need horizontal flow layout, please try to modify
CompartmentEditPart class to call
ResizableCompartmentFigure#setHorizontal(true) inside the createFigure()
method.

I had exactly same problem as you. It's still unresolved, but fortunately
new versions of GMF at least render figures in List Layout (obviously as
columns) and you can terminate edges at them. Probably almost all people
who use GMF generator try to build UML editors which do not need such
functionality :)






.........................


Regards,
Abhishek Chakraborty
Previous Topic:ShowElementRequest: Showing Related Elements with the Connection Handles
Next Topic:background color change of palette
Goto Forum:
  


Current Time: Fri Apr 26 13:47:55 GMT 2024

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

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

Back to the top