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

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.table.TableColumnModel
All Implemented Interfaces:
Observable
Direct Known Subclasses:
TreeTableColumnModel

public class TableColumnModel
extends BaseObservable

This is the default implementation of a ColumnModel used by the Table.

Events:
Resize : TableEvent(table, columnIndex, width)
Fires after a column is resized.
HeaderChange : TableEvent(table, columnIndex)
Fires when the text of a header changes.
WidthChange : TableEvent(table, columnIndex)
Fires when the width of a column changes.


Constructor Summary
TableColumnModel(java.util.List<? extends TableColumn> columns)
          Constructs a new instance.
TableColumnModel(TableColumn... columns)
          Constructs a new instance.
 
Method Summary
 TableColumn getColumn(int index)
          Returns the column at the given, zero-relative index or null if the index is out of range.
 TableColumn getColumn(java.lang.String name)
          Returns the column with the given name.
 int getColumnCount()
          Returns the number of columns contained in the table.
 java.util.List<TableColumn> getColumns()
          Returns the colum model's column.
 Component getTable()
           
 int getTotalWidth()
          Returns the total column model width.
 int getVisibleColumnCount()
          Returns the number of visible columns.
 int indexOf(TableColumn column)
          Returns the index of the column.
 void setColumnWidth(int index, float width)
          Sets the column's width.
 void setTable(Component table)
           
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, fireEvent, fireEvent, getFiresEvents, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableColumnModel

public TableColumnModel(java.util.List<? extends TableColumn> columns)
Constructs a new instance.


TableColumnModel

public TableColumnModel(TableColumn... columns)
Constructs a new instance.

Method Detail

getColumn

public TableColumn getColumn(int index)
Returns the column at the given, zero-relative index or null if the index is out of range.

Parameters:
index - the index of the column to return
Returns:
the column at the given index

getColumn

public TableColumn getColumn(java.lang.String name)
Returns the column with the given name.

Parameters:
name - the column name
Returns:
the column or null if no match

getColumnCount

public int getColumnCount()
Returns the number of columns contained in the table.

Returns:
the number of columns

getColumns

public java.util.List<TableColumn> getColumns()
Returns the colum model's column.

Returns:
the columns

getTable

public Component getTable()

getTotalWidth

public int getTotalWidth()
Returns the total column model width.

Returns:
the width in pixels

getVisibleColumnCount

public int getVisibleColumnCount()
Returns the number of visible columns.

Returns:
the visible column count

indexOf

public int indexOf(TableColumn column)
Returns the index of the column.

Parameters:
column - the column
Returns:
the column index

setColumnWidth

public void setColumnWidth(int index,
                           float width)
Sets the column's width.

Parameters:
index - the column index
width - the new width

setTable

public void setTable(Component table)