public class ColumnModel<M> extends Object implements ColumnModelHandlers.HasColumnModelHandlers
Modifier and Type | Field and Description |
---|---|
protected List<ColumnConfig<M,?>> |
configs |
protected List<HeaderGroupConfig> |
groups |
protected List<AggregationRowConfig<M>> |
rows |
Constructor and Description |
---|
ColumnModel(List<ColumnConfig<M,?>> list)
Creates a new column model.
|
Modifier and Type | Method and Description |
---|---|
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.
|
protected HandlerManager |
ensureHandlers() |
ColumnConfig<M,?> |
findColumnConfig(String path)
Returns the matching column based on value provider path.
|
void |
fireEvent(<any> event) |
AggregationRowConfig<M> |
getAggregationRow(int rowIndex)
Returns the aggregation row.
|
List<AggregationRowConfig<M>> |
getAggregationRows()
Returns the aggregation rows.
|
<N> <any> |
getCell(int colIndex)
Returns the cell renderer.
|
<N> ColumnConfig<M,N> |
getColumn(int colIndex)
Returns the column at the given index.
|
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.
|
HorizontalAlignmentConstant |
getColumnHorizontalAlignment(int colIndex)
Returns the column's horizontal alignment.
|
HorizontalAlignmentConstant |
getColumnHorizontalHeaderAlignment(int colIndex)
Returns the column's header horizontal alignment.
|
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.
|
VerticalAlignmentConstant |
getColumnVerticalAlignment(int colIndex)
Returns the column's vertical alignment.
|
int |
getColumnWidth(int colIndex)
Returns the column width.
|
protected HeaderGroupConfig |
getGroup(int row,
int column) |
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.
|
protected boolean |
hasGroup(int row,
int column) |
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.
|
boolean |
isUserResized()
Returns true if the user has resized manually.
|
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.
|
void |
setUserResized(boolean userResized)
Set to true to indicate that the user has manually set column sizes.
|
protected List<ColumnConfig<M,?>> configs
protected final List<HeaderGroupConfig> groups
protected final List<AggregationRowConfig<M>> rows
public ColumnModel(List<ColumnConfig<M,?>> list)
list
- the columnspublic void addAggregationRow(AggregationRowConfig<M> row)
row
- the aggregation rowpublic HandlerRegistration addColumnHeaderChangeHandler(ColumnHeaderChangeEvent.ColumnHeaderChangeHandler handler)
addColumnHeaderChangeHandler
in interface ColumnHeaderChangeEvent.HasColumnHeaderChangeHandlers
public HandlerRegistration addColumnHiddenChangeHandler(ColumnHiddenChangeEvent.ColumnHiddenChangeHandler handler)
addColumnHiddenChangeHandler
in interface ColumnHiddenChangeEvent.HasColumnHiddenChangeHandlers
public HandlerRegistration addColumnModelHandlers(ColumnModelHandlers handlers)
addColumnModelHandlers
in interface ColumnModelHandlers.HasColumnModelHandlers
public HandlerRegistration addColumnMoveHandler(ColumnMoveEvent.ColumnMoveHandler handler)
addColumnMoveHandler
in interface ColumnMoveEvent.HasColumnMoveHandlers
public HandlerRegistration addColumnWidthChangeHandler(ColumnWidthChangeEvent.ColumnWidthChangeHandler handler)
addColumnWidthChangeHandler
in interface ColumnWidthChangeEvent.HasColumnWidthChangeHandlers
public void addHeaderGroup(int row, int column, HeaderGroupConfig config)
row
- the rowcolumn
- the columnconfig
- the header group configpublic ColumnConfig<M,?> findColumnConfig(String path)
path
- the pathpublic void fireEvent(<any> event)
public AggregationRowConfig<M> getAggregationRow(int rowIndex)
rowIndex
- the row indexpublic List<AggregationRowConfig<M>> getAggregationRows()
public <N> <any> getCell(int colIndex)
colIndex
- the column indexpublic <N> ColumnConfig<M,N> getColumn(int colIndex)
colIndex
- the column indexpublic HorizontalAlignmentConstant getColumnHorizontalAlignment(int colIndex)
colIndex
- the column indexpublic HorizontalAlignmentConstant getColumnHorizontalHeaderAlignment(int colIndex)
colIndex
- the column indexpublic int getColumnCount()
public int getColumnCount(boolean visibleOnly)
public SafeHtml getColumnHeader(int colIndex)
colIndex
- the column indexpublic List<ColumnConfig<M,?>> getColumns()
public SafeStyles getColumnStyles(int colIndex)
colIndex
- the column indexpublic SafeHtml getColumnToolTip(int colIndex)
colIndex
- the column indexpublic int getColumnWidth(int colIndex)
colIndex
- the column indexpublic List<HeaderGroupConfig> getHeaderGroups()
public int getTotalWidth()
public int getTotalWidth(boolean includeHidden)
includeHidden
- true to include hidden column widthspublic <N> ValueProvider<? super M,N> getValueProvider(int colIndex)
colIndex
- the column indexpublic VerticalAlignmentConstant getColumnVerticalAlignment(int colIndex)
colIndex
- the column indexpublic int indexOf(ColumnConfig<M,?> column)
column
- the columnpublic boolean isFixed(int colIndex)
colIndex
- the column indexpublic boolean isGroupable(int colIndex)
GroupingView
.colIndex
- the column indexpublic boolean isHidden(int colIndex)
colIndex
- the column indexpublic boolean isMenuDisabled(int colIndex)
colIndex
- the column indexpublic boolean isResizable(int colIndex)
colIndex
- the column indexpublic boolean isSortable(int colIndex)
colIndex
- the column indexpublic boolean isUserResized()
public void moveColumn(int oldIndex, int newIndex)
oldIndex
- the column indexnewIndex
- the new column indexpublic void setColumnHeader(int colIndex, SafeHtml header)
colIndex
- the column indexheader
- the headerpublic void setColumnWidth(int colIndex, int width)
colIndex
- the column indexwidth
- the widthpublic void setColumnWidth(int colIndex, int width, boolean suppressEvent)
colIndex
- the column indexwidth
- the widthsuppressEvent
- true to suppress width change eventpublic void setHidden(int colIndex, boolean hidden)
colIndex
- the column indexhidden
- true to hide the columnpublic void setUserResized(boolean userResized)
userResized
- true if the user has manually resizedprotected HandlerManager ensureHandlers()
protected HeaderGroupConfig getGroup(int row, int column)
protected boolean hasGroup(int row, int column)
Copyright © 2018. All rights reserved.