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`

public class ToolbarLayout extends OrderedLayout
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 Summary

Fields
Modifier and Type
Field
Description
`static final boolean`
`HORIZONTAL`
Deprecated.
Unused.
`protected boolean`
`matchWidth`
Deprecated.
Use `OrderedLayout.setStretchMinorAxis(boolean)` and `OrderedLayout.isStretchMinorAxis()` instead.
`protected int`
`spacing`
Deprecated.
Use `getSpacing()` and `setSpacing(int)` instead.
`static final boolean`
`VERTICAL`
Deprecated.
Unused.

### Fields inherited from class org.eclipse.draw2d.OrderedLayout

`ALIGN_BOTTOMRIGHT, ALIGN_CENTER, ALIGN_TOPLEFT, horizontal, minorAlignment, transposer`

### Fields inherited from class org.eclipse.draw2d.AbstractLayout

`isObservingVisibility, preferredSize`

## Constructor Summary

Constructors
Constructor
Description
`ToolbarLayout()`
Constructs a vertically oriented ToolbarLayout with child spacing of 0 pixels, `setStretchMinorAxis(boolean)` `true`, and `OrderedLayout.ALIGN_TOPLEFT` minor alignment.
`ToolbarLayout(boolean isHorizontal)`
Constructs a ToolbarLayout with a specified orientation.

## Method Summary

Modifier and Type
Method
Description
`protected Dimension`
`calculateMinimumSize(IFigure container, int wHint, int hHint)`
Calculates the minimum size of the container based on the given hints.
`protected Dimension`
`calculatePreferredSize(IFigure container, int wHint, int hHint)`
Calculates the preferred size of the container based on the given hints.
`protected Dimension`
`getChildMinimumSize(IFigure child, int wHint, int hHint)`
`protected Dimension`
`getChildPreferredSize(IFigure child, int wHint, int hHint)`
`protected int`
`getDefaultOrientation()`
Returns `PositionConstants.VERTICAL` by default.
`int`
`getSpacing()`
`boolean`
`getStretchMinorAxis()`
Deprecated.
Use `isStretchMinorAxis()` instead.
`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 `matchWidth` field.
`void`
`layout(IFigure parent)`
Lays out the given figure.
`void`
`setMatchWidth(boolean match)`
Deprecated.
use `setStretchMinorAxis(boolean)`
`void`
`setSpacing(int space)`
Sets the amount of space between children.
`void`
`setStretchMinorAxis(boolean value)`
Overwritten to guarantee backwards compatibility with `matchWidth` field.
`void`
`setVertical(boolean flag)`
Deprecated.
Use `OrderedLayout.setHorizontal(boolean)` with argument `false` instead.

### Methods inherited from class org.eclipse.draw2d.OrderedLayout

`getMinorAlignment, isHorizontal, setHorizontal, setMinorAlignment`

### Methods inherited from class org.eclipse.draw2d.AbstractHintLayout

`getMinimumSize, getPreferredSize, invalidate`

### Methods inherited from class org.eclipse.draw2d.AbstractLayout

`calculatePreferredSize, getBorderPreferredSize, getConstraint, getMinimumSize, getPreferredSize, invalidate, isObservingVisibility, remove, setConstraint, setObserveVisibility`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### HORIZONTAL

@Deprecated public static final boolean HORIZONTAL
Deprecated.
Unused.
Constant for horizontal alignment

See Also:
  - Constant Field Values

### VERTICAL

@Deprecated public static final boolean VERTICAL
Deprecated.
Unused.
Constant for vertical alignment

See Also:
  - Constant Field Values

### matchWidth

@Deprecated protected boolean matchWidth
Deprecated.
Use `OrderedLayout.setStretchMinorAxis(boolean)` and `OrderedLayout.isStretchMinorAxis()` instead.
Sets whether children should "stretch" with their container

### spacing

@Deprecated protected int spacing
Deprecated.
Use `getSpacing()` and `setSpacing(int)` instead.
Space in pixels between Figures

## Constructor Details

### ToolbarLayout

public ToolbarLayout()
Constructs a vertically oriented ToolbarLayout with child spacing of 0 pixels, `setStretchMinorAxis(boolean)` `true`, and `OrderedLayout.ALIGN_TOPLEFT` minor alignment.

Since:
  2.0

### ToolbarLayout

public ToolbarLayout(boolean isHorizontal)
Constructs a ToolbarLayout with a specified orientation. Default values are: child spacing 0 pixels, `setStretchMinorAxis(boolean)` `false`, and `OrderedLayout.ALIGN_TOPLEFT` alignment.

Parameters:
  `isHorizontal` - whether the children are oriented horizontally
Since:
  2.0

## Method Details

### calculateMinimumSize

protected Dimension calculateMinimumSize(IFigure container, int wHint, int hHint)
Calculates 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:
  `calculateMinimumSize` in 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:
  - `AbstractHintLayout.getMinimumSize(IFigure, int, int)`

### calculatePreferredSize

protected Dimension calculatePreferredSize(IFigure container, int wHint, int hHint)
Calculates 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:
  `calculatePreferredSize` in 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:
  - `AbstractHintLayout.getPreferredSize(IFigure, int, int)`

### getChildMinimumSize

protected Dimension getChildMinimumSize(IFigure child, int wHint, int hHint)

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

protected Dimension getChildPreferredSize(IFigure child, int wHint, int hHint)

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

### getDefaultOrientation

protected int getDefaultOrientation()
Returns `PositionConstants.VERTICAL` by default.

Specified by:
  `getDefaultOrientation` in class `OrderedLayout`
Returns:
  one of `PositionConstants.HORIZONTAL` or `PositionConstants.VERTICAL`
See Also:
  - `OrderedLayout.getDefaultOrientation()`

### getSpacing

public int getSpacing()

Returns:
  the spacing between children

### 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
See Also:
  - `AbstractHintLayout.isSensitiveHorizontally(IFigure)`

### 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:
  - `AbstractHintLayout.isSensitiveVertically(IFigure)`

### getStretchMinorAxis

@Deprecated public boolean getStretchMinorAxis()
Deprecated.
Use `isStretchMinorAxis()` instead.
Returns `true` if stretch minor axis has been enabled. The default value is false.

Returns:
  `true` if stretch minor axis is enabled

### isStretchMinorAxis

public boolean isStretchMinorAxis()
Overwritten to guarantee backwards compatibility with `matchWidth` field.

Specified by:
  `isStretchMinorAxis` in class `OrderedLayout`
Returns:
  whether children are to be stretched in the minor axis.
See Also:
  - `OrderedLayout.isStretchMinorAxis()`

### 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)`

### setMatchWidth

@Deprecated public void setMatchWidth(boolean match)
Deprecated.
use `setStretchMinorAxis(boolean)`
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

### setSpacing

public void setSpacing(int space)
Sets the amount of space between children.

Parameters:
  `space` - the amount of space between children
Since:
  2.0

### setStretchMinorAxis

public void setStretchMinorAxis(boolean value)
Overwritten to guarantee backwards compatibility with `matchWidth` field.

Specified by:
  `setStretchMinorAxis` in class `OrderedLayout`
Parameters:
  `value` - whether children should be stretched in the minor axis.
See Also:
  - `OrderedLayout.setStretchMinorAxis(boolean)`

### setVertical

@Deprecated public void setVertical(boolean flag)
Deprecated.
Use `OrderedLayout.setHorizontal(boolean)` with argument `false` instead.
Sets the orientation of the layout

Parameters:
  `flag` - whether the orientation should be vertical
Since:
  2.0