Package com.inmethod.grid.common
Class ColumnsState
java.lang.Object
com.inmethod.grid.common.ColumnsState
- All Implemented Interfaces:
Serializable
,Cloneable
,IClusterable
Manages the state (visibility, order and size) of grid columns.
- Author:
- Matej Knopp
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionColumnsState
(ColumnsState.Entry[] columnStates) Creates newColumnsState
instance.ColumnsState
(Collection<IGridColumn<M, I, S>> columns) Creates newColumnsState
instance. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns deep copy of the object.Returns collection ofColumnsState.Entry
instances of thisColumnsState
.boolean
Returns the visibility of given column.int
getColumnWidth
(String id) Returns the width of column with specified id.Returns theColumnsState.Entry
instance for column with give id, or null if the entry doesn't exist.<M,
I, S> Collection<IGridColumn<M, I, S>> getVisibleColumns
(Collection<IGridColumn<M, I, S>> allColumns) Filters the givenIGridColumn
collection leaving only the columns with visibility set totrue
.void
setColumnIndex
(String id, int newIndex) Moves the column with specified to specified position.void
setColumnVisibility
(String id, boolean newValue) Sets the visibility of column with given id.void
setColumnWidth
(String id, int newWidth) Sets the width of column with specified id.
-
Constructor Details
-
ColumnsState
Creates newColumnsState
instance. The state will be initialized from the specified collection ofIGridColumn
s.- Parameters:
columns
-
-
ColumnsState
Creates newColumnsState
instance. The instance will be initialized from the specifiedColumnsState.Entry
array.- Parameters:
columnStates
-
-
-
Method Details
-
getEntry
Returns theColumnsState.Entry
instance for column with give id, or null if the entry doesn't exist.- Parameters:
id
- column id- Returns:
- entry or null
-
setColumnWidth
Sets the width of column with specified id.- Parameters:
id
- column idnewWidth
- new width or -1 if initial column width should be used
-
getColumnWidth
Returns the width of column with specified id.- Parameters:
id
- column id- Returns:
- column width or -1 if initial width should be used
-
setColumnVisibility
Sets the visibility of column with given id.- Parameters:
id
- column idnewValue
-
-
getColumnVisibility
Returns the visibility of given column.- Parameters:
id
- column id- Returns:
true
if the column is visible,false
otherwise
-
getColumnStates
Returns collection ofColumnsState.Entry
instances of thisColumnsState
.- Returns:
- collection of
ColumnsState.Entry
instances
-
setColumnIndex
Moves the column with specified to specified position. If the position is out of range throwsIndexOutOfBoundsException
. If the column with given id is not found, throws anIllegalStateException
. The other columns are shifted accordingly.- Parameters:
id
- column idnewIndex
- new column index
-
clone
Returns deep copy of the object.- Overrides:
clone
in classObject
- Returns:
ColumnsState
instance that is a deep copy of this instance
-
getVisibleColumns
public <M,I, Collection<IGridColumn<M,S> I, getVisibleColumnsS>> (Collection<IGridColumn<M, I, S>> allColumns) Filters the givenIGridColumn
collection leaving only the columns with visibility set totrue
.- Parameters:
allColumns
- Collection to be filtered.- Returns:
- Collection of columns with visibility set to
true
.
-