Package com._1c.g5.lwt.layouts
Class LightColumnLayout
- java.lang.Object
-
- com._1c.g5.lwt.layouts.LightColumnLayout
-
- All Implemented Interfaces:
ILightLayout
public final class LightColumnLayout extends Object implements ILightLayout
This layout manager arranges children of the composite parent in vertical columns. All the columns are identical size and children are stretched horizontally to fill the column width. The goal is to give layout some reasonable range of column numbers to allow it to handle various parent widths. That way, column number will drop to the lowest number in the range when width decreases, and grow up to the highest number in the range when allowed by the parent width.In addition, the layout attempts to 'fill the space' equally i.e. to avoid large gaps at the and of the last column.
Child controls are layed out according to their 'natural' (preferred) size. For 'stretchy' controls that do not have natural preferred size, it is possible to set width and/or height hints using ColumnLayoutData objects.
- Since:
- 3.0
- See Also:
ColumnLayoutData
-
-
Field Summary
Fields Modifier and Type Field Description int
bottomMargin
Bottom margin (default is 5).int
horizontalSpacing
Horizontal spacing between columns (default is 5).int
leftMargin
Left margin (default is 5).int
maxNumColumns
Maximum number of columns (default is 3).int
minNumColumns
Minimum number of columns (default is 1).int
rightMargin
Right margin (default is 5).int
topMargin
Top margin (default is 5).int
verticalSpacing
Vertical spacing between controls (default is 5).
-
Constructor Summary
Constructors Constructor Description LightColumnLayout()
Creates a new instance of the column layout.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
computeMaximumWidth(ILightComposite parent, org.eclipse.swt.graphics.GC gc, boolean changed)
int
computeMinimumWidth(ILightComposite parent, org.eclipse.swt.graphics.GC gc, boolean changed)
org.eclipse.swt.graphics.Point
computeSize(ILightComposite composite, org.eclipse.swt.graphics.GC gc, int wHint, int hHint, boolean flushCache)
Computes the size of the given composite.boolean
flushCache(ILightControl control)
Flushes the layout cache for the given control.void
layout(ILightComposite parent, org.eclipse.swt.graphics.GC gc, boolean flushCache)
Layouts the given composite.
-
-
-
Field Detail
-
minNumColumns
public int minNumColumns
Minimum number of columns (default is 1).
-
maxNumColumns
public int maxNumColumns
Maximum number of columns (default is 3).
-
horizontalSpacing
public int horizontalSpacing
Horizontal spacing between columns (default is 5).
-
verticalSpacing
public int verticalSpacing
Vertical spacing between controls (default is 5).
-
topMargin
public int topMargin
Top margin (default is 5).
-
leftMargin
public int leftMargin
Left margin (default is 5).
-
bottomMargin
public int bottomMargin
Bottom margin (default is 5).
-
rightMargin
public int rightMargin
Right margin (default is 5).
-
-
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:ILightLayout
Computes the size of the given composite.- Specified by:
computeSize
in interfaceILightLayout
- Parameters:
composite
- the composite to compute the size of.gc
- theGC
to 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:
-
layout
public void layout(ILightComposite parent, org.eclipse.swt.graphics.GC gc, boolean flushCache)
Description copied from interface:ILightLayout
Layouts the given composite.- Specified by:
layout
in interfaceILightLayout
- Parameters:
parent
- the composite to layout.gc
- theGC
to do the measurements with.flushCache
- the flush cache flag, instructs the layout to reset all its caches, if any.
-
computeMaximumWidth
public int computeMaximumWidth(ILightComposite parent, org.eclipse.swt.graphics.GC gc, boolean changed)
-
computeMinimumWidth
public int computeMinimumWidth(ILightComposite parent, org.eclipse.swt.graphics.GC gc, boolean changed)
-
flushCache
public boolean flushCache(ILightControl control)
Description copied from interface:ILightLayout
Flushes the layout cache for the given control.- Specified by:
flushCache
in interfaceILightLayout
- Parameters:
control
- the control to flush the cache for.- Returns:
true
if the layout has flushed the cache,false
otherwise.
-
-