Package com._1c.g5.lwt.layouts
Class LightRowLayout
java.lang.Object
com._1c.g5.lwt.layouts.LightRowLayout
- All Implemented Interfaces:
ILightLayout
Instances of this class determine the size and position of the
children of a
Composite by placing them either in
horizontal rows or vertical columns within the parent Composite.
RowLayout aligns all controls in one row if the
type is set to horizontal, and one column if it is
set to vertical. It has the ability to wrap, and provides configurable
margins and spacing. RowLayout has a number of configuration
fields. In addition, the height and width of each control in a
RowLayout can be specified by setting a RowData
object into the control using setLayoutData ().
The following example code creates a RowLayout, sets all
of its fields to non-default values, and then sets it into a
Shell.
RowLayout rowLayout = new RowLayout();
rowLayout.wrap = false;
rowLayout.pack = false;
rowLayout.justify = true;
rowLayout.type = SWT.VERTICAL;
rowLayout.marginLeft = 5;
rowLayout.marginTop = 5;
rowLayout.marginRight = 5;
rowLayout.marginBottom = 5;
rowLayout.spacing = 0;
shell.setLayout(rowLayout);
If you are using the default field values, you only need one line of code:
shell.setLayout(new RowLayout());
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleancenter 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.booleanfill specifies whether the controls in a row should be all the same height for horizontal layouts, or the same width for vertical layouts.booleanjustify specifies whether the controls in a row should be fully justified, with any extra space placed between the controls.intmarginBottom specifies the number of pixels of vertical margin that will be placed along the bottom edge of the layout.intmarginHeight specifies the number of pixels of vertical margin that will be placed along the top and bottom edges of the layout.intmarginLeft specifies the number of pixels of horizontal margin that will be placed along the left edge of the layout.intmarginRight specifies the number of pixels of horizontal margin that will be placed along the right edge of the layout.intmarginTop specifies the number of pixels of vertical margin that will be placed along the top edge of the layout.intmarginWidth specifies the number of pixels of horizontal margin that will be placed along the left and right edges of the layout.booleanpack specifies whether all controls in the layout take their preferred size.intspacing specifies the number of pixels between the edge of one cell and the edge of its neighbouring cell.inttype specifies whether the layout places controls in rows or columns.booleanwrap specifies whether a control will be wrapped to the next row if there is insufficient space on the current row. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance of this class with type HORIZONTAL.LightRowLayout(int type) Constructs a new instance of this class given the type. -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.swt.graphics.PointcomputeSize(ILightComposite composite, org.eclipse.swt.graphics.GC gc, int wHint, int hHint, boolean flushCache) Computes the size of the given composite.booleanflushCache(ILightControl control) Flushes the layout cache for the given control.voidlayout(ILightComposite composite, org.eclipse.swt.graphics.GC gc, boolean flushCache) Layouts the given composite.toString()Returns a string containing a concise, human-readable description of the receiver.
-
Field Details
-
type
public int typetype specifies whether the layout places controls in rows or columns. The default value is HORIZONTAL. Possible values are:- HORIZONTAL: Position the controls horizontally from left to right
- VERTICAL: Position the controls vertically from top to bottom
- Since:
- 2.0
-
marginWidth
public int marginWidthmarginWidth specifies the number of pixels of horizontal margin that will be placed along the left and right edges of the layout. The default value is 3.- Since:
- 3.0
-
marginHeight
public int marginHeightmarginHeight specifies the number of pixels of vertical margin that will be placed along the top and bottom edges of the layout. The default value is 3.- Since:
- 3.0
-
spacing
public int spacingspacing specifies the number of pixels between the edge of one cell and the edge of its neighbouring cell. The default value is 3. -
wrap
public boolean wrapwrap specifies whether a control will be wrapped to the next row if there is insufficient space on the current row. The default value is true. -
pack
public boolean packpack 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. The default value is true. -
fill
public boolean fillfill specifies whether the controls in a row should be all the same height for horizontal layouts, or the same width for vertical layouts. The default value is false.- Since:
- 3.0
-
center
public boolean centercenter 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. The default value is false.- Since:
- 3.4
-
justify
public boolean justifyjustify specifies whether the controls in a row should be fully justified, with any extra space placed between the controls. The default value is false. -
marginLeft
public int marginLeftmarginLeft specifies the number of pixels of horizontal margin that will be placed along the left edge of the layout. The default value is 0. -
marginTop
public int marginTopmarginTop specifies the number of pixels of vertical margin that will be placed along the top edge of the layout. The default value is 0. -
marginRight
public int marginRightmarginRight specifies the number of pixels of horizontal margin that will be placed along the right edge of the layout. The default value is 0. -
marginBottom
public int marginBottommarginBottom specifies the number of pixels of vertical margin that will be placed along the bottom edge of the layout. The default value is 0.
-
-
Constructor Details
-
LightRowLayout
public LightRowLayout()Constructs a new instance of this class with type HORIZONTAL. -
LightRowLayout
public LightRowLayout(int type) Constructs a new instance of this class given the type.- Parameters:
type- the type of row layout- Since:
- 2.0
-
-
Method Details
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(ILightComposite composite, org.eclipse.swt.graphics.GC gc, int wHint, int hHint, boolean flushCache) Description copied from interface:ILightLayoutComputes the size of the given composite.- Specified by:
computeSizein interfaceILightLayout- Parameters:
composite- the composite to compute the size of.gc- theGCto do the measurements with.wHint- the width hint.hHint- the height hint.flushCache- the flush cache flag, instructs the layout to reset all its caches, if any.- Returns:
-
flushCache
Description copied from interface:ILightLayoutFlushes the layout cache for the given control.- Specified by:
flushCachein interfaceILightLayout- Parameters:
control- the control to flush the cache for.- Returns:
trueif the layout has flushed the cache,falseotherwise.
-
layout
Description copied from interface:ILightLayoutLayouts the given composite.- Specified by:
layoutin interfaceILightLayout- Parameters:
composite- the composite to layout.gc- theGCto do the measurements with.flushCache- the flush cache flag, instructs the layout to reset all its caches, if any.
-
toString
Returns a string containing a concise, human-readable description of the receiver.
-