com.ibm.commons.swt.controls.custom
Class CustomTableColumn

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Item
          extended by org.eclipse.swt.widgets.TableColumn
              extended by com.ibm.commons.swt.controls.custom.CustomTableColumn

public class CustomTableColumn
extends org.eclipse.swt.widgets.TableColumn

An extension of the standard SWT TableColumn class. Used in conjunction with com.ibm.commons.swt.controls.custom.CustomTable
This class automatically takes care of many of the sizing issues that are normally associated with SWT Tables, such as sizing columns appropriately. This extension allows columns to define how they are to be sized within the table. Columns can control the amount of space they take up within the table by defining if they are to take up:



For convenience this widget also allows the user to associate an ID with the widget.

See Also:
com.ibm.commons.swt.controls.custom.CustomTable}

Field Summary
static int UNIT_COLCHAR
          Type constant used for columns with a predefined character width
static int UNIT_COLWIDTH
          Type constant used for columns with a predefined width
static int UNIT_PERCENT
          Type constant used for columns with a predefined percentage width
static int UNIT_PIXEL
          Type constant used for columns with a predefined pixel width
static int UNIT_REMAINDER
          Type constant used for columns without a predefined width.
 
Constructor Summary
CustomTableColumn(CustomTable parent, int style, int index, java.lang.String id)
          Constructs a new instance of the class given the parent table, a style value describing its behavior and appearance, and id which can be used to later identify this control.
CustomTableColumn(CustomTable parent, int style, java.lang.String id)
          Constructs a new instance of the class given the parent table, a style value describing its behavior and appearance, and id which can be used to later identify this control.
 
Method Summary
protected  void checkSubclass()
           
 int getColWidth()
          Returns the column's width.
 java.lang.String getId()
           
 int getWidthUnit()
          Can be any one of: com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_COLCHAR com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_COLWIDTH com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_PERCENT com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_PIXEL com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_REMAINDER
 boolean isEditable()
          Determines whether or not the values of the column can be edited.
 boolean isResizable()
          Determines if the current column is resizable.
 void setColWidth(int colWidth)
          Sets the width of the current column.
 void setEditable(boolean editable)
          Sets whether or not the values of the column can be edited
 void setId(java.lang.String id)
           
 void setResizable(boolean resizable)
          Sets whether or not the current column can be resized in the context of the entire table.
 void setWidth(int width)
          Programatically sets the width of the current column.
 void setWidthUnit(int widthUnit)
          Specifies the units to be used when sizing this column.
 
Methods inherited from class org.eclipse.swt.widgets.TableColumn
addControlListener, addSelectionListener, getAlignment, getMoveable, getParent, getResizable, getToolTipText, getWidth, pack, removeControlListener, removeSelectionListener, setAlignment, setImage, setMoveable, setText, setToolTipText
 
Methods inherited from class org.eclipse.swt.widgets.Item
getImage, getText
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNIT_COLWIDTH

public static final int UNIT_COLWIDTH
Type constant used for columns with a predefined width

See Also:
Constant Field Values

UNIT_PIXEL

public static final int UNIT_PIXEL
Type constant used for columns with a predefined pixel width

See Also:
Constant Field Values

UNIT_PERCENT

public static final int UNIT_PERCENT
Type constant used for columns with a predefined percentage width

See Also:
Constant Field Values

UNIT_REMAINDER

public static final int UNIT_REMAINDER
Type constant used for columns without a predefined width. Columns with this constant width value will expand to fill the space remaining in the table.

See Also:
Constant Field Values

UNIT_COLCHAR

public static final int UNIT_COLCHAR
Type constant used for columns with a predefined character width

See Also:
Constant Field Values
Constructor Detail

CustomTableColumn

public CustomTableColumn(CustomTable parent,
                         int style,
                         java.lang.String id)
Constructs a new instance of the class given the parent table, a style value describing its behavior and appearance, and id which can be used to later identify this control.

Parameters:
parent - - a CustomTable control which will be the parent of the new instance (CANNOT be null).
style - - the style of the control to construct.
id - - the programmatic ID of the control once constructed.

CustomTableColumn

public CustomTableColumn(CustomTable parent,
                         int style,
                         int index,
                         java.lang.String id)
Constructs a new instance of the class given the parent table, a style value describing its behavior and appearance, and id which can be used to later identify this control.

Parameters:
parent - - a CustomTable control which will be the parent of the new instance (CANNOT be null).
style - - the style of the control to construct.
index - - an integer primitative that dictates the zero based index of this column within the table.
id - - the programmatic ID of the control once constructed.
Method Detail

checkSubclass

protected void checkSubclass()
Overrides:
checkSubclass in class org.eclipse.swt.widgets.TableColumn

setWidth

public void setWidth(int width)
Programatically sets the width of the current column. The caller should ensure to call setWidthUnit(int) PRIOR to calling this method to ensure the correct units are used when calculating the width of the column.

Overrides:
setWidth in class org.eclipse.swt.widgets.TableColumn

isEditable

public boolean isEditable()
Determines whether or not the values of the column can be edited.

Returns:

setEditable

public void setEditable(boolean editable)
Sets whether or not the values of the column can be edited

Parameters:
editable -

isResizable

public boolean isResizable()
Determines if the current column is resizable.

Returns:

setResizable

public void setResizable(boolean resizable)
Sets whether or not the current column can be resized in the context of the entire table. If true the other columns in the table will be queried for their width and their width will be calculated accordingly.

Overrides:
setResizable in class org.eclipse.swt.widgets.TableColumn
See Also:
com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_COLCHAR} {@link com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_COLWIDTH} {@link com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_PERCENT} {@link com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_PIXEL} {@link com.ibm.commons.swt.controls.custom.CustomTableColumn.UNIT_REMAINDER}

getColWidth

public int getColWidth()
Returns the column's width. The units are determined by querying getWidthUnit()

Returns:
int - the column's width in relative units

setColWidth

public void setColWidth(int colWidth)
Sets the width of the current column.

Parameters:
colWidth -

getWidthUnit

public int getWidthUnit()
Can be any one of:

Returns:
widthUnit (can be any of the above)

setWidthUnit

public void setWidthUnit(int widthUnit)
Specifies the units to be used when sizing this column. It can be any one of: Once this unit value is set a request is sent to the table to resize its columns in accordance with their sizing attributes.

Parameters:
widthUnit -

getId

public java.lang.String getId()

setId

public void setId(java.lang.String id)