public class FlowLayout extends OrderedLayout
Modifier and Type | Class and Description |
---|---|
protected class |
FlowLayout.WorkingData
Holds the necessary information for layout calculations.
|
Modifier and Type | Field and Description |
---|---|
static int |
ALIGN_LEFTTOP
Deprecated.
Use
OrderedLayout.ALIGN_TOPLEFT instead. |
static int |
ALIGN_RIGHTBOTTOM
Deprecated.
Use
OrderedLayout.ALIGN_BOTTOMRIGHT instead. |
protected FlowLayout.WorkingData |
data |
protected boolean |
fill
Deprecated.
|
protected int |
majorAlignment
Deprecated.
Use
getMajorAlignment() and
setMajorAlignment(int) instead. |
protected int |
majorSpacing
Deprecated.
Use
getMajorSpacing() and
setMajorSpacing(int) instead. |
protected int |
minorSpacing
Deprecated.
Use
getMinorSpacing() and
setMinorSpacing(int) instead. |
ALIGN_BOTTOMRIGHT, ALIGN_CENTER, ALIGN_TOPLEFT, horizontal, HORIZONTAL, minorAlignment, transposer, VERTICAL
isObservingVisibility, preferredSize
Constructor and Description |
---|
FlowLayout()
Constructs a FlowLayout with horizontal orientation.
|
FlowLayout(boolean isHorizontal)
Constructs a FlowLayout whose orientation is given in the input.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected int |
getDefaultOrientation()
Returns
PositionConstants.HORIZONTAL by default. |
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 |
getMinorSpacing()
Returns the spacing to be used between children within a row/column.
|
protected void |
initRow()
Initializes the state of row data, which is internal to the layout
process.
|
protected void |
initVariables(IFigure parent)
Initializes state data for laying out children, based on the Figure given
as input.
|
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.
|
boolean |
isStretchMinorAxis()
Overwritten to guarantee backwards compatibility with
fill
field. |
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 |
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 |
setMinorSpacing(int n)
Sets the spacing to be used between children within a row/column.
|
void |
setStretchMinorAxis(boolean value)
Overwritten to guarantee backwards compatibility with
fill
field. |
getMinorAlignment, isHorizontal, setHorizontal, setMinorAlignment
calculateMinimumSize, getMinimumSize, getPreferredSize, invalidate
calculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, invalidate, isObservingVisibility, remove, setConstraint, setObserveVisibility
public static final int ALIGN_LEFTTOP
OrderedLayout.ALIGN_TOPLEFT
instead.public static final int ALIGN_RIGHTBOTTOM
OrderedLayout.ALIGN_BOTTOMRIGHT
instead.protected FlowLayout.WorkingData data
protected boolean fill
OrderedLayout.setStretchMinorAxis(boolean)
and
OrderedLayout.isStretchMinorAxis()
instead.protected int majorAlignment
getMajorAlignment()
and
setMajorAlignment(int)
instead.protected int majorSpacing
getMajorSpacing()
and
setMajorSpacing(int)
instead.protected int minorSpacing
getMinorSpacing()
and
setMinorSpacing(int)
instead.public FlowLayout()
public FlowLayout(boolean isHorizontal)
isHorizontal
- true
if the layout should be horizontalprotected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
AbstractLayout
calculatePreferredSize
in class AbstractLayout
container
- The figurewHint
- The width hinthHint
- The height hintAbstractLayout.calculatePreferredSize(IFigure,
int, int)
protected Dimension getChildSize(IFigure child, int wHint, int hHint)
child
- the Figure whose preferred size needs to be calculatedwHint
- the width hinthHint
- the height hintprotected int getDefaultOrientation()
PositionConstants.HORIZONTAL
by default.getDefaultOrientation
in class OrderedLayout
PositionConstants.HORIZONTAL
or
PositionConstants.VERTICAL
OrderedLayout.getDefaultOrientation()
public int getMajorAlignment()
Possible values are :
public int getMajorSpacing()
public int getMinorSpacing()
protected void initRow()
protected void initVariables(IFigure parent)
parent
- the parent figureprotected boolean isSensitiveHorizontally(IFigure parent)
AbstractHintLayout
true
.isSensitiveHorizontally
in class AbstractHintLayout
parent
- the layout's containertrue
if this layout is sensite to horizontal hint
changesAbstractHintLayout.isSensitiveHorizontally(IFigure)
protected boolean isSensitiveVertically(IFigure parent)
AbstractHintLayout
true
.isSensitiveVertically
in class AbstractHintLayout
parent
- the layout's containertrue
if this layout is sensite to vertical hint
changesAbstractHintLayout.isSensitiveVertically(IFigure)
public boolean isStretchMinorAxis()
fill
field.isStretchMinorAxis
in class OrderedLayout
OrderedLayout.isStretchMinorAxis()
public void layout(IFigure parent)
LayoutManager
parent
- The figureLayoutManager.layout(IFigure)
protected void layoutRow(IFigure parent)
parent
- the parent figureprotected void setBoundsOfChild(IFigure parent, IFigure child, Rectangle bounds)
parent
- the parent figurechild
- the child figurebounds
- the size of the child to be setpublic void setMajorAlignment(int align)
Possible values are :
align
- the major alignmentpublic void setMajorSpacing(int n)
n
- the major spacingpublic void setMinorSpacing(int n)
n
- the minor spacingpublic void setStretchMinorAxis(boolean value)
fill
field.setStretchMinorAxis
in class OrderedLayout
value
- whether children should be stretched in the minor axis.OrderedLayout.setStretchMinorAxis(boolean)
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.