Class DefaultColumnModel
- java.lang.Object
-
- de.hybris.platform.cockpit.model.listview.impl.AbstractColumnModel
-
- de.hybris.platform.cockpit.model.listview.impl.DefaultColumnModel
-
- All Implemented Interfaces:
ColumnModel,MutableColumnModel
public class DefaultColumnModel extends AbstractColumnModel
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringDEFAULT_WIDTH-
Fields inherited from class de.hybris.platform.cockpit.model.listview.impl.AbstractColumnModel
listeners
-
-
Constructor Summary
Constructors Constructor Description DefaultColumnModel(ListViewConfiguration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColumn(ColumnConfiguration columnConfig, DefaultColumnGroup group)Dynamically adds a column to the specifiedColumnGroupgroupif the group exists.ColumnDescriptoraddColumnToRootGroup(ColumnConfiguration columnConfig)Dynamically adds a column to the rootgroupand returns newly createdColumnDescriptor.ColumnDescriptoraddDynamicColumnToRootGroup(ColumnConfiguration columnConfig)Dynamically adds a column to the rootgroup, mark it as "dynamic" and returns newly createdColumnDescriptor.voidaddGroup(ColumnGroup group, DefaultColumnGroup parentGroup)Dynamically adds the groupgroupto the specified groupparentGroupif the parent group exists.intfindColumn(ColumnDescriptor colDescr)Returns the index of the column represented bycolDescror-1protected voidfireColumnMoved(int fromIndex, int toIndex)protected voidfireColumnVisibilityChanged()protected voidfireColumnVisibilityChanged(java.lang.Integer colIndex)protected voidfireSortChanged(int columnIndex, boolean ascending)UIEditorgetCellEditor(int columnIndex)Gets the cell editor.CellRenderergetCellRenderer(int columnIndex)Gets the cell renderer.ColumnDescriptorgetColumn(int columnIndex)Returns the column with indexcolumnIndex.ColumnConfigurationgetColumnConfiguration(ColumnDescriptor columnDescriptor)java.util.List<ColumnDescriptor>getColumns()Returns all columns (visible and hidden) held by this model.java.lang.StringgetColumnWidth(ColumnDescriptor colDescr)Gets the column width.java.lang.StringgetColumnWidth(ColumnDescriptor colDescr, java.lang.Boolean returnDefault)Gets the column width.ListViewConfigurationgetConfiguration()java.util.List<ColumnDescriptor>getHiddenColumns()Returns all the columns which are currently marked as invisible.java.util.List<ColumnDescriptor>getHiddenLocalizedColumns(ColumnDescriptor colDescr)Gets the hidden localized columns.ColumnDescriptorgetLocalizedColumn(ColumnDescriptor colDescr, LanguageModel language)Gets the localized column.protected java.util.List<ColumnDescriptor>getLocalizedColumns(ColumnDescriptor colDescr)ListViewMenuPopupBuildergetMenuPopupBuilder()Gets the menu popup builder which is responsible for building table header menu popups.CellRenderergetNewInlineItemRenderer(int columnIndex)Gets the new inline item renderer.protected ColumnDescriptorgetNonLocalizedColumn(ColumnDescriptor colDescr)PropertyDescriptorgetPropertyDescriptor(ColumnDescriptor colDescr)Returns the property descriptor for a specific column.ColumnGroupgetRootColumnGroup()Returns the rootColumnGroupi.e.intgetSelectedIndex()Returns the index of the currently selected column.java.util.List<java.lang.Integer>getSelectedIndexes()Returns the indexes of the currently selected columns.intgetSortedByColumnIndex()Returns the index of the column by which values are currently sorted.java.lang.ObjectgetValueAt(int columnIndex, TypedObject object)Returns the value of the specified object's cell.ColumnDescriptorgetVisibleColumn(int columnIndex)Returns the visible column at positioncolumnIndex.java.util.List<ColumnDescriptor>getVisibleColumns()Returns all the columns which are currently marked as visible.java.util.List<ColumnDescriptor>getVisibleLocalizedColumns(ColumnDescriptor colDescr)Gets the visible localized columns.booleanhideColumn(int columnIndex)Hide column.booleanisColumnLocalized(ColumnDescriptor colDescr)Checks if is column localized.booleanisColumnSelected(int columnIndex)Returns whether the column with indexcolumnIndexis selected or not.booleanisSortAscending()Returns the sort order of the column by which values are currently sorted.booleanmoveColumn(int fromIndex, int toIndex)Move column.voidsetSelectedIndex(int index)Sets the selected index.booleansetSelectedIndexDirectly(int index)Sets the selected index directly.voidsetSelectedIndexes(java.util.List<java.lang.Integer> indexes)Sets the selected indexes.booleansetSelectedIndexesDirectly(java.util.List<java.lang.Integer> indexes)Sets the selected indexes directly.voidsetSortAscending(boolean ascending)Sets the sort ascending.voidsetSortedColumnIndex(int columnIndex, boolean ascending)Sets the sorted column index.voidsetValueAt(int columnIndex, TypedObject object, java.lang.Object value)Sets the value at.voidsetVisibleColumns(java.util.List<ColumnDescriptor> columns, boolean force)Sets the visible columns.booleanshowColumn(ColumnDescriptor column, java.lang.Integer colIndex)Show column.protected booleanshowColumnDirectly(ColumnDescriptor column)protected voidupdateConfiguration()voidupdateDynamicColumns(ListModel listModel)Update dynamic columns.-
Methods inherited from class de.hybris.platform.cockpit.model.listview.impl.AbstractColumnModel
addColumnModelListener, fireChanged, fireColumnSelectionChanged, removeColumnModelListener
-
-
-
-
Field Detail
-
DEFAULT_WIDTH
protected static final java.lang.String DEFAULT_WIDTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultColumnModel
public DefaultColumnModel(ListViewConfiguration config)
-
-
Method Detail
-
getConfiguration
public ListViewConfiguration getConfiguration()
-
getColumnConfiguration
public ColumnConfiguration getColumnConfiguration(ColumnDescriptor columnDescriptor)
-
setSelectedIndex
public void setSelectedIndex(int index)
Description copied from interface:MutableColumnModelSets the selected index.- Parameters:
index- the new selected index
-
setSelectedIndexDirectly
public boolean setSelectedIndexDirectly(int index)
Description copied from interface:MutableColumnModelSets the selected index directly.- Parameters:
index- the index- Returns:
- true, if successful
-
setSelectedIndexes
public void setSelectedIndexes(java.util.List<java.lang.Integer> indexes)
Description copied from interface:MutableColumnModelSets the selected indexes.- Parameters:
indexes- the new selected indexes
-
setSelectedIndexesDirectly
public boolean setSelectedIndexesDirectly(java.util.List<java.lang.Integer> indexes)
Description copied from interface:MutableColumnModelSets the selected indexes directly.- Parameters:
indexes- the selected indexes- Returns:
- true, if successful
-
setVisibleColumns
public void setVisibleColumns(java.util.List<ColumnDescriptor> columns, boolean force)
Description copied from interface:MutableColumnModelSets the visible columns.- Parameters:
columns- the vis colsforce- the force
-
hideColumn
public boolean hideColumn(int columnIndex)
Description copied from interface:MutableColumnModelHide column.- Parameters:
columnIndex- the col index- Returns:
- true, if successful
-
showColumn
public boolean showColumn(ColumnDescriptor column, java.lang.Integer colIndex)
Description copied from interface:MutableColumnModelShow column.- Parameters:
column- the col descrcolIndex- the col index- Returns:
- true, if successful
-
showColumnDirectly
protected boolean showColumnDirectly(ColumnDescriptor column)
-
getPropertyDescriptor
public PropertyDescriptor getPropertyDescriptor(ColumnDescriptor colDescr)
Returns the property descriptor for a specific column.- Parameters:
colDescr- the col descr- Returns:
- the
PropertyDescriptorwhich the columncolDescrrepresents ornullif the column does not represent a property column
-
moveColumn
public boolean moveColumn(int fromIndex, int toIndex)Description copied from interface:MutableColumnModelMove column.- Parameters:
fromIndex- the from indextoIndex- the to index- Returns:
- true, if successful
-
getSortedByColumnIndex
public int getSortedByColumnIndex()
Description copied from interface:ColumnModelReturns the index of the column by which values are currently sorted.- Returns:
- zero based position index of the column by which values are currently sorted
- See Also:
ColumnModel.isSortAscending()
-
setSortedColumnIndex
public void setSortedColumnIndex(int columnIndex, boolean ascending)Description copied from interface:MutableColumnModelSets the sorted column index.- Parameters:
columnIndex- the col indexascending- the ascending
-
setSortAscending
public void setSortAscending(boolean ascending)
Description copied from interface:MutableColumnModelSets the sort ascending.- Parameters:
ascending- the new sort ascending
-
isSortAscending
public boolean isSortAscending()
Description copied from interface:ColumnModelReturns the sort order of the column by which values are currently sorted.- Returns:
trueif the sort order is ascending,falseotherwise- See Also:
ColumnModel.getSortedByColumnIndex()
-
findColumn
public int findColumn(ColumnDescriptor colDescr)
Description copied from interface:ColumnModelReturns the index of the column represented bycolDescror-1- Parameters:
colDescr- column which index should be retrieved- Returns:
- the zero based position index of the column with the specified name
-
getColumn
public ColumnDescriptor getColumn(int columnIndex)
Description copied from interface:ColumnModelReturns the column with indexcolumnIndex.- Parameters:
columnIndex- the zero based position index of column to be returned- Returns:
- the column at position
columnIndex - See Also:
ColumnModel.getVisibleColumn(int)
-
getVisibleColumn
public ColumnDescriptor getVisibleColumn(int columnIndex)
Description copied from interface:ColumnModelReturns the visible column at positioncolumnIndex.- Parameters:
columnIndex- the zero based position index of the visible column to be returned- Returns:
- the visible column at position
columnIndex - See Also:
ColumnModel.getColumn(int)
-
getColumns
public java.util.List<ColumnDescriptor> getColumns()
Description copied from interface:ColumnModelReturns all columns (visible and hidden) held by this model.- Returns:
- all the columns held by this model
-
getRootColumnGroup
public ColumnGroup getRootColumnGroup()
Description copied from interface:ColumnModelReturns the rootColumnGroupi.e. the column group which holds all other groups and columns, held by this model.- Returns:
- the root column group node held by this model
-
getSelectedIndex
public int getSelectedIndex()
Description copied from interface:ColumnModelReturns the index of the currently selected column.- Returns:
- zero based position index of the currently selected column
-
getSelectedIndexes
public java.util.List<java.lang.Integer> getSelectedIndexes()
Description copied from interface:ColumnModelReturns the indexes of the currently selected columns.- Returns:
- a list containing zero based position indexes of the currently selected columns
-
getVisibleColumns
public java.util.List<ColumnDescriptor> getVisibleColumns()
Description copied from interface:ColumnModelReturns all the columns which are currently marked as visible.- Returns:
- all the visible columns
-
getHiddenColumns
public java.util.List<ColumnDescriptor> getHiddenColumns()
Description copied from interface:ColumnModelReturns all the columns which are currently marked as invisible.- Returns:
- all the hidden columns
-
isColumnSelected
public boolean isColumnSelected(int columnIndex)
Description copied from interface:ColumnModelReturns whether the column with indexcolumnIndexis selected or not.- Parameters:
columnIndex- zero based position index of the column which selection status is to be retrieved- Returns:
trueif a column at positioncolumnIndexexists and is marked as selected,falseotherwise
-
getValueAt
public java.lang.Object getValueAt(int columnIndex, TypedObject object)Description copied from interface:ColumnModelReturns the value of the specified object's cell.- Parameters:
columnIndex- zero based column position index of the cell which value is to be returnedobject- the object which cell's value is to be returned- Returns:
- the value at
-
setValueAt
public void setValueAt(int columnIndex, TypedObject object, java.lang.Object value) throws ValueHandlerExceptionDescription copied from interface:MutableColumnModelSets the value at.- Parameters:
columnIndex- the col indexobject- the itemvalue- the value- Throws:
ValueHandlerException- the value handler exception
-
getCellEditor
public UIEditor getCellEditor(int columnIndex)
Description copied from interface:ColumnModelGets the cell editor.- Parameters:
columnIndex- the column index- Returns:
- the cell editor
-
getCellRenderer
public CellRenderer getCellRenderer(int columnIndex)
Description copied from interface:ColumnModelGets the cell renderer.- Parameters:
columnIndex- the column index- Returns:
- the cell renderer
-
getNewInlineItemRenderer
public CellRenderer getNewInlineItemRenderer(int columnIndex)
Description copied from interface:ColumnModelGets the new inline item renderer.- Parameters:
columnIndex- the column index- Returns:
- the new inline item render
-
addColumn
public void addColumn(ColumnConfiguration columnConfig, DefaultColumnGroup group)
Dynamically adds a column to the specifiedColumnGroupgroupif the group exists.- Parameters:
columnConfig- the column to addgroup- the group to which the column is to be added
-
addColumnToRootGroup
public ColumnDescriptor addColumnToRootGroup(ColumnConfiguration columnConfig)
Dynamically adds a column to the rootgroupand returns newly createdColumnDescriptor.- Parameters:
columnConfig- the column config- Returns:
- the column descriptor
-
addDynamicColumnToRootGroup
public ColumnDescriptor addDynamicColumnToRootGroup(ColumnConfiguration columnConfig)
Dynamically adds a column to the rootgroup, mark it as "dynamic" and returns newly createdColumnDescriptor.- Parameters:
columnConfig- the column config- Returns:
- the column descriptor
-
addGroup
public void addGroup(ColumnGroup group, DefaultColumnGroup parentGroup)
Dynamically adds the groupgroupto the specified groupparentGroupif the parent group exists.- Parameters:
group- the group to addparentGroup- the parent group to which the group is to be added
-
getHiddenLocalizedColumns
public java.util.List<ColumnDescriptor> getHiddenLocalizedColumns(ColumnDescriptor colDescr)
Description copied from interface:ColumnModelGets the hidden localized columns.- Parameters:
colDescr- the col descr- Returns:
- the hidden localized columns
-
getVisibleLocalizedColumns
public java.util.List<ColumnDescriptor> getVisibleLocalizedColumns(ColumnDescriptor colDescr)
Description copied from interface:ColumnModelGets the visible localized columns.- Parameters:
colDescr- the col descr- Returns:
- the visible localized columns
-
isColumnLocalized
public boolean isColumnLocalized(ColumnDescriptor colDescr)
Description copied from interface:ColumnModelChecks if is column localized.- Parameters:
colDescr- the col descr- Returns:
- true, if is column localized
-
getLocalizedColumn
public ColumnDescriptor getLocalizedColumn(ColumnDescriptor colDescr, LanguageModel language)
Description copied from interface:ColumnModelGets the localized column.- Parameters:
colDescr- the col descrlanguage- the lang- Returns:
- the localized column
-
getLocalizedColumns
protected java.util.List<ColumnDescriptor> getLocalizedColumns(ColumnDescriptor colDescr)
-
getNonLocalizedColumn
protected ColumnDescriptor getNonLocalizedColumn(ColumnDescriptor colDescr)
-
getColumnWidth
public java.lang.String getColumnWidth(ColumnDescriptor colDescr)
Description copied from interface:ColumnModelGets the column width.- Parameters:
colDescr- the col descr- Returns:
- the column width
-
getColumnWidth
public java.lang.String getColumnWidth(ColumnDescriptor colDescr, java.lang.Boolean returnDefault)
Description copied from interface:ColumnModelGets the column width.- Parameters:
colDescr- the col descrreturnDefault- the return default- Returns:
- the column width
-
updateConfiguration
protected void updateConfiguration()
-
fireColumnMoved
protected void fireColumnMoved(int fromIndex, int toIndex)- Overrides:
fireColumnMovedin classAbstractColumnModel
-
fireColumnVisibilityChanged
protected void fireColumnVisibilityChanged()
- Overrides:
fireColumnVisibilityChangedin classAbstractColumnModel
-
fireColumnVisibilityChanged
protected void fireColumnVisibilityChanged(java.lang.Integer colIndex)
- Overrides:
fireColumnVisibilityChangedin classAbstractColumnModel
-
fireSortChanged
protected void fireSortChanged(int columnIndex, boolean ascending)- Overrides:
fireSortChangedin classAbstractColumnModel
-
getMenuPopupBuilder
public ListViewMenuPopupBuilder getMenuPopupBuilder()
Description copied from interface:ColumnModelGets the menu popup builder which is responsible for building table header menu popups.- Returns:
- the menu popup builder
-
updateDynamicColumns
public void updateDynamicColumns(ListModel listModel)
Description copied from interface:MutableColumnModelUpdate dynamic columns.- Parameters:
listModel- the list model
-
-