Eclipse Draw2d
2.1

org.eclipse.draw2d
Class FlowLayout

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

public class FlowLayout
extends AbstractHintLayout

Lays our children in rows or columns, wrapping when the current row/column is filled. The aligment and spacing of rows in the parent can be configured. The aligment and spacing of children within a row can be configured.


Field Summary
static int ALIGN_CENTER
           
static int ALIGN_LEFTTOP
           
static int ALIGN_RIGHTBOTTOM
           
protected  boolean fill
           
protected  boolean horizontal
           
static boolean HORIZONTAL
           
protected  int majorAlignment
           
protected  int majorSpacing
           
protected  int minorAlignment
           
protected  int minorSpacing
           
protected  Transposer transposer
           
static boolean VERTICAL
           
 
Fields inherited from class org.eclipse.draw2d.AbstractLayout
preferredSize
 
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 container, int wHint, int hHint)
          Calculates the preferred size of the given figure, using width and height hints.
protected  Dimension getChildSize(IFigure child, int wHint, int hHint)
          Provides the given child's preferred size
 int getMajorAlignment()
          Returns the alignment used for an entire row/column.
 int getMajorSpacing()
          Returns the spacing in pixels to be used between children in the direction parallel to the layout's orientation.
 int getMinorAlignment()
          Returns the alignment used for children within a row/column.
 int getMinorSpacing()
          Returns the spacing to be used between children within a row/column
 boolean isHorizontal()
          Returns whether the orientation of the layout is horizontal or not.
protected  boolean isSensitiveHorizontally(IFigure parent)
          Returns whether this layout manager is sensitive to changes in the horizontal hint.
protected  boolean isSensitiveVertically(IFigure parent)
          Returns whether this layout manager is sensitive to changes in the vertical hint.
 void layout(IFigure parent)
          Lays out the given figure.
protected  void layoutRow(IFigure parent)
          Layouts one row of components.
protected  void setBoundsOfChild(IFigure parent, IFigure child, Rectangle bounds)
          Sets the given bounds for the child figure input.
 void setHorizontal(boolean flag)
          Sets the orientation of the layout.
 void setMajorAlignment(int align)
          Sets the alignment for an entire row/column within the parent figure.
 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 within a row/column.
 void setMinorSpacing(int n)
          Sets the spacing to be used between children within a row/column.
 void setStretchMinorAxis(boolean value)
          Sets flag based on layout orientation.
 
Methods inherited from class org.eclipse.draw2d.AbstractHintLayout
calculateMinimumSize, getMinimumSize, getPreferredSize, invalidate
 
Methods inherited from class org.eclipse.draw2d.AbstractLayout
calculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, 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
See Also:
Constant Field Values

ALIGN_LEFTTOP

public static final int ALIGN_LEFTTOP
See Also:
Constant Field Values

ALIGN_RIGHTBOTTOM

public static final int ALIGN_RIGHTBOTTOM
See Also:
Constant Field Values

HORIZONTAL

public static final boolean HORIZONTAL
See Also:
Constant Field Values

VERTICAL

public static final boolean VERTICAL
See Also:
Constant Field Values

horizontal

protected boolean horizontal

fill

protected boolean fill

transposer

protected Transposer transposer

majorAlignment

protected int majorAlignment

minorAlignment

protected int minorAlignment

minorSpacing

protected int minorSpacing

majorSpacing

protected int majorSpacing
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 container,
                                           int wHint,
                                           int hHint)
Description copied from class: AbstractLayout
Calculates the preferred size of the given figure, using width and height hints.

Specified by:
calculatePreferredSize in class AbstractLayout
Parameters:
container - The figure
wHint - The width hint
hHint - The height hint
Returns:
The preferred size
See Also:
AbstractLayout.calculatePreferredSize(IFigure, int, int)

getChildSize

protected Dimension getChildSize(IFigure child,
                                 int wHint,
                                 int hHint)
Provides the given child's preferred size

Parameters:
child - The Figure whose preferred size needs to be calculated
wHint - The width hint to be used when calculating the child's preferred size
hHint - The height hint to be used when calculating the child's preferred size
Returns:
the child's preferred size

getMajorAlignment

public int getMajorAlignment()
Returns the alignment used for an entire row/column.

Possible values are :

Returns:
the Major alignment of the children.
Since:
2.0
See Also:
setMajorAlignment(int)

getMajorSpacing

public int getMajorSpacing()
Returns the spacing in pixels to be used between children in the direction parallel to the layout's orientation.

Returns:
major spacing

getMinorAlignment

public int getMinorAlignment()
Returns the alignment used for children within a row/column.

Possible values are :

Returns:
Minor alignment of the children.
Since:
2.0
See Also:
setMinorAlignment(int)

getMinorSpacing

public int getMinorSpacing()
Returns the spacing to be used between children within a row/column. * @return minor spacing


isHorizontal

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

Returns:
Orientation of the layout.
Since:
2.0

isSensitiveHorizontally

protected boolean isSensitiveHorizontally(IFigure parent)
Description copied from class: AbstractHintLayout
Returns whether this layout manager is sensitive to changes in the horizontal hint. By default, this method returns true.

Overrides:
isSensitiveHorizontally in class AbstractHintLayout
Parameters:
parent - the layout's container
Returns:
true if this layout is sensite to horizontal hint changes

isSensitiveVertically

protected boolean isSensitiveVertically(IFigure parent)
Description copied from class: AbstractHintLayout
Returns whether this layout manager is sensitive to changes in the vertical hint. By default, this method returns true.

Overrides:
isSensitiveVertically in class AbstractHintLayout
Parameters:
parent - the layout's container
Returns:
true if this layout is sensite to vertical hint changes
See Also:
org.eclipse.draw2d.AbstractHintLayout#isSensitiveVertically()

layout

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

Parameters:
parent - The figure
See Also:
LayoutManager.layout(IFigure)

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

setStretchMinorAxis

public void setStretchMinorAxis(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 for an entire row/column within the parent figure.

Possible values are :

Parameters:
align - Major alignment required.
Since:
2.0
See Also:
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 within a row/column.

Possible values are :

Parameters:
align - Minor alignment required.
Since:
2.0
See Also:
getMinorAlignment()

setMinorSpacing

public void setMinorSpacing(int n)
Sets the spacing to be used between children within a row/column.

Parameters:
n - Amount of minor space.
Since:
2.0
See Also:
setMajorSpacing(int)

Eclipse Draw2d
2.1

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.