Package org.eclipse.jface.layout
Class RowLayoutFactory
java.lang.Object
org.eclipse.jface.layout.RowLayoutFactory
RowLayoutFactory creates and initializes row layouts. There are two ways to
use RowLayoutFactory. Normally, it is used as a shorthand for writing
"new RowLayout()" and initializing a bunch of fields. In this case the main
benefit is a more concise syntax and the ability to create more than one
identical RowLayout from the same factory. Changing a property of the factory
will affect future layouts created by the factory, but has no effect on
layouts that have already been created.
- Since:
- 3.5
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates a new RowLayout and attaches it to the given composite.center
(boolean center) Center specifies whether the controls in a row should be centered vertically in each cell for horizontal layouts, or centered horizontally in each cell for vertical layouts.copy()
Creates a copy of the receiver.static RowLayout
copyLayout
(RowLayout layout) Copies the given RowLayout instancecreate()
Creates a new RowLayout, and initializes it with values from the factory.static RowLayoutFactory
createFrom
(RowLayout layout) Creates a factory that creates copies of the given layout.extendedMargins
(int left, int right, int top, int bottom) Sets the margins for layouts created with this factory.fill
(boolean fill) Fill specifies whether the controls in a row should be all the same height for horizontal layouts, or the same width for vertical layouts.static RowLayoutFactory
Creates a RowLayoutFactory that creates RowLayouts with no margins, fill behavior, and default dialog spacing.justify
(boolean justify) Justify specifies whether the controls in a row should be fully justified, with any extra space placed between the controls.margins
(int width, int height) Sets the margins for layouts created with this factory.Sets the margins for layouts created with this factory.pack
(boolean pack) Pack specifies whether all controls in the layout take their preferred size.spacing
(int spacing) Sets the spacing for layouts created with this factory.static RowLayoutFactory
Creates a RowLayoutFactory that creates RowLayouts with the default SWT values.type
(int type) type specifies whether the layout places controls in rows or columns.wrap
(boolean wrap) Wrap specifies whether a control will be wrapped to the next row if there is insufficient space on the current row.
-
Method Details
-
createFrom
Creates a factory that creates copies of the given layout.- Parameters:
layout
- layout to copy- Returns:
- a new RowLayoutFactory instance that creates copies of the given layout
-
copy
Creates a copy of the receiver.- Returns:
- a copy of the receiver
-
swtDefaults
Creates a RowLayoutFactory that creates RowLayouts with the default SWT values.Initial values are:
- margins(0,0)
- extendedMargins(3,3,3,3)
- wrap(true)
- pack(true)
- fill(false)
- justify(false)
- spacing(3)
- Returns:
- a RowLayoutFactory that creates RowLayouts as though created with their default constructor
- See Also:
-
fillDefaults
Creates a RowLayoutFactory that creates RowLayouts with no margins, fill behavior, and default dialog spacing.Initial values are:
- margins(0,0)
- extendedMargins(0,0,0,0)
- wrap(true)
- pack(true)
- fill(false)
- justify(false)
- spacing(LayoutConstants.getSpacing().x
- Returns:
- a RowLayoutFactory that creates RowLayouts with no margins
- See Also:
-
spacing
Sets the spacing for layouts created with this factory. The spacing is the distance between items within the layout.- Parameters:
spacing
- spacing (pixels)- Returns:
- this
- See Also:
-
margins
Sets the margins for layouts created with this factory. The margins are the distance between the outer cells and the edge of the layout.- Parameters:
margins
- margin size (pixels)- Returns:
- this
- See Also:
-
margins
Sets the margins for layouts created with this factory. The margins specify the number of pixels of horizontal and vertical margin that will be placed along the left/right and top/bottom edges of the layout. Note that these margins will be added to the ones specified byextendedMargins(int, int, int, int)
.- Parameters:
width
- margin width (pixels)height
- margin height (pixels)- Returns:
- this
- See Also:
-
extendedMargins
Sets the margins for layouts created with this factory. The margins specify the number of pixels of horizontal and vertical margin that will be placed along the left, right, top, and bottom edges of the layout. Note that these margins will be added to the ones specified bymargins(int, int)
.- Parameters:
left
- left margin size (pixels)right
- right margin size (pixels)top
- top margin size (pixels)bottom
- bottom margin size (pixels)- Returns:
- this
- Since:
- 3.3
- See Also:
-
fill
Fill specifies whether the controls in a row should be all the same height for horizontal layouts, or the same width for vertical layouts.- Parameters:
fill
- the fill status- Returns:
- this
-
center
Center specifies whether the controls in a row should be centered vertically in each cell for horizontal layouts, or centered horizontally in each cell for vertical layouts.- Parameters:
center
- the center status- Returns:
- this
- Since:
- 3.20
-
justify
Justify specifies whether the controls in a row should be fully justified, with any extra space placed between the controls.- Parameters:
justify
- the justify status- Returns:
- this
-
pack
Pack specifies whether all controls in the layout take their preferred size. If pack is false, all controls will have the same size which is the size required to accommodate the largest preferred height and the largest preferred width of all the controls in the layout.- Parameters:
pack
- the pack status- Returns:
- this
-
wrap
Wrap specifies whether a control will be wrapped to the next row if there is insufficient space on the current row.- Parameters:
wrap
- the wrap status- Returns:
- this
-
type
type specifies whether the layout places controls in rows or columns. Possible values are:- HORIZONTAL: Position the controls horizontally from left to right
- VERTICAL: Position the controls vertically from top to bottom
- Parameters:
type
- One of SWT.HORIZONTAL or SWT.VERTICAL- Returns:
- this
- Throws:
IllegalArgumentException
- if type is not one of HORIZONTAL or VERTICAL
-
create
Creates a new RowLayout, and initializes it with values from the factory.- Returns:
- a new initialized RowLayout.
- See Also:
-
applyTo
Creates a new RowLayout and attaches it to the given composite. Does not create the rowData of any of the controls in the composite.- Parameters:
c
- composite whose layout will be set- See Also:
-
copyLayout
Copies the given RowLayout instance- Parameters:
layout
- layout to copy- Returns:
- a new RowLayout
-