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

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

public class CustomTreeColumn
extends org.eclipse.swt.widgets.TreeColumn

An extension of the standard SWT TreeColumn class. Used in conjunction with com.ibm.commons.swt.controls.custom.CustomTree
This class automatically takes care of many of the sizing issues that are normally associated with SWT Trees, such as sizing columns appropriately. This extension allows columns to define how they are to be sized within the tree. 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.CustomTableColumn}

Field Summary
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
CustomTreeColumn(CustomTree 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.CustomTreeColumn.UNIT_COLWIDTH com.ibm.commons.swt.controls.custom.CustomTreeColumn.UNIT_PERCENT com.ibm.commons.swt.controls.custom.CustomTreeColumn.UNIT_PIXEL com.ibm.commons.swt.controls.custom.CustomTreeColumn.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.TreeColumn
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
Constructor Detail

CustomTreeColumn

public CustomTreeColumn(CustomTree 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.
Method Detail

checkSubclass

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

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.TreeColumn

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.TreeColumn
See Also:
com.ibm.commons.swt.controls.custom.CustomTreeColumn.UNIT_COLWIDTH} {@link com.ibm.commons.swt.controls.custom.CustomTreeColumn.UNIT_PERCENT} {@link com.ibm.commons.swt.controls.custom.CustomTreeColumn.UNIT_PIXEL} {@link com.ibm.commons.swt.controls.custom.CustomTreeColumn.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)