Package org.eclipse.draw2d
Class FlowLayout
java.lang.Object
org.eclipse.draw2d.AbstractLayout
org.eclipse.draw2d.AbstractHintLayout
org.eclipse.draw2d.OrderedLayout
org.eclipse.draw2d.FlowLayout
- All Implemented Interfaces:
- LayoutManager
Lays out 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.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classHolds the necessary information for layout calculations.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDeprecated.static final intDeprecated.UseOrderedLayout.ALIGN_BOTTOMRIGHTinstead.protected FlowLayout.WorkingDataprotected booleanDeprecated.protected intDeprecated.UsegetMajorAlignment()andsetMajorAlignment(int)instead.protected intDeprecated.UsegetMajorSpacing()andsetMajorSpacing(int)instead.protected intDeprecated.UsegetMinorSpacing()andsetMinorSpacing(int)instead.Fields inherited from class org.eclipse.draw2d.OrderedLayoutALIGN_BOTTOMRIGHT, ALIGN_CENTER, ALIGN_TOPLEFT, horizontal, HORIZONTAL, minorAlignment, transposer, VERTICALFields inherited from class org.eclipse.draw2d.AbstractLayoutisObservingVisibility, preferredSize
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a FlowLayout with horizontal orientation.FlowLayout(boolean isHorizontal) Constructs a FlowLayout whose orientation is given in the input.
- 
Method SummaryModifier and TypeMethodDescriptionprotected DimensioncalculatePreferredSize(IFigure container, int wHint, int hHint) Calculates the preferred size of the given figure, using width and height hints.protected DimensiongetChildSize(IFigure child, int wHint, int hHint) Provides the given child's preferred size.protected intReturnsPositionConstants.HORIZONTALby default.intReturns the alignment used for an entire row/column.intReturns the spacing in pixels to be used between children in the direction parallel to the layout's orientation.intReturns the spacing to be used between children within a row/column.protected voidinitRow()Initializes the state of row data, which is internal to the layout process.protected voidinitVariables(IFigure parent) Initializes state data for laying out children, based on the Figure given as input.protected booleanisSensitiveHorizontally(IFigure parent) Returns whether this layout manager is sensitive to changes in the horizontal hint.protected booleanisSensitiveVertically(IFigure parent) Returns whether this layout manager is sensitive to changes in the vertical hint.booleanOverwritten to guarantee backwards compatibility withfillfield.voidLays out the given figure.protected voidLayouts one row of components.protected voidsetBoundsOfChild(IFigure parent, IFigure child, Rectangle bounds) Sets the given bounds for the child figure input.voidsetMajorAlignment(int align) Sets the alignment for an entire row/column within the parent figure.voidsetMajorSpacing(int n) Sets the spacing in pixels to be used between children in the direction parallel to the layout's orientation.voidsetMinorSpacing(int n) Sets the spacing to be used between children within a row/column.voidsetStretchMinorAxis(boolean value) Overwritten to guarantee backwards compatibility withfillfield.Methods inherited from class org.eclipse.draw2d.OrderedLayoutgetMinorAlignment, isHorizontal, setHorizontal, setMinorAlignmentMethods inherited from class org.eclipse.draw2d.AbstractHintLayoutcalculateMinimumSize, getMinimumSize, getPreferredSize, invalidateMethods inherited from class org.eclipse.draw2d.AbstractLayoutcalculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, invalidate, isObservingVisibility, remove, setConstraint, setObserveVisibility
- 
Field Details- 
ALIGN_LEFTTOPDeprecated.UseOrderedLayout.ALIGN_TOPLEFTinstead.Constant to specify components to be aligned on the left/top- See Also:
 
- 
ALIGN_RIGHTBOTTOMDeprecated.UseOrderedLayout.ALIGN_BOTTOMRIGHTinstead.Constant to specify components to be aligned on the right/bottom- See Also:
 
- 
data
- 
fillDeprecated.The property that determines whether leftover space at the end of a row/column should be filled by the last item in that row/column.
- 
majorAlignmentDeprecated.UsegetMajorAlignment()andsetMajorAlignment(int)instead.The alignment along the major axis.
- 
majorSpacingDeprecated.UsegetMajorSpacing()andsetMajorSpacing(int)instead.The spacing along the major axis.
- 
minorSpacingDeprecated.UsegetMinorSpacing()andsetMinorSpacing(int)instead.The spacing along the minor axis.
 
- 
- 
Constructor Details- 
FlowLayoutpublic FlowLayout()Constructs a FlowLayout with horizontal orientation.- Since:
- 2.0
 
- 
FlowLayoutpublic FlowLayout(boolean isHorizontal) Constructs a FlowLayout whose orientation is given in the input.- Parameters:
- isHorizontal-- trueif the layout should be horizontal
- Since:
- 2.0
 
 
- 
- 
Method Details- 
calculatePreferredSizeDescription copied from class:AbstractLayoutCalculates the preferred size of the given figure, using width and height hints.- Specified by:
- calculatePreferredSizein class- AbstractLayout
- Parameters:
- container- The figure
- wHint- The width hint
- hHint- The height hint
- Returns:
- The preferred size
- See Also:
 
- 
getChildSizeProvides the given child's preferred size.- Parameters:
- child- the Figure whose preferred size needs to be calculated
- wHint- the width hint
- hHint- the height hint
- Returns:
- the child's preferred size
 
- 
getDefaultOrientationprotected int getDefaultOrientation()ReturnsPositionConstants.HORIZONTALby default.- Specified by:
- getDefaultOrientationin class- OrderedLayout
- Returns:
- one of PositionConstants.HORIZONTALorPositionConstants.VERTICAL
- See Also:
 
- 
getMajorAlignmentpublic int getMajorAlignment()Returns the alignment used for an entire row/column.Possible values are : - Returns:
- the major alignment
- Since:
- 2.0
 
- 
getMajorSpacingpublic int getMajorSpacing()Returns the spacing in pixels to be used between children in the direction parallel to the layout's orientation.- Returns:
- the major spacing
 
- 
getMinorSpacingpublic int getMinorSpacing()Returns the spacing to be used between children within a row/column.- Returns:
- the minor spacing
 
- 
initRowprotected void initRow()Initializes the state of row data, which is internal to the layout process.
- 
initVariablesInitializes state data for laying out children, based on the Figure given as input.- Parameters:
- parent- the parent figure
- Since:
- 2.0
 
- 
isSensitiveHorizontallyDescription copied from class:AbstractHintLayoutReturns whether this layout manager is sensitive to changes in the horizontal hint. By default, this method returnstrue.- Overrides:
- isSensitiveHorizontallyin class- AbstractHintLayout
- Parameters:
- parent- the layout's container
- Returns:
- trueif this layout is sensite to horizontal hint changes
- See Also:
 
- 
isSensitiveVerticallyDescription copied from class:AbstractHintLayoutReturns whether this layout manager is sensitive to changes in the vertical hint. By default, this method returnstrue.- Overrides:
- isSensitiveVerticallyin class- AbstractHintLayout
- Parameters:
- parent- the layout's container
- Returns:
- trueif this layout is sensite to vertical hint changes
- See Also:
 
- 
isStretchMinorAxispublic boolean isStretchMinorAxis()Overwritten to guarantee backwards compatibility withfillfield.- Specified by:
- isStretchMinorAxisin class- OrderedLayout
- Returns:
- whether children are to be stretched in the minor axis.
- See Also:
 
- 
layoutDescription copied from interface:LayoutManagerLays out the given figure.- Parameters:
- parent- The figure
- See Also:
 
- 
layoutRowLayouts one row of components. This is done based on the layout's orientation, minor alignment and major alignment.- Parameters:
- parent- the parent figure
- Since:
- 2.0
 
- 
setBoundsOfChildSets the given bounds for the child figure input.- Parameters:
- parent- the parent figure
- child- the child figure
- bounds- the size of the child to be set
- Since:
- 2.0
 
- 
setMajorAlignmentpublic void setMajorAlignment(int align) Sets the alignment for an entire row/column within the parent figure.Possible values are : - Parameters:
- align- the major alignment
- Since:
- 2.0
 
- 
setMajorSpacingpublic 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- the major spacing
- Since:
- 2.0
 
- 
setMinorSpacingpublic void setMinorSpacing(int n) Sets the spacing to be used between children within a row/column.- Parameters:
- n- the minor spacing
- Since:
- 2.0
 
- 
setStretchMinorAxispublic void setStretchMinorAxis(boolean value) Overwritten to guarantee backwards compatibility withfillfield.- Specified by:
- setStretchMinorAxisin class- OrderedLayout
- Parameters:
- value- whether children should be stretched in the minor axis.
- See Also:
 
 
- 
OrderedLayout.ALIGN_TOPLEFTinstead.