com.extjs.gxt.ui.client.widget.table
Class TableColumn

java.lang.Object
  extended by com.extjs.gxt.ui.client.widget.table.TableColumn
Direct Known Subclasses:
TreeTableColumn

public class TableColumn
extends java.lang.Object

A column in a Table. Column sizes can be specified as either pixels or percentanges. Width values less than or equal to 1 are treated as percentages.

Note: Public members should not be modified after the column is added to a column model.


Field Summary
static java.util.Comparator<java.lang.Object> DEFAULT_COMPARATOR
           
 
Constructor Summary
TableColumn(java.lang.String id, float width)
          Creates a new column instance.
TableColumn(java.lang.String id, java.lang.String text)
          Creates a new column instance.
TableColumn(java.lang.String id, java.lang.String text, float width)
          Creates a new column instance.
 
Method Summary
 Style.HorizontalAlignment getAlignment()
          Returns the column's alignment.
 java.lang.String getColumnStyle()
          Returns the columns style name to be applied to the column.
 java.util.Comparator<java.lang.Object> getComparator()
          returns the table's comparator.
 java.lang.Object getData()
          Returns the application defined data associated with the column, or null if it has not been set.
 java.lang.Object getData(java.lang.String key)
          Returns the application defined property for the given name, or null if it has not been set.
 java.lang.String getId()
          Returns the column's id.
 int getMaxWidth()
          Returns the column's maximum width.
 int getMinWidth()
          Returns the column's minimum width.
 CellRenderer getRenderer()
          Returns the column's cell rendered.
 Style.SortDir getSortDir()
          Returns the column's current sort direction.
 java.lang.String getText()
          Returns the column's text.
 float getWidth()
          Returns the column's width.
 boolean isHidden()
          Returns true if hidden, false otherwise.
 boolean isResizable()
          Returns true if the column is resizable.
 boolean isSortable()
          Returns true if the column is sortable.
 void setAlignment(Style.HorizontalAlignment align)
          Sets the column's alignment.
 void setColumnStyle(java.lang.String columnStyle)
          Sets the columns style name.
 void setComparator(java.util.Comparator<java.lang.Object> comparator)
          Sets the column's comparator.
 void setData(java.lang.Object data)
          Sets the application defined column data.
 void setData(java.lang.String key, java.lang.Object data)
          Sets the application defined property with the given name.
 void setHidden(boolean hidden)
          Sets the column's hidden state.
 void setMaxWidth(int maxWidth)
          Sets the column's maximum width.
 void setMinWidth(int minWidth)
          Sets the column's minimum width.
 void setRenderer(CellRenderer renderer)
          Sets the column's cell renderer.
 void setResizable(boolean resizable)
          Specifies if the column may be resized.
 void setSortable(boolean sortable)
          Sets the sortable state.
 void setText(java.lang.String text)
          Sets the column's text.
 void setWidth(float width)
          Sets the column's width.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COMPARATOR

public static final java.util.Comparator<java.lang.Object> DEFAULT_COMPARATOR
Constructor Detail

TableColumn

public TableColumn(java.lang.String id,
                   float width)
Creates a new column instance.

Parameters:
id - the column id
width - the column width, widths that are 1 or less are treated as percentages

TableColumn

public TableColumn(java.lang.String id,
                   java.lang.String text)
Creates a new column instance.

Parameters:
id - the column id
text - the column text

TableColumn

public TableColumn(java.lang.String id,
                   java.lang.String text,
                   float width)
Creates a new column instance.

Parameters:
id - the column id
text - the column text
width - the width
Method Detail

getAlignment

public Style.HorizontalAlignment getAlignment()
Returns the column's alignment.

Returns:
the alignment

getColumnStyle

public java.lang.String getColumnStyle()
Returns the columns style name to be applied to the column.

Returns:
the style name

getComparator

public java.util.Comparator<java.lang.Object> getComparator()
returns the table's comparator.

Returns:
the comparator

getData

public java.lang.Object getData()
Returns the application defined data associated with the column, or null if it has not been set.


getData

public java.lang.Object getData(java.lang.String key)
Returns the application defined property for the given name, or null if it has not been set.

Parameters:
key - the name of the property
Returns:
the value or null if it has not been set

getId

public java.lang.String getId()
Returns the column's id.

Returns:
the id

getMaxWidth

public int getMaxWidth()
Returns the column's maximum width.

Returns:
the max width

getMinWidth

public int getMinWidth()
Returns the column's minimum width.

Returns:
the minimum width

getRenderer

public CellRenderer getRenderer()
Returns the column's cell rendered.

Returns:
the cell renderer

getSortDir

public Style.SortDir getSortDir()
Returns the column's current sort direction.

Returns:
the sort direction see Style.SortDir

getText

public java.lang.String getText()
Returns the column's text.

Returns:
the text

getWidth

public float getWidth()
Returns the column's width.

Returns:
the column width

isHidden

public boolean isHidden()
Returns true if hidden, false otherwise.

Returns:
the hidden state

isResizable

public boolean isResizable()
Returns true if the column is resizable.

Returns:
the resizable state

isSortable

public boolean isSortable()
Returns true if the column is sortable.

Returns:
the sortable state

setAlignment

public void setAlignment(Style.HorizontalAlignment align)
Sets the column's alignment. Valid values are LEFT, CENTER, and RIGHT. Default value is LEFT.

Parameters:
align - the alignment

setColumnStyle

public void setColumnStyle(java.lang.String columnStyle)
Sets the columns style name.

Parameters:
columnStyle - the style name

setComparator

public void setComparator(java.util.Comparator<java.lang.Object> comparator)
Sets the column's comparator.

Parameters:
comparator - the comparator

setData

public void setData(java.lang.Object data)
Sets the application defined column data.

Parameters:
data - the widget data

setData

public void setData(java.lang.String key,
                    java.lang.Object data)
Sets the application defined property with the given name.

Parameters:
key - the name of the property
data - the new value for the property

setHidden

public void setHidden(boolean hidden)
Sets the column's hidden state.

Parameters:
hidden - true to hide, false otherwise

setMaxWidth

public void setMaxWidth(int maxWidth)
Sets the column's maximum width. Default value = 500.

Parameters:
maxWidth - the max width

setMinWidth

public void setMinWidth(int minWidth)
Sets the column's minimum width. Default value is 20.

Parameters:
minWidth - the min width

setRenderer

public void setRenderer(CellRenderer renderer)
Sets the column's cell renderer.

Parameters:
renderer - the cell renderer

setResizable

public void setResizable(boolean resizable)
Specifies if the column may be resized. Default value is true.

Parameters:
resizable - the resizeable state

setSortable

public void setSortable(boolean sortable)
Sets the sortable state.

Parameters:
sortable - true to enable sorting

setText

public void setText(java.lang.String text)
Sets the column's text.

Parameters:
text - the text

setWidth

public void setWidth(float width)
Sets the column's width. Widths that are 1 or less are treated as percentages.

Parameters:
width - the width