Class GridRowLayout
java.lang.Object
org.eclipse.swt.widgets.Layout
org.eclipse.nebula.widgets.compositetable.CompositeTableLayout
org.eclipse.nebula.widgets.compositetable.AbstractGridRowLayout
org.eclipse.nebula.widgets.compositetable.GridRowLayout
- Direct Known Subclasses:
ResizableGridRowLayout
public class GridRowLayout extends AbstractGridRowLayout
Class GridRowLayout. A layout manager for CompositeTable header and row objects
that implement a tabular (grid) layout.
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.compositetable.AbstractGridRowLayout
CELL_BORDER_WIDTH
-
Constructor Summary
Constructors Constructor Description GridRowLayout()
Constructor GridRowLayout.GridRowLayout(int[] weights)
Construct a GridRowLayout, specifying both the weights and the fittingHorizontally property.GridRowLayout(int[] weights, boolean fittingHorizontally)
Constructor GridRowLayout. -
Method Summary
Modifier and Type Method Description protected org.eclipse.swt.graphics.Point
computeColumnSize(org.eclipse.swt.widgets.Widget columnObject, int wHint, int hHint, boolean flush)
Compute and return the preferred size of the specified column object, passing the usual SWT wHint, hHint, and flush parameters.protected int
computeMaxHeight(org.eclipse.swt.widgets.Composite rowOrHeader)
Return the maximum desired height of each of the row or header's children.protected org.eclipse.swt.widgets.Widget
getColumnAt(org.eclipse.swt.widgets.Composite rowOrHeader, int offset)
Return the SWT Widget representing the specified column.protected int
getNumColumns(org.eclipse.swt.widgets.Composite rowOrHeader)
Return the number of columns in the specified row or header.protected void
setBounds(org.eclipse.swt.widgets.Widget columnObject, int left, int top, int width, int height)
Set the bounds of the specified column object.Methods inherited from class org.eclipse.nebula.widgets.compositetable.AbstractGridRowLayout
computeSize, getAvailableWidth, getSumOfAllWeights, getWeights, isFittingHorizontally, isWidthWiderThanAllColumns, layout, setFittingHorizontally, setWeights
-
Constructor Details
-
GridRowLayout
public GridRowLayout()Constructor GridRowLayout. The default constructor. If you use this constructor, you must manually specify the column weights, and possibly, the fittingHorizontally property value. -
GridRowLayout
public GridRowLayout(int[] weights, boolean fittingHorizontally)Constructor GridRowLayout. Construct a GridRowLayout, specifying the column weights. By default, fittingHorizontally is false.- Parameters:
weights
- int[] The amount of weight desired for each column in the table. If fittingHorizontally is set to true, the sum of all weights must be 100 and each weight indicates the percentage of the whole table that each column will occupy. If fittingHorizontally is set to false, each weight is the minimum width of the column in pixels. If the table is narrower than can fit all widths, CompositeTable will display a horizontal scroll bar. If the table is wider than can fit all widths, the columns are scaled so that the entire table fills the desired space and the ratios of the column widths remains constant. fittingHorizontally defaults to false.
-
GridRowLayout
public GridRowLayout(int[] weights)Construct a GridRowLayout, specifying both the weights and the fittingHorizontally property.- Parameters:
weights
- int[] The amount of weight desired for each column in the table. If fittingHorizontally is set to true, the sum of all weights must be 100 and each weight indicates the percentage of the whole table that each column will occupy. If fittingHorizontally is set to false, each weight is the minimum width of the column in pixels. If the table is narrower than can fit all widths, CompositeTable will display a horizontal scroll bar. If the table is wider than all minimum column widths, the columns will be scaled so that the ratios of the actual widths remains constant and all columns fit exactly in the available space. fittingHorizontally defaults to false.fittingHorizontally
- If true, the weights are interpreted as percentages and the column widths are scaled so that each column occupies the percentage of the total width indicated by its weight. If false, the weights are interpreted as minimum column widths. If the table is narrower than can accommodate those widths, CompositeTable will display a horizontal scroll bar. If the table is wider than all minimum column widths, the columns will be scaled so that the ratios of the actual widths remains constant and all columns fit exactly in the available space.
-
-
Method Details
-
computeMaxHeight
protected int computeMaxHeight(org.eclipse.swt.widgets.Composite rowOrHeader)Description copied from class:AbstractGridRowLayout
Return the maximum desired height of each of the row or header's children.- Specified by:
computeMaxHeight
in classAbstractGridRowLayout
- Parameters:
rowOrHeader
- The row or header Composite- Returns:
- int the maximum desired height of each of the row or header's children.
-
computeColumnSize
protected org.eclipse.swt.graphics.Point computeColumnSize(org.eclipse.swt.widgets.Widget columnObject, int wHint, int hHint, boolean flush)Description copied from class:AbstractGridRowLayout
Compute and return the preferred size of the specified column object, passing the usual SWT wHint, hHint, and flush parameters.- Specified by:
computeColumnSize
in classAbstractGridRowLayout
- Parameters:
columnObject
- The column objectwHint
- SWT.DEFAULT or a preferred width as an inthHint
- SWT.DEFAULT or a preferred height as an intflush
- If any cached size should be flushed and recomputed.- Returns:
- Point the preferred size.
-
getColumnAt
protected org.eclipse.swt.widgets.Widget getColumnAt(org.eclipse.swt.widgets.Composite rowOrHeader, int offset)Description copied from class:AbstractGridRowLayout
Return the SWT Widget representing the specified column.- Specified by:
getColumnAt
in classAbstractGridRowLayout
- Parameters:
rowOrHeader
- The header or row objectoffset
- The column's offset.- Returns:
- The SWT Widget.
-
getNumColumns
protected int getNumColumns(org.eclipse.swt.widgets.Composite rowOrHeader)Description copied from class:AbstractGridRowLayout
Return the number of columns in the specified row or header.- Specified by:
getNumColumns
in classAbstractGridRowLayout
- Parameters:
rowOrHeader
- The row or header object.- Returns:
- int the number of columns in the specified row or header.
-
setBounds
protected void setBounds(org.eclipse.swt.widgets.Widget columnObject, int left, int top, int width, int height)Description copied from class:AbstractGridRowLayout
Set the bounds of the specified column object. Any of the parameters may be ignored if necessary (for example, a real Table header will ignore the top and height parameters).- Specified by:
setBounds
in classAbstractGridRowLayout
- Parameters:
columnObject
- The column object to placeleft
- The column's left coordinatetop
- The column's top coordinatewidth
- The column's widthheight
- The column's height
-