com.gwtext.client.widgets.grid
Class ColumnModel

java.lang.Object
  extended by com.gwtext.client.core.JsObject
      extended by com.gwtext.client.widgets.grid.ColumnModel

public class ColumnModel
extends JsObject

The column model class for a GridPanel.


Field Summary
 
Fields inherited from class com.gwtext.client.core.JsObject
jsObj
 
Constructor Summary
ColumnModel(BaseColumnConfig[] columnConfigs)
          Construct a new ColumnModel.
ColumnModel(com.google.gwt.core.client.JavaScriptObject jsObj)
          Construct a new ColumnModel using a native object.
 
Method Summary
 void addListener(ColumnModelListener listener)
          Add a ColumnModel listener.
 com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject configJS)
           
 GridEditor getCellEditor(int colIndex, int rowIndex)
          gets the GridEditor for a specific column index and row index.
 BaseColumnConfig[] getColumnConfigs()
           
 int getColumnCount()
          Returns the number of columns.
 java.lang.String getColumnHeader(int colIndex)
          Returns the header for the specified column.
 java.lang.String getColumnHeader(java.lang.String colID)
          Returns the column header.
 java.lang.String getColumnId(int colIndex)
          Returns the column ID.
 java.lang.String getColumnTooltip(int colIndex)
          Returns the tooltip for the specified column.
 java.lang.String getColumnTooltip(java.lang.String colID)
          Returns the tooltip for the specified column.
 int getColumnWidth(int colIndex)
          Returns the width for the specified column.
 int getColumnWidth(java.lang.String colID)
          Returns the width for the specified column.
 java.lang.String getDataIndex(int colIndex)
          Returns the dataIndex for the specified column.
 java.lang.String getDataIndex(java.lang.String colID)
          Returns the dataIndex for the specified column.
 int getIndexById(java.lang.String id)
          Returns the index for a specified column ID.
 int getTotalWidth()
           
 int getTotalWidth(boolean includeHidden)
          Returns the total width of all columns.
 boolean isCellEditable(int colIndex, int rowIndex)
          Returns true if the cell is editable.
 boolean isCellEditable(java.lang.String colID, int rowIndex)
          Returns true if the cell is editable.
 boolean isFixed(int colIndex)
          Returns true if the column width cannot be changed
 boolean isFixed(java.lang.String colID)
          Returns true if the column width cannot be changed.
 boolean isHidden(int colIndex)
          Returns true if the column is hidden.
 boolean isHidden(java.lang.String colID)
          Returns true if the column is hidden.
 boolean isLocked(int colIndex)
          Returns if the column is locked.
 boolean isLocked(java.lang.String colID)
          Returns true if the column is locked.
 boolean isResizable(int colIndex)
          Returns true if the column is resizable.
 boolean isResizable(java.lang.String colID)
          Returns true if the column is resizable.
 boolean isSortable(int colIndex)
          Returns true if the column is sortable.
 boolean isSortable(java.lang.String colID)
          Returns true if the column is sortable.
 void setColumnHeader(int colIndex, java.lang.String header)
          Sets the header for a column.
 void setColumnHeader(java.lang.String colID, java.lang.String header)
          Sets the header for a column.
 void setColumnWidth(int colIndex, int width)
          Sets the width for a column.
 void setColumnWidth(java.lang.String colID, int width)
          Sets the width for a column.
 void setDataIndex(int colIndex, int dataIndex)
          Sets the dataIndex for a column.
 void setDataIndex(int colIndex, java.lang.String dataIndex)
          Sets the dataIndex for a column.
 void setDataIndex(java.lang.String colID, int dataIndex)
          Sets the dataIndex for a column.
 void setDataIndex(java.lang.String colID, java.lang.String dataIndex)
          Sets the dataIndex for a column.
 void setDefaultSortable(boolean defaultSortable)
          Default sortable of columns which have no sortable specified (defaults to false).
 void setDefaultWidth(int defaultWidth)
          The width of columns which have no width specified (defaults to 100)
 void setEditable(int colIndex, boolean editable)
          Sets if a column is editable.
 void setEditable(java.lang.String colID, boolean editable)
          Sets if a column is editable.
 void setEditor(int colIndex, GridEditor editor)
          Sets the editor for a column.
 void setEditor(java.lang.String colID, GridEditor editor)
          Sets the editor for a column.
 void setHidden(int colIndex, boolean hidden)
          Sets if a column is hidden.
 void setHidden(java.lang.String colID, boolean hidden)
          Sets if a column is hidden.
 void setRenderer(int colIndex, Renderer renderer)
          Sets the rendering (formatting) function for a column.
 void setRenderer(java.lang.String colID, Renderer renderer)
          Sets the rendering (formatting) function for a column.
 void setUserCustomCellEditor(UserCustomCellEditor ucce)
          This method will allow to set custom editors.
 
Methods inherited from class com.gwtext.client.core.JsObject
getJsObj, getProperties, isCreated, setJsObj
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnModel

public ColumnModel(com.google.gwt.core.client.JavaScriptObject jsObj)
Construct a new ColumnModel using a native object.

Parameters:
jsObj - the native object

ColumnModel

public ColumnModel(BaseColumnConfig[] columnConfigs)
Construct a new ColumnModel.

Parameters:
columnConfigs - the configuration for the columns
Method Detail

create

public com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject configJS)

getColumnConfigs

public BaseColumnConfig[] getColumnConfigs()

setDefaultSortable

public void setDefaultSortable(boolean defaultSortable)
Default sortable of columns which have no sortable specified (defaults to false).

Parameters:
defaultSortable - true to enable sortable for all columns

setDefaultWidth

public void setDefaultWidth(int defaultWidth)
The width of columns which have no width specified (defaults to 100)

Parameters:
defaultWidth - the default column width

setUserCustomCellEditor

public void setUserCustomCellEditor(UserCustomCellEditor ucce)
This method will allow to set custom editors. By default, extjs uses the column index to find a GridEditor; however, if different rows required different data from a ComboBox or different editors depending on other data, the default behavior is not enough. This method sets a UserCustomCellEditor that is called whenever extjs needs the GridEditor to display in the grid.

Parameters:
ucce - The UserCustomCellEditor that overwrites getCellEditor

getCellEditor

public GridEditor getCellEditor(int colIndex,
                                int rowIndex)
gets the GridEditor for a specific column index and row index. Only column index is used if setUserCustomCellEditor is not called.

Parameters:
colIndex - Column index to identify the column selected
rowIndex - Row index to identify the column selected
Returns:
the GridEditor for that column and row index

getColumnCount

public int getColumnCount()
Returns the number of columns.

Returns:
the number of columns

getColumnHeader

public java.lang.String getColumnHeader(java.lang.String colID)
Returns the column header.

Parameters:
colID - column ID
Returns:
header

getColumnHeader

public java.lang.String getColumnHeader(int colIndex)
Returns the header for the specified column.

Parameters:
colIndex - the column index
Returns:
the column header

getColumnId

public java.lang.String getColumnId(int colIndex)
Returns the column ID.

Parameters:
colIndex - column index
Returns:
the column id set by the user using ColumnConfig.setId(String). If the user did not set the id for the column, then the column position is returned as a String.

getColumnTooltip

public java.lang.String getColumnTooltip(java.lang.String colID)
Returns the tooltip for the specified column.

Parameters:
colID - the column ID
Returns:
the column tooltip

getColumnTooltip

public java.lang.String getColumnTooltip(int colIndex)
Returns the tooltip for the specified column.

Parameters:
colIndex - the column index
Returns:
the column tooltip

getColumnWidth

public int getColumnWidth(java.lang.String colID)
Returns the width for the specified column.

Parameters:
colID - the column ID
Returns:
the column width

getColumnWidth

public int getColumnWidth(int colIndex)
Returns the width for the specified column.

Parameters:
colIndex - the column index
Returns:
the column width

getDataIndex

public java.lang.String getDataIndex(java.lang.String colID)
Returns the dataIndex for the specified column.

Parameters:
colID - the column ID
Returns:
the data index of the Store

getDataIndex

public java.lang.String getDataIndex(int colIndex)
Returns the dataIndex for the specified column.

Parameters:
colIndex - the column idex
Returns:
the data index of the Store

getIndexById

public int getIndexById(java.lang.String id)
Returns the index for a specified column ID.

Parameters:
id - column id used in ColumnConfig when defining the ColumnModel
Returns:
column index (0 based), -1 if not found
See Also:
ColumnConfig.setId(String)

getTotalWidth

public int getTotalWidth()

getTotalWidth

public int getTotalWidth(boolean includeHidden)
Returns the total width of all columns.

Parameters:
includeHidden - true to include hidden column widths
Returns:
total width

isCellEditable

public boolean isCellEditable(java.lang.String colID,
                              int rowIndex)
Returns true if the cell is editable.

Parameters:
colID - the column ID
rowIndex - the row index
Returns:
true if editable

isCellEditable

public boolean isCellEditable(int colIndex,
                              int rowIndex)
Returns true if the cell is editable.

Parameters:
colIndex - the column index
rowIndex - the row index
Returns:
true if editable

isFixed

public boolean isFixed(java.lang.String colID)
Returns true if the column width cannot be changed.

Parameters:
colID - the column ID
Returns:
true if fixed

isFixed

public boolean isFixed(int colIndex)
Returns true if the column width cannot be changed

Parameters:
colIndex - the column index
Returns:
true if fixed

isHidden

public boolean isHidden(java.lang.String colID)
Returns true if the column is hidden.

Parameters:
colID - the column ID
Returns:
true if hidden

isHidden

public boolean isHidden(int colIndex)
Returns true if the column is hidden.

Parameters:
colIndex - the column index
Returns:
true if hidden

isLocked

public boolean isLocked(java.lang.String colID)
Returns true if the column is locked.

Parameters:
colID - the column ID
Returns:
true if locked

isLocked

public boolean isLocked(int colIndex)
Returns if the column is locked.

Parameters:
colIndex - column index (0 based)
Returns:
locked

isResizable

public boolean isResizable(java.lang.String colID)
Returns true if the column is resizable.

Parameters:
colID - the column ID
Returns:
true if resizable

isResizable

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

Parameters:
colIndex - the column index
Returns:
true if resizable

isSortable

public boolean isSortable(java.lang.String colID)
Returns true if the column is sortable.

Parameters:
colID - the column ID
Returns:
true of sortable

isSortable

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

Parameters:
colIndex - the column index
Returns:
true if sortable

setColumnHeader

public void setColumnHeader(java.lang.String colID,
                            java.lang.String header)
Sets the header for a column.

Parameters:
colID - the column ID
header - the column header

setColumnHeader

public void setColumnHeader(int colIndex,
                            java.lang.String header)
Sets the header for a column.

Parameters:
colIndex - the column index
header - the column header

setColumnWidth

public void setColumnWidth(java.lang.String colID,
                           int width)
Sets the width for a column.

Parameters:
colID - the column ID
width - the column width

setColumnWidth

public void setColumnWidth(int colIndex,
                           int width)
Sets the width for a column.

Parameters:
colIndex - the column index
width - the column width

setDataIndex

public void setDataIndex(java.lang.String colID,
                         int dataIndex)
Sets the dataIndex for a column.

Parameters:
colID - the column ID
dataIndex - the Store's data index

setDataIndex

public void setDataIndex(int colIndex,
                         int dataIndex)
Sets the dataIndex for a column.

Parameters:
colIndex - the column index
dataIndex - the data index

setDataIndex

public void setDataIndex(java.lang.String colID,
                         java.lang.String dataIndex)
Sets the dataIndex for a column.

Parameters:
colID - the column ID
dataIndex - the Store's data index

setDataIndex

public void setDataIndex(int colIndex,
                         java.lang.String dataIndex)
Sets the dataIndex for a column.

Parameters:
colIndex - the column index
dataIndex - the data index

setEditable

public void setEditable(java.lang.String colID,
                        boolean editable)
Sets if a column is editable.

Parameters:
colID - the column ID
editable - true if editable

setEditable

public void setEditable(int colIndex,
                        boolean editable)
Sets if a column is editable.

Parameters:
colIndex - the column index
editable - true if editable

setEditor

public void setEditor(java.lang.String colID,
                      GridEditor editor)
Sets the editor for a column.

Parameters:
colID - the column ID
editor - the editor

setEditor

public void setEditor(int colIndex,
                      GridEditor editor)
Sets the editor for a column.

Parameters:
colIndex - the column index
editor - the editor

setHidden

public void setHidden(java.lang.String colID,
                      boolean hidden)
Sets if a column is hidden.

Parameters:
colID - the column ID
hidden - true if hidden

setHidden

public void setHidden(int colIndex,
                      boolean hidden)
Sets if a column is hidden.

Parameters:
colIndex - the column index
hidden - true if hidden

setRenderer

public void setRenderer(java.lang.String colID,
                        Renderer renderer)
Sets the rendering (formatting) function for a column.

Parameters:
colID - the column ID
renderer - the column renderer

setRenderer

public void setRenderer(int colIndex,
                        Renderer renderer)
Sets the rendering (formatting) function for a column.

Parameters:
colIndex - the column idex
renderer - the column renderer

addListener

public void addListener(ColumnModelListener listener)
Add a ColumnModel listener.

Parameters:
listener - the listener