Draw2D v2.0

org.eclipse.draw2d
Class FlowLayout

java.lang.Object
  |
  +--org.eclipse.draw2d.AbstractLayout
        |
        +--org.eclipse.draw2d.FlowLayout
All Implemented Interfaces:
LayoutManager

public class FlowLayout
extends AbstractLayout

Implements the ILayoutManager interface using the Flow Layout algorithm. This displays the components of the container figure in an ordered list. The components can also be aligned in different ways within the available space.


Field Summary
static int ALIGN_CENTER
           
static int ALIGN_LEFTTOP
           
static int ALIGN_RIGHTBOTTOM
           
protected  boolean fFill
           
protected  boolean horizontal
           
static boolean HORIZONTAL
           
protected  int majorAlignment
           
protected  int minorAlignment
           
protected  Transposer transposer
           
static boolean VERTICAL
           
 
Constructor Summary
FlowLayout()
          Constructs a FlowLayout with horizontal orientation.
FlowLayout(boolean isHorizontal)
          Constructs a FlowLayout whose orientation is given in the input.
 
Method Summary
protected  Dimension calculatePreferredSize(IFigure parent)
          Calculates and returns the preferred size of the container given as input.
 int getMajorAlignment()
          Returns the alignment along the major orientation of the layout.
 int getMinorAlignment()
          Returns the alignment of the layout perpendicular to the orientation of the layout.
 boolean isHorizontal()
          Returns whether the orientation of the layout is horizontal or not.
 void layout(IFigure parent)
          Lays out the given figure.
protected  void layoutRow(IFigure parent)
          Layouts one row of components.
 void setAlignment(int align)
          Deprecated. Use specific major, minor alignment approaches.
protected  void setBoundsOfChild(IFigure parent, IFigure child, Rectangle bounds)
          Sets the given bounds for the child figure input.
 void setFill(boolean value)
          Sets flag based on layout orientation.
 void setHorizontal(boolean flag)
          Sets the orientation of the layout.
 void setMajorAlignment(int align)
          Sets the alignment required along the orientation direction set.
 void setMajorSpacing(int n)
          Sets the spacing in pixels to be used between children in the direction parallel to the layout's orientation.
 void setMinorAlignment(int align)
          Sets the alignment to be used between children perpendicular to the orientation of the layout.
 void setMinorSpacing(int n)
          Sets the spacing to be used between children perpendicular to the orientation of the layout.
 
Methods inherited from class org.eclipse.draw2d.AbstractLayout
calculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, getPreferredSize, invalidate, invalidate, remove, setConstraint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIGN_CENTER

public static final int ALIGN_CENTER

ALIGN_LEFTTOP

public static final int ALIGN_LEFTTOP

ALIGN_RIGHTBOTTOM

public static final int ALIGN_RIGHTBOTTOM

HORIZONTAL

public static final boolean HORIZONTAL

VERTICAL

public static final boolean VERTICAL

horizontal

protected boolean horizontal

fFill

protected boolean fFill

transposer

protected Transposer transposer

majorAlignment

protected int majorAlignment

minorAlignment

protected int minorAlignment
Constructor Detail

FlowLayout

public FlowLayout()
Constructs a FlowLayout with horizontal orientation.
Since:
2.0
See Also:
FlowLayout(boolean)

FlowLayout

public FlowLayout(boolean isHorizontal)
Constructs a FlowLayout whose orientation is given in the input.
Parameters:
isHorizontal - Whether the layout should be horizontal.
Since:
2.0
Method Detail

calculatePreferredSize

protected Dimension calculatePreferredSize(IFigure parent)
Calculates and returns the preferred size of the container given as input.
Overrides:
calculatePreferredSize in class AbstractLayout
Parameters:
figure - Figure whose preferred size is required.
Returns:
The preferred size of the passed Figure.
Since:
2.0

getMajorAlignment

public int getMajorAlignment()
Returns the alignment along the major orientation of the layout. Possible values are :
Returns:
Major alignment of the children.
Since:
2.0
See Also:
setMajorAlignment(int), setMinorAlignment(int), getMinorAlignment()

getMinorAlignment

public int getMinorAlignment()
Returns the alignment of the layout perpendicular to the orientation of the layout. Possible values are :
Returns:
Minor alignment of the children.
Since:
2.0
See Also:
setMajorAlignment(int), setMinorAlignment(int), getMajorAlignment()

isHorizontal

public boolean isHorizontal()
Returns whether the orientation of the layout is horizontal or not.
Returns:
Orientation of the layout.
Since:
2.0

layout

public void layout(IFigure parent)
Description copied from interface: LayoutManager
Lays out the given figure.

layoutRow

protected void layoutRow(IFigure parent)
Layouts one row of components. This is done based on the layout's orientation, minor alignment and major alignment.
Parameters:
parent - Figure whose children are to be placed.
Since:
2.0

setBoundsOfChild

protected void setBoundsOfChild(IFigure parent,
                                IFigure child,
                                Rectangle bounds)
Sets the given bounds for the child figure input.
Parameters:
parent - Parent Figure which holds the child.
child - Child Figure whose bounds are to be set.
bounds - The size of the child to be set.
Since:
2.0

setFill

public void setFill(boolean value)
Sets flag based on layout orientation. If in Horizontal orientation, all Figures will have the same height. If in vertical orientation, all Figures will have the same width.
Parameters:
value - Fill state desired.
Since:
2.0

setHorizontal

public void setHorizontal(boolean flag)
Sets the orientation of the layout.
Parameters:
flag - Orientation of the layout.
Since:
2.0

setMajorAlignment

public void setMajorAlignment(int align)
Sets the alignment required along the orientation direction set. Possible values are :
Parameters:
align - Major alignment required.
Since:
2.0
See Also:
setMinorAlignment(int), getMinorAlignment(), getMajorAlignment()

setMajorSpacing

public void setMajorSpacing(int n)
Sets the spacing in pixels to be used between children in the direction parallel to the layout's orientation.
Parameters:
n - Amount of major space.
Since:
2.0
See Also:
setMinorSpacing(int)

setMinorAlignment

public void setMinorAlignment(int align)
Sets the alignment to be used between children perpendicular to the orientation of the layout. Possible values are :
Parameters:
align - Minor alignment required.
Since:
2.0
See Also:
setMajorAlignment(int), getMinorAlignment(), getMajorAlignment()

setMinorSpacing

public void setMinorSpacing(int n)
Sets the spacing to be used between children perpendicular to the orientation of the layout.
Parameters:
n - Amount of minor space.
Since:
2.0
See Also:
setMajorSpacing(int)

setAlignment

public void setAlignment(int align)
Deprecated. Use specific major, minor alignment approaches.

Sets the alignment to be used between children when laying out the components.
Since:
2.0
See Also:
setMajorAlignment(int), setMinorAlignment(int), getMinorAlignment(), getMajorAlignment()

Draw2D v2.0