Package org.eclipse.draw2d
Class ToolbarLayout
java.lang.Object
org.eclipse.draw2d.AbstractLayout
org.eclipse.draw2d.AbstractHintLayout
org.eclipse.draw2d.OrderedLayout
org.eclipse.draw2d.ToolbarLayout
- All Implemented Interfaces:
- LayoutManager
Arranges figures in a single row or column. Orientation can be set to produce
 either a row or column layout. This layout tries to fit all children within
 the parent's client area. To do this, it compresses the children by some
 amount, but will not compress them smaller than their minimum size. If a
 child's preferred size is smaller than the row's or column's minor dimension,
 the layout can be configured to stretch the child.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final booleanDeprecated.Unused.protected booleanDeprecated.protected intDeprecated.UsegetSpacing()andsetSpacing(int)instead.static final booleanDeprecated.Unused.Fields inherited from class org.eclipse.draw2d.OrderedLayoutALIGN_BOTTOMRIGHT, ALIGN_CENTER, ALIGN_TOPLEFT, horizontal, minorAlignment, transposerFields inherited from class org.eclipse.draw2d.AbstractLayoutisObservingVisibility, preferredSize
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a vertically oriented ToolbarLayout with child spacing of 0 pixels,setStretchMinorAxis(boolean)true, andOrderedLayout.ALIGN_TOPLEFTminor alignment.ToolbarLayout(boolean isHorizontal) Constructs a ToolbarLayout with a specified orientation.
- 
Method SummaryModifier and TypeMethodDescriptionprotected DimensioncalculateMinimumSize(IFigure container, int wHint, int hHint) Calculates the minimum size of the container based on the given hints.protected DimensioncalculatePreferredSize(IFigure container, int wHint, int hHint) Calculates the preferred size of the container based on the given hints.protected DimensiongetChildMinimumSize(IFigure child, int wHint, int hHint) protected DimensiongetChildPreferredSize(IFigure child, int wHint, int hHint) protected intReturnsPositionConstants.VERTICALby default.intbooleanDeprecated.UseisStretchMinorAxis()instead.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 withmatchWidthfield.voidLays out the given figure.voidsetMatchWidth(boolean match) Deprecated.voidsetSpacing(int space) Sets the amount of space between children.voidsetStretchMinorAxis(boolean value) Overwritten to guarantee backwards compatibility withmatchWidthfield.voidsetVertical(boolean flag) Deprecated.UseOrderedLayout.setHorizontal(boolean)with argumentfalseinstead.Methods inherited from class org.eclipse.draw2d.OrderedLayoutgetMinorAlignment, isHorizontal, setHorizontal, setMinorAlignmentMethods inherited from class org.eclipse.draw2d.AbstractHintLayoutgetMinimumSize, getPreferredSize, invalidateMethods inherited from class org.eclipse.draw2d.AbstractLayoutcalculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, invalidate, isObservingVisibility, remove, setConstraint, setObserveVisibility
- 
Field Details- 
HORIZONTALDeprecated.Unused.Constant for horizontal alignment- See Also:
 
- 
VERTICALDeprecated.Unused.Constant for vertical alignment- See Also:
 
- 
matchWidthDeprecated.Sets whether children should "stretch" with their container
- 
spacingDeprecated.UsegetSpacing()andsetSpacing(int)instead.Space in pixels between Figures
 
- 
- 
Constructor Details- 
ToolbarLayoutpublic ToolbarLayout()Constructs a vertically oriented ToolbarLayout with child spacing of 0 pixels,setStretchMinorAxis(boolean)true, andOrderedLayout.ALIGN_TOPLEFTminor alignment.- Since:
- 2.0
 
- 
ToolbarLayoutpublic ToolbarLayout(boolean isHorizontal) Constructs a ToolbarLayout with a specified orientation. Default values are: child spacing 0 pixels,setStretchMinorAxis(boolean)false, andOrderedLayout.ALIGN_TOPLEFTalignment.- Parameters:
- isHorizontal- whether the children are oriented horizontally
- Since:
- 2.0
 
 
- 
- 
Method Details- 
calculateMinimumSizeCalculates the minimum size of the container based on the given hints. If this is a vertically-oriented Toolbar Layout, then only the widthHint is respected (which means that the children can be as tall as they desire). In this case, the minimum width is that of the widest child, and the minimum height is the sum of the minimum heights of all children, plus the spacing between them. The border and insets of the container figure are also accounted for.- Overrides:
- calculateMinimumSizein class- AbstractHintLayout
- Parameters:
- container- the figure whose minimum size has to be calculated
- wHint- the width hint (the desired width of the container)
- hHint- the height hint (the desired height of the container)
- Returns:
- the minimum size of the container
- Since:
- 2.1
- See Also:
 
- 
calculatePreferredSizeCalculates the preferred size of the container based on the given hints. If this is a vertically-oriented Toolbar Layout, then only the widthHint is respected (which means that the children can be as tall as they desire). In this case, the preferred width is that of the widest child, and the preferred height is the sum of the preferred heights of all children, plus the spacing between them. The border and insets of the container figure are also accounted for.- Specified by:
- calculatePreferredSizein class- AbstractLayout
- Parameters:
- container- the figure whose preferred size has to be calculated
- wHint- the width hint (the desired width of the container)
- hHint- the height hint (the desired height of the container)
- Returns:
- the preferred size of the container
- Since:
- 2.0
- See Also:
 
- 
getChildMinimumSize- Parameters:
- child- the figure whose minimum size is to be determined
- wHint- the width hint
- hHint- the height hint
- Returns:
- the given figure's minimum size
- Since:
- 3.3
 
- 
getChildPreferredSize- Parameters:
- child- the figure whose preferred size is to be determined
- wHint- the width hint
- hHint- the height hint
- Returns:
- given figure's preferred size
- Since:
- 3.3
 
- 
getDefaultOrientationprotected int getDefaultOrientation()ReturnsPositionConstants.VERTICALby default.- Specified by:
- getDefaultOrientationin class- OrderedLayout
- Returns:
- one of PositionConstants.HORIZONTALorPositionConstants.VERTICAL
- See Also:
 
- 
getSpacingpublic int getSpacing()- Returns:
- the spacing between children
 
- 
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:
 
- 
getStretchMinorAxisDeprecated.UseisStretchMinorAxis()instead.Returnstrueif stretch minor axis has been enabled. The default value is false.- Returns:
- trueif stretch minor axis is enabled
 
- 
isStretchMinorAxispublic boolean isStretchMinorAxis()Overwritten to guarantee backwards compatibility withmatchWidthfield.- 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:
 
- 
setMatchWidthDeprecated.Sets children's width (if vertically oriented) or height (if horizontally oriented) to stretch with their container.- Parameters:
- match- whether to stretch children
- Since:
- 2.0
 
- 
setSpacingpublic void setSpacing(int space) Sets the amount of space between children.- Parameters:
- space- the amount of space between children
- Since:
- 2.0
 
- 
setStretchMinorAxispublic void setStretchMinorAxis(boolean value) Overwritten to guarantee backwards compatibility withmatchWidthfield.- Specified by:
- setStretchMinorAxisin class- OrderedLayout
- Parameters:
- value- whether children should be stretched in the minor axis.
- See Also:
 
- 
setVerticalDeprecated.UseOrderedLayout.setHorizontal(boolean)with argumentfalseinstead.Sets the orientation of the layout- Parameters:
- flag- whether the orientation should be vertical
- Since:
- 2.0
 
 
-