Package com.diffplug.common.swt
Class Layouts
java.lang.Object
com.diffplug.common.swt.Layouts
Provides fluent utilities for manipulating SWT layouts. Serves as the entry point to
LayoutsFillLayout,
LayoutsGridLayout, LayoutsGridData, LayoutsRowLayout, and LayoutsRowData.
SWT's layouts don't have consistent defaults for margin and spacing. All layouts created
by this class (via setFill(Composite), setGrid(Composite), and
setRow(Composite) have all of their margins and spacing values set to
defaultMargin().
`FillLayout` only supports `marginHeight` and `marginWidth`, but `GridLayout` and
`RowLayout` also support `marginTop/Bottom/Left/Right`. These are additive - the margin on the
top side will be `marginHeight + marginTop`. When setting all margins at once using
LayoutWrapper.margin(int), height/width are set to the given value, and top/bottom/left/right are all
set to 0.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intReturns the default margin for layouts.static LayoutsFillLayoutmodifyFill(Composite composite) Returns an API for modifying the already-existing FillLayout on the given Composite.static LayoutsGridLayoutmodifyGrid(Composite composite) Returns an API for modifying the already-existing GridLayout on the given Composite.static LayoutsGridDatamodifyGridData(com.diffplug.common.swt.ControlWrapper wrapper) Returns an API for modifying the already-existing GridData which has been set on the given ControlWrapper.static LayoutsGridDatamodifyGridData(Control control) Returns an API for modifying the already-existing GridData which has been set on the given Control.static LayoutsRowLayoutReturns an API for modifying the already-existing RowLayout on the given Composite.static LayoutsRowDatamodifyRowData(com.diffplug.common.swt.ControlWrapper wrapper) Returns an API for modifying the already-existing RowData which has been set on the given ControlWrapper.static LayoutsRowDatamodifyRowData(Control control) Returns an API for modifying the already-existing RowData which has been set on the given Control.static LayoutsGridDatanewGridPlaceholder(Composite parent) Creates an invisible `org.eclipse.swt.widgets.Label`, and returns an API for setting its GridData.static CompositenewGridRow(Composite parent, com.diffplug.common.swt.Coat coat) Quick shortcut to add a row to to this parent.static LayoutsRowDatanewRowPlaceholder(Composite parent) Creates an invisible `org.eclipse.swt.widgets.Label`, and returns an API for setting its RowData.static LayoutsFillLayoutSets the composite to have a standard FillLayout, and returns an API for modifying it.static LayoutsGridLayoutSets the composite to have a standard GridLayout, and returns an API for modifying it.static LayoutsGridDatasetGridData(com.diffplug.common.swt.ControlWrapper wrapper) Sets the layoutData on the ControlWrapper to a new GridData, and returns an API for modifying it.static LayoutsGridDatasetGridData(Control control) Sets the layouData on the Control to a new GridData, and returns an API for modifying it.static LayoutsRowLayoutSets the composite to have a standard RowLayout, and returns an API for modifying it.static LayoutsRowDatasetRowData(com.diffplug.common.swt.ControlWrapper wrapper) Sets the layoutData on the ControlWrapper to a new RowData, and returns an API for modifying it.static LayoutsRowDatasetRowData(Control control) Sets the layouData on the Control to a new GridData, and returns an API for modifying it.static voidstatic voidsetSingleNoMargin(Composite composite) static LayoutsFillLayoutwrap(FillLayout fillLayout) Returns an API for modifying the given FillLayout.static LayoutsGridDataReturns an API for modifying the given GridData.static LayoutsGridLayoutwrap(GridLayout gridLayout) Returns an API for modifying the given GridLayout.static LayoutsRowDataReturns an API for modifying the given RowData.static LayoutsRowLayoutReturns an API for modifying the given RowLayout.
-
Method Details
-
defaultMargin
public static int defaultMargin()Returns the default margin for layouts. -
setFill
Sets the composite to have a standard FillLayout, and returns an API for modifying it. -
modifyFill
Returns an API for modifying the already-existing FillLayout on the given Composite. -
wrap
Returns an API for modifying the given FillLayout. -
setGrid
Sets the composite to have a standard GridLayout, and returns an API for modifying it. -
modifyGrid
Returns an API for modifying the already-existing GridLayout on the given Composite. -
wrap
Returns an API for modifying the given GridLayout. -
setGridData
Sets the layouData on the Control to a new GridData, and returns an API for modifying it. -
setGridData
Sets the layoutData on the ControlWrapper to a new GridData, and returns an API for modifying it. -
modifyGridData
Returns an API for modifying the already-existing GridData which has been set on the given Control. -
modifyGridData
Returns an API for modifying the already-existing GridData which has been set on the given ControlWrapper. -
wrap
Returns an API for modifying the given GridData. -
newGridPlaceholder
Creates an invisible `org.eclipse.swt.widgets.Label`, and returns an API for setting its GridData. Useful for filling spots in a GridLayout. -
newGridRow
Quick shortcut to add a row to to this parent. - parent must have a GridLayout - creates a new Composite that will take the full width of the parent, with no margins - populates the new Composite using the Coat - sets the layout on the new Composite to be a GridLayout with no margins and as many columns as there are child controls - returns the new Composite -
setRow
Sets the composite to have a standard RowLayout, and returns an API for modifying it. -
modifyRow
Returns an API for modifying the already-existing RowLayout on the given Composite. -
wrap
Returns an API for modifying the given RowLayout. -
setRowData
Sets the layouData on the Control to a new GridData, and returns an API for modifying it. -
setRowData
Sets the layoutData on the ControlWrapper to a new RowData, and returns an API for modifying it. -
modifyRowData
Returns an API for modifying the already-existing RowData which has been set on the given Control. -
modifyRowData
Returns an API for modifying the already-existing RowData which has been set on the given ControlWrapper. -
wrap
Returns an API for modifying the given RowData. -
newRowPlaceholder
Creates an invisible `org.eclipse.swt.widgets.Label`, and returns an API for setting its RowData. Useful for filling spots in a RowLayout. -
setSingle
-
setSingleNoMargin
-