Package com._1c.g5.lwt.layouts
Class LightRowLayout
- java.lang.Object
-
- com._1c.g5.lwt.layouts.LightRowLayout
-
- All Implemented Interfaces:
ILightLayout
public final class LightRowLayout extends Object implements ILightLayout
Instances of this class determine the size and position of the children of aCompositeby placing them either in horizontal rows or vertical columns within the parentComposite.RowLayoutaligns all controls in one row if thetypeis set to horizontal, and one column if it is set to vertical. It has the ability to wrap, and provides configurable margins and spacing.RowLayouthas a number of configuration fields. In addition, the height and width of each control in aRowLayoutcan be specified by setting aRowDataobject into the control usingsetLayoutData ().The following example code creates a
RowLayout, sets all of its fields to non-default values, and then sets it into aShell.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:
RowData, RowLayout snippets, SWT Example: LayoutExample, Sample code and further information
-
-
Field Summary
Fields Modifier and Type Field Description booleancentercenter 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.booleanfillfill specifies whether the controls in a row should be all the same height for horizontal layouts, or the same width for vertical layouts.booleanjustifyjustify specifies whether the controls in a row should be fully justified, with any extra space placed between the controls.intmarginBottommarginBottom specifies the number of pixels of vertical margin that will be placed along the bottom edge of the layout.intmarginHeightmarginHeight specifies the number of pixels of vertical margin that will be placed along the top and bottom edges of the layout.intmarginLeftmarginLeft specifies the number of pixels of horizontal margin that will be placed along the left edge of the layout.intmarginRightmarginRight specifies the number of pixels of horizontal margin that will be placed along the right edge of the layout.intmarginTopmarginTop specifies the number of pixels of vertical margin that will be placed along the top edge of the layout.intmarginWidthmarginWidth specifies the number of pixels of horizontal margin that will be placed along the left and right edges of the layout.booleanpackpack specifies whether all controls in the layout take their preferred size.intspacingspacing specifies the number of pixels between the edge of one cell and the edge of its neighbouring cell.inttypetype specifies whether the layout places controls in rows or columns.booleanwrapwrap specifies whether a control will be wrapped to the next row if there is insufficient space on the current row.
-
Constructor Summary
Constructors Constructor Description LightRowLayout()Constructs a new instance of this class with type HORIZONTAL.LightRowLayout(int type)Constructs a new instance of this class given the type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.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.StringtoString()Returns a string containing a concise, human-readable description of the receiver.
-
-
-
Field Detail
-
type
public int type
type 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 marginWidth
marginWidth 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 marginHeight
marginHeight 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 spacing
spacing 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 wrap
wrap 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 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. The default value is true.
-
fill
public 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. The default value is false.- Since:
- 3.0
-
center
public 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. The default value is false.- Since:
- 3.4
-
justify
public boolean justify
justify 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 marginLeft
marginLeft 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 marginTop
marginTop 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 marginRight
marginRight 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 marginBottom
marginBottom specifies the number of pixels of vertical margin that will be placed along the bottom edge of the layout. The default value is 0.
-
-
Method Detail
-
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
public boolean flushCache(ILightControl control)
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
public void layout(ILightComposite composite, org.eclipse.swt.graphics.GC gc, boolean flushCache)
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.
-
-