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.String
DEFAULT_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 void
addColumn(ColumnConfiguration columnConfig, DefaultColumnGroup group)
Dynamically adds a column to the specifiedColumnGroup
group
if the group exists.ColumnDescriptor
addColumnToRootGroup(ColumnConfiguration columnConfig)
Dynamically adds a column to the rootgroup
and returns newly createdColumnDescriptor
.ColumnDescriptor
addDynamicColumnToRootGroup(ColumnConfiguration columnConfig)
Dynamically adds a column to the rootgroup
, mark it as "dynamic" and returns newly createdColumnDescriptor
.void
addGroup(ColumnGroup group, DefaultColumnGroup parentGroup)
Dynamically adds the groupgroup
to the specified groupparentGroup
if the parent group exists.int
findColumn(ColumnDescriptor colDescr)
Returns the index of the column represented bycolDescr
or-1
protected void
fireColumnMoved(int fromIndex, int toIndex)
protected void
fireColumnVisibilityChanged()
protected void
fireColumnVisibilityChanged(java.lang.Integer colIndex)
protected void
fireSortChanged(int columnIndex, boolean ascending)
UIEditor
getCellEditor(int columnIndex)
Gets the cell editor.CellRenderer
getCellRenderer(int columnIndex)
Gets the cell renderer.ColumnDescriptor
getColumn(int columnIndex)
Returns the column with indexcolumnIndex
.ColumnConfiguration
getColumnConfiguration(ColumnDescriptor columnDescriptor)
java.util.List<ColumnDescriptor>
getColumns()
Returns all columns (visible and hidden) held by this model.java.lang.String
getColumnWidth(ColumnDescriptor colDescr)
Gets the column width.java.lang.String
getColumnWidth(ColumnDescriptor colDescr, java.lang.Boolean returnDefault)
Gets the column width.ListViewConfiguration
getConfiguration()
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.ColumnDescriptor
getLocalizedColumn(ColumnDescriptor colDescr, LanguageModel language)
Gets the localized column.protected java.util.List<ColumnDescriptor>
getLocalizedColumns(ColumnDescriptor colDescr)
ListViewMenuPopupBuilder
getMenuPopupBuilder()
Gets the menu popup builder which is responsible for building table header menu popups.CellRenderer
getNewInlineItemRenderer(int columnIndex)
Gets the new inline item renderer.protected ColumnDescriptor
getNonLocalizedColumn(ColumnDescriptor colDescr)
PropertyDescriptor
getPropertyDescriptor(ColumnDescriptor colDescr)
Returns the property descriptor for a specific column.ColumnGroup
getRootColumnGroup()
Returns the rootColumnGroup
i.e.int
getSelectedIndex()
Returns the index of the currently selected column.java.util.List<java.lang.Integer>
getSelectedIndexes()
Returns the indexes of the currently selected columns.int
getSortedByColumnIndex()
Returns the index of the column by which values are currently sorted.java.lang.Object
getValueAt(int columnIndex, TypedObject object)
Returns the value of the specified object's cell.ColumnDescriptor
getVisibleColumn(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.boolean
hideColumn(int columnIndex)
Hide column.boolean
isColumnLocalized(ColumnDescriptor colDescr)
Checks if is column localized.boolean
isColumnSelected(int columnIndex)
Returns whether the column with indexcolumnIndex
is selected or not.boolean
isSortAscending()
Returns the sort order of the column by which values are currently sorted.boolean
moveColumn(int fromIndex, int toIndex)
Move column.void
setSelectedIndex(int index)
Sets the selected index.boolean
setSelectedIndexDirectly(int index)
Sets the selected index directly.void
setSelectedIndexes(java.util.List<java.lang.Integer> indexes)
Sets the selected indexes.boolean
setSelectedIndexesDirectly(java.util.List<java.lang.Integer> indexes)
Sets the selected indexes directly.void
setSortAscending(boolean ascending)
Sets the sort ascending.void
setSortedColumnIndex(int columnIndex, boolean ascending)
Sets the sorted column index.void
setValueAt(int columnIndex, TypedObject object, java.lang.Object value)
Sets the value at.void
setVisibleColumns(java.util.List<ColumnDescriptor> columns, boolean force)
Sets the visible columns.boolean
showColumn(ColumnDescriptor column, java.lang.Integer colIndex)
Show column.protected boolean
showColumnDirectly(ColumnDescriptor column)
protected void
updateConfiguration()
void
updateDynamicColumns(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:MutableColumnModel
Sets the selected index.- Parameters:
index
- the new selected index
-
setSelectedIndexDirectly
public boolean setSelectedIndexDirectly(int index)
Description copied from interface:MutableColumnModel
Sets 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:MutableColumnModel
Sets the selected indexes.- Parameters:
indexes
- the new selected indexes
-
setSelectedIndexesDirectly
public boolean setSelectedIndexesDirectly(java.util.List<java.lang.Integer> indexes)
Description copied from interface:MutableColumnModel
Sets 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:MutableColumnModel
Sets the visible columns.- Parameters:
columns
- the vis colsforce
- the force
-
hideColumn
public boolean hideColumn(int columnIndex)
Description copied from interface:MutableColumnModel
Hide column.- Parameters:
columnIndex
- the col index- Returns:
- true, if successful
-
showColumn
public boolean showColumn(ColumnDescriptor column, java.lang.Integer colIndex)
Description copied from interface:MutableColumnModel
Show 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
PropertyDescriptor
which the columncolDescr
represents ornull
if the column does not represent a property column
-
moveColumn
public boolean moveColumn(int fromIndex, int toIndex)
Description copied from interface:MutableColumnModel
Move column.- Parameters:
fromIndex
- the from indextoIndex
- the to index- Returns:
- true, if successful
-
getSortedByColumnIndex
public int getSortedByColumnIndex()
Description copied from interface:ColumnModel
Returns 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:MutableColumnModel
Sets the sorted column index.- Parameters:
columnIndex
- the col indexascending
- the ascending
-
setSortAscending
public void setSortAscending(boolean ascending)
Description copied from interface:MutableColumnModel
Sets the sort ascending.- Parameters:
ascending
- the new sort ascending
-
isSortAscending
public boolean isSortAscending()
Description copied from interface:ColumnModel
Returns the sort order of the column by which values are currently sorted.- Returns:
true
if the sort order is ascending,false
otherwise- See Also:
ColumnModel.getSortedByColumnIndex()
-
findColumn
public int findColumn(ColumnDescriptor colDescr)
Description copied from interface:ColumnModel
Returns the index of the column represented bycolDescr
or-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:ColumnModel
Returns 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:ColumnModel
Returns 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:ColumnModel
Returns 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:ColumnModel
Returns the rootColumnGroup
i.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:ColumnModel
Returns 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:ColumnModel
Returns 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:ColumnModel
Returns 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:ColumnModel
Returns all the columns which are currently marked as invisible.- Returns:
- all the hidden columns
-
isColumnSelected
public boolean isColumnSelected(int columnIndex)
Description copied from interface:ColumnModel
Returns whether the column with indexcolumnIndex
is selected or not.- Parameters:
columnIndex
- zero based position index of the column which selection status is to be retrieved- Returns:
true
if a column at positioncolumnIndex
exists and is marked as selected,false
otherwise
-
getValueAt
public java.lang.Object getValueAt(int columnIndex, TypedObject object)
Description copied from interface:ColumnModel
Returns 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 ValueHandlerException
Description copied from interface:MutableColumnModel
Sets 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:ColumnModel
Gets the cell editor.- Parameters:
columnIndex
- the column index- Returns:
- the cell editor
-
getCellRenderer
public CellRenderer getCellRenderer(int columnIndex)
Description copied from interface:ColumnModel
Gets the cell renderer.- Parameters:
columnIndex
- the column index- Returns:
- the cell renderer
-
getNewInlineItemRenderer
public CellRenderer getNewInlineItemRenderer(int columnIndex)
Description copied from interface:ColumnModel
Gets 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 specifiedColumnGroup
group
if 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 rootgroup
and 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 groupgroup
to the specified groupparentGroup
if 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:ColumnModel
Gets 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:ColumnModel
Gets the visible localized columns.- Parameters:
colDescr
- the col descr- Returns:
- the visible localized columns
-
isColumnLocalized
public boolean isColumnLocalized(ColumnDescriptor colDescr)
Description copied from interface:ColumnModel
Checks 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:ColumnModel
Gets 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:ColumnModel
Gets 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:ColumnModel
Gets 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:
fireColumnMoved
in classAbstractColumnModel
-
fireColumnVisibilityChanged
protected void fireColumnVisibilityChanged()
- Overrides:
fireColumnVisibilityChanged
in classAbstractColumnModel
-
fireColumnVisibilityChanged
protected void fireColumnVisibilityChanged(java.lang.Integer colIndex)
- Overrides:
fireColumnVisibilityChanged
in classAbstractColumnModel
-
fireSortChanged
protected void fireSortChanged(int columnIndex, boolean ascending)
- Overrides:
fireSortChanged
in classAbstractColumnModel
-
getMenuPopupBuilder
public ListViewMenuPopupBuilder getMenuPopupBuilder()
Description copied from interface:ColumnModel
Gets 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:MutableColumnModel
Update dynamic columns.- Parameters:
listModel
- the list model
-
-