Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Right-justified layout
Right-justified layout [message #42774] Fri, 08 September 2006 08:27 Go to next message
Eclipse UserFriend
Originally posted by: jricker.progess.com

I want to layout the objects in the compartment as a row right-justified. I
keep getting a stack of objects on the right. What gives? Is this a bug?

public IFigure createFigure() {
ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
.createFigure();
FlowLayout layout = new FlowLayout(true);
layout.setMajorAlignment(FlowLayout.ALIGN_RIGHTBOTTOM);
result.setLayoutManager(layout);
result.setTitleVisibility(false);
return result;
}
Re: Right-justified layout [message #45148 is a reply to message #42774] Mon, 11 September 2006 12:14 Go to previous message
Eclipse UserFriend
Originally posted by: ricker.distributedinstruments.com

I found the answer by diving into the source code (as you all more
learned people probably expected me to do in the first place).

A ResizableCompartmentFigure contains two children figures, a Figure for
the text pane (optional) and the ScrollPane. The ScrollPane child object
has a child figure itself called content. Setting the
ResizableCompartmentFigure layout does nothing. Setting the ScrollPane
layout does bad things (because it expects the ScrollLayout). You must
instead set the layout of the ScrollPane child figure, as such:


public class FooBarCompartmentEditPart extends ListCompartmentEditPart {
....
/**
* @generated NOT
*/
public IFigure createFigure() {
ResizableCompartmentFigure result = (ResizableCompartmentFigure)
super.createFigure();
IFigure fig = result.getContentPane();
FlowLayout layout = new FlowLayout(true);
layout.setMajorAlignment(FlowLayout.ALIGN_RIGHTBOTTOM);
fig.setLayoutManager(layout);
result.setTitleVisibility(false);
return result;
}


Ricker wrote:
> I want to layout the objects in the compartment as a row right-justified. I
> keep getting a stack of objects on the right. What gives? Is this a bug?
>
> public IFigure createFigure() {
> ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
> .createFigure();
> FlowLayout layout = new FlowLayout(true);
> layout.setMajorAlignment(FlowLayout.ALIGN_RIGHTBOTTOM);
> result.setLayoutManager(layout);
> result.setTitleVisibility(false);
> return result;
> }
>
>
Previous Topic:Why I can't select node in my compartment to move
Next Topic:How can I get the Diagram from Diagram file without opening it?
Goto Forum:
  


Current Time: Tue Jul 22 19:10:02 EDT 2025

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

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

Back to the top