com.sencha.gxt.widget.core.client.grid
Class ColumnModel<M>

java.lang.Object
  extended by com.sencha.gxt.widget.core.client.grid.ColumnModel<M>
All Implemented Interfaces:
HasHandlers, ColumnMoveEvent.HasColumnMoveHandlers, ColumnWidthChangeEvent.HasColumnWidthChangeHandlers, ColumnHeaderChangeEvent.HasColumnHeaderChangeHandlers, ColumnHiddenChangeEvent.HasColumnHiddenChangeHandlers, ColumnModelHandlers.HasColumnModelHandlers

public class ColumnModel<M>
extends java.lang.Object
implements ColumnModelHandlers.HasColumnModelHandlers

This is the default implementation of a ColumnModel.


Constructor Summary
ColumnModel(java.util.List<ColumnConfig<M,?>> list)
          Creates a new column model.
 
Method Summary
 void addAggregationRow(AggregationRowConfig<M> row)
          Adds an aggregation row config to the column model.
 HandlerRegistration addColumnHeaderChangeHandler(ColumnHeaderChangeEvent.ColumnHeaderChangeHandler handler)
           
 HandlerRegistration addColumnHiddenChangeHandler(ColumnHiddenChangeEvent.ColumnHiddenChangeHandler handler)
           
 HandlerRegistration addColumnModelHandlers(ColumnModelHandlers handlers)
           
 HandlerRegistration addColumnMoveHandler(ColumnMoveEvent.ColumnMoveHandler handler)
           
 HandlerRegistration addColumnWidthChangeHandler(ColumnWidthChangeEvent.ColumnWidthChangeHandler handler)
           
 void addHeaderGroup(int row, int column, HeaderGroupConfig config)
          Adds a group to the column model.
 ColumnConfig<M,?> findColumnConfig(java.lang.String path)
          Returns the matching column based on value provider path.
 void fireEvent(GwtEvent<?> event)
           
 AggregationRowConfig<M> getAggregationRow(int rowIndex)
          Returns the aggregation row.
 java.util.List<AggregationRowConfig<M>> getAggregationRows()
          Returns the aggregation rows.
<N> Cell<N>
getCell(int colIndex)
          Returns the cell renderer.
<N> ColumnConfig<M,N>
getColumn(int colIndex)
          Returns the column at the given index.
 HasHorizontalAlignment.HorizontalAlignmentConstant getColumnAlignment(int colIndex)
          Returns the column's alignment.
 int getColumnCount()
          Returns the column count.
 int getColumnCount(boolean visibleOnly)
          Returns the number of visible columns.
 SafeHtml getColumnHeader(int colIndex)
          Returns the header for the specified column.
 java.util.List<ColumnConfig<M,?>> getColumns()
          Returns the column configs.
 SafeStyles getColumnStyles(int colIndex)
          Returns the column's styles.
 SafeHtml getColumnToolTip(int colIndex)
          Returns the tooltip for the specified column.
 int getColumnWidth(int colIndex)
          Returns the column width.
 java.util.List<HeaderGroupConfig> getHeaderGroups()
          Returns the header groups.
 int getTotalWidth()
          Returns the total width of all columns.
 int getTotalWidth(boolean includeHidden)
          Returns the total width of all columns.
<N> ValueProvider<? super M,N>
getValueProvider(int colIndex)
          Returns the cell value provider.
 int indexOf(ColumnConfig<M,?> column)
          Returns the index of the column.
 boolean isFixed(int colIndex)
          Returns true if the column can be resized.
 boolean isGroupable(int colIndex)
          Returns true if the column is groupable.
 boolean isHidden(int colIndex)
          Returns true if the column is hidden.
 boolean isMenuDisabled(int colIndex)
          Returns true if the specified column menu is disabled.
 boolean isResizable(int colIndex)
          Returns true if the column can be resized.
 boolean isSortable(int colIndex)
          Returns true if the specified column is sortable.
 void moveColumn(int oldIndex, int newIndex)
          Moves a column.
 void setColumnHeader(int colIndex, SafeHtml header)
          Sets the header for a column.
 void setColumnWidth(int colIndex, int width)
          Sets the column's width.
 void setColumnWidth(int colIndex, int width, boolean suppressEvent)
          Sets the column's width.
 void setHidden(int colIndex, boolean hidden)
          Sets if a column is hidden.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColumnModel

public ColumnModel(java.util.List<ColumnConfig<M,?>> list)
Creates a new column model.

Parameters:
list - the columns
Method Detail

addAggregationRow

public void addAggregationRow(AggregationRowConfig<M> row)
Adds an aggregation row config to the column model.

Parameters:
row - the aggregation row

addColumnHeaderChangeHandler

public HandlerRegistration addColumnHeaderChangeHandler(ColumnHeaderChangeEvent.ColumnHeaderChangeHandler handler)
Specified by:
addColumnHeaderChangeHandler in interface ColumnHeaderChangeEvent.HasColumnHeaderChangeHandlers

addColumnHiddenChangeHandler

public HandlerRegistration addColumnHiddenChangeHandler(ColumnHiddenChangeEvent.ColumnHiddenChangeHandler handler)
Specified by:
addColumnHiddenChangeHandler in interface ColumnHiddenChangeEvent.HasColumnHiddenChangeHandlers

addColumnModelHandlers

public HandlerRegistration addColumnModelHandlers(ColumnModelHandlers handlers)
Specified by:
addColumnModelHandlers in interface ColumnModelHandlers.HasColumnModelHandlers

addColumnMoveHandler

public HandlerRegistration addColumnMoveHandler(ColumnMoveEvent.ColumnMoveHandler handler)
Specified by:
addColumnMoveHandler in interface ColumnMoveEvent.HasColumnMoveHandlers

addColumnWidthChangeHandler

public HandlerRegistration addColumnWidthChangeHandler(ColumnWidthChangeEvent.ColumnWidthChangeHandler handler)
Specified by:
addColumnWidthChangeHandler in interface ColumnWidthChangeEvent.HasColumnWidthChangeHandlers

addHeaderGroup

public void addHeaderGroup(int row,
                           int column,
                           HeaderGroupConfig config)
Adds a group to the column model.

Parameters:
row - the row
column - the column
config - the header group config

findColumnConfig

public ColumnConfig<M,?> findColumnConfig(java.lang.String path)
Returns the matching column based on value provider path.

Parameters:
path - the path
Returns:
the matching column or null if no match

fireEvent

public void fireEvent(GwtEvent<?> event)
Specified by:
fireEvent in interface HasHandlers

getAggregationRow

public AggregationRowConfig<M> getAggregationRow(int rowIndex)
Returns the aggregation row.

Parameters:
rowIndex - the row index
Returns:
the aggregation row

getAggregationRows

public java.util.List<AggregationRowConfig<M>> getAggregationRows()
Returns the aggregation rows.

Returns:
the aggregation rows

getCell

public <N> Cell<N> getCell(int colIndex)
Returns the cell renderer.

Parameters:
colIndex - the column index
Returns:
the cell renderer

getColumn

public <N> ColumnConfig<M,N> getColumn(int colIndex)
Returns the column at the given index.

Parameters:
colIndex - the column index
Returns:
the column or null

getColumnAlignment

public HasHorizontalAlignment.HorizontalAlignmentConstant getColumnAlignment(int colIndex)
Returns the column's alignment.

Parameters:
colIndex - the column index
Returns:
the alignment

getColumnCount

public int getColumnCount()
Returns the column count.

Returns:
the column count

getColumnCount

public int getColumnCount(boolean visibleOnly)
Returns the number of visible columns.

Returns:
the visible column count

getColumnHeader

public SafeHtml getColumnHeader(int colIndex)
Returns the header for the specified column.

Parameters:
colIndex - the column index
Returns:
the header

getColumns

public java.util.List<ColumnConfig<M,?>> getColumns()
Returns the column configs.

Returns:
the column configs

getColumnStyles

public SafeStyles getColumnStyles(int colIndex)
Returns the column's styles.

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

getColumnToolTip

public SafeHtml getColumnToolTip(int colIndex)
Returns the tooltip for the specified column.

Parameters:
colIndex - the column index
Returns:
the tooltip

getColumnWidth

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

Parameters:
colIndex - the column index
Returns:
the width

getHeaderGroups

public java.util.List<HeaderGroupConfig> getHeaderGroups()
Returns the header groups.

Returns:
the header groups

getTotalWidth

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

Returns:
the total width

getTotalWidth

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

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

getValueProvider

public <N> ValueProvider<? super M,N> getValueProvider(int colIndex)
Returns the cell value provider.

Parameters:
colIndex - the column index
Returns:
the value provider

indexOf

public int indexOf(ColumnConfig<M,?> column)
Returns the index of the column.

Parameters:
column - the column
Returns:
the column index

isFixed

public boolean isFixed(int colIndex)
Returns true if the column can be resized.

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

isGroupable

public boolean isGroupable(int colIndex)
Returns true if the column is groupable. Applies when using a GroupingView.

Parameters:
colIndex - the column index
Returns:
true if the column is groupable.

isHidden

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

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

isMenuDisabled

public boolean isMenuDisabled(int colIndex)
Returns true if the specified column menu is disabled.

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

isResizable

public boolean isResizable(int colIndex)
Returns true if the column can be resized.

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

isSortable

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

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

moveColumn

public void moveColumn(int oldIndex,
                       int newIndex)
Moves a column.

Parameters:
oldIndex - the column index
newIndex - the new column index

setColumnHeader

public void setColumnHeader(int colIndex,
                            SafeHtml header)
Sets the header for a column.

Parameters:
colIndex - the column index
header - the header

setColumnWidth

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

Parameters:
colIndex - the column index
width - the width

setColumnWidth

public void setColumnWidth(int colIndex,
                           int width,
                           boolean suppressEvent)
Sets the column's width.

Parameters:
colIndex - the column index
width - the width
suppressEvent - true to suppress width change event

setHidden

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

Parameters:
colIndex - the column index
hidden - true to hide the column


Copyright © 2012. All Rights Reserved.