org.eclipse.nebula.widgets.nattable.group
Class ColumnGroupModel

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.group.ColumnGroupModel
All Implemented Interfaces:
IPersistable
Direct Known Subclasses:
ColumnGroupModelFixture

public class ColumnGroupModel
extends Object
implements IPersistable

Tracks: Columns (by index) in a column Group. Does not keep the column indexes in any defined order. Expand/collapse state of the Group. Name of the Column Group (CG)


Nested Class Summary
 class ColumnGroupModel.ColumnGroup
           
 
Field Summary
 
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
 
Constructor Summary
ColumnGroupModel()
           
 
Method Summary
 void addColumnGroup(ColumnGroupModel.ColumnGroup columnGroup)
           
 void addColumnsIndexesToGroup(String colGroupName, int... bodyColumnIndexs)
          Creates the column group if one does not exist with the given name and adds the column indexes to it.
 void clear()
           
 List<Integer> getAllIndexesInGroups()
           
 int getCollapsedColumnCount()
           
 ColumnGroupModel.ColumnGroup getColumnGroupByIndex(int columnIndex)
           
 ColumnGroupModel.ColumnGroup getColumnGroupByName(String groupName)
           
 int getColumnGroupPositionFromIndex(int bodyColumnIndex)
           
 boolean insertColumnIndexes(String colGroupName, int... columnIndexesToInsert)
          This method will add column indexes to an existing group.
 void insertStaticColumnIndexes(String colGroupName, int... columnIndexesToInsert)
          This method will add static column index(s) to an existing group
 boolean isAGroup(String cellValue)
           
 boolean isEmpty()
           
 boolean isPartOfACollapseableGroup(int columnIndex)
          Check if the column at the specified column index belongs to a ColumnGroupModel.ColumnGroup and if this ColumnGroupModel.ColumnGroup is collabseable.
 boolean isPartOfAGroup(int bodyColumnIndex)
           
 boolean isPartOfAnUnbreakableGroup(int columnIndex)
          Check if the column at the specified column index belongs to a ColumnGroupModel.ColumnGroup and if this ColumnGroupModel.ColumnGroup is unbreakable.
 boolean isStaticColumn(int bodyColumnIndex)
           
 void loadState(String prefix, Properties properties)
          Restore the state out of the given Properties identified by the specified prefix.
 void notifyListeners()
           
 void registerColumnGroupModelListener(IColumnGroupModelListener listener)
           
 void removeColumnGroup(ColumnGroupModel.ColumnGroup columnGroup)
           
 boolean removeColumnIndexes(String colGroupName, int... columnIndexesToRemove)
          This method will remove column indexes from an existing group.
 void saveState(String prefix, Properties properties)
          Saves the state to the given Properties using the specified prefix.
 void setColumnGroupCollapseable(int columnIndex, boolean collabseable)
          Set the ColumnGroupModel.ColumnGroup to which the column and the specified column index belongs to, to be collapseable or not.
 void setColumnGroupUnbreakable(int columnIndex, boolean unbreakable)
          Set the ColumnGroupModel.ColumnGroup to which the column and the specified column index belongs to, to be unbreakable/breakable.
 void setStaticColumnIndexesByGroup(String colGroupName, int[] staticColumnIndexes)
          Add static columns identified by staticColumnIndexes to the given columnGroup colGroupName.
 int size()
           
 String toString()
           
 void unregisterColumnGroupModelListener(IColumnGroupModelListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnGroupModel

public ColumnGroupModel()
Method Detail

registerColumnGroupModelListener

public void registerColumnGroupModelListener(IColumnGroupModelListener listener)

unregisterColumnGroupModelListener

public void unregisterColumnGroupModelListener(IColumnGroupModelListener listener)

notifyListeners

public void notifyListeners()

saveState

public void saveState(String prefix,
                      Properties properties)
Description copied from interface: IPersistable
Saves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.

Specified by:
saveState in interface IPersistable
Parameters:
prefix - The prefix to use for the state keys. Is also used as the state configuration name.
properties - The Properties instance to save the state to.

loadState

public void loadState(String prefix,
                      Properties properties)
Description copied from interface: IPersistable
Restore the state out of the given Properties identified by the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.

Specified by:
loadState in interface IPersistable
Parameters:
prefix - The prefix to use for the state keys. Is also used as the state configuration name.
properties - The Properties instance to load the state from.

addColumnsIndexesToGroup

public void addColumnsIndexesToGroup(String colGroupName,
                                     int... bodyColumnIndexs)
Creates the column group if one does not exist with the given name and adds the column indexes to it.

See Also:
insertColumnIndexes(String, int[])

insertColumnIndexes

public boolean insertColumnIndexes(String colGroupName,
                                   int... columnIndexesToInsert)
This method will add column indexes to an existing group.

Parameters:
colGroupName - The name of the column group to which the column indexes should be added to
columnIndexesToInsert - The column indexes to insert.
Returns:
FALSE if: The column group is frozen Index is already s part of a column group

removeColumnIndexes

public boolean removeColumnIndexes(String colGroupName,
                                   int... columnIndexesToRemove)
This method will remove column indexes from an existing group.

Parameters:
colGroupName - The name of the column group from which the column indexes should be removed.
columnIndexesToRemove - The column indexes to remove.
Returns:
true if at least one column was removed from the column group.
Since:
1.3

setStaticColumnIndexesByGroup

public void setStaticColumnIndexesByGroup(String colGroupName,
                                          int[] staticColumnIndexes)
Add static columns identified by staticColumnIndexes to the given columnGroup colGroupName. Static columns remains visible when a column group is collapsed.

Parameters:
colGroupName - to add the indexes to
staticColumnIndexes -

insertStaticColumnIndexes

public void insertStaticColumnIndexes(String colGroupName,
                                      int... columnIndexesToInsert)
This method will add static column index(s) to an existing group

Parameters:
colGroupName - to add the indexes to
columnIndexesToInsert -

getColumnGroupByName

public ColumnGroupModel.ColumnGroup getColumnGroupByName(String groupName)

getColumnGroupByIndex

public ColumnGroupModel.ColumnGroup getColumnGroupByIndex(int columnIndex)

addColumnGroup

public void addColumnGroup(ColumnGroupModel.ColumnGroup columnGroup)

removeColumnGroup

public void removeColumnGroup(ColumnGroupModel.ColumnGroup columnGroup)

isPartOfAGroup

public boolean isPartOfAGroup(int bodyColumnIndex)

isAGroup

public boolean isAGroup(String cellValue)
Returns:
TRUE if a group by this name exists

clear

public void clear()

size

public int size()
Returns:
Number of column Groups in the model.

isEmpty

public boolean isEmpty()
Returns:
TRUE if no column groups exist

getAllIndexesInGroups

public List<Integer> getAllIndexesInGroups()
Returns:
all the indexes which belong to groups

isStaticColumn

public boolean isStaticColumn(int bodyColumnIndex)
Returns:
TRUE if bodyColumnIndex is contained in the list of static columns of the column group this index belongs to

getCollapsedColumnCount

public int getCollapsedColumnCount()
Returns:
Total number of columns hidden for all the collapsed columns.

getColumnGroupPositionFromIndex

public int getColumnGroupPositionFromIndex(int bodyColumnIndex)
Parameters:
bodyColumnIndex -
Returns:
The position of the index within the column group

isPartOfACollapseableGroup

public boolean isPartOfACollapseableGroup(int columnIndex)
Check if the column at the specified column index belongs to a ColumnGroupModel.ColumnGroup and if this ColumnGroupModel.ColumnGroup is collabseable.

Parameters:
columnIndex - The column index used to retrieve the corresponding column group
Returns:
true if the column at the specified column index belongs to a ColumnGroupModel.ColumnGroup and this ColumnGroupModel.ColumnGroup is collabseable, false if not.

setColumnGroupCollapseable

public void setColumnGroupCollapseable(int columnIndex,
                                       boolean collabseable)
Set the ColumnGroupModel.ColumnGroup to which the column and the specified column index belongs to, to be collapseable or not.

Parameters:
columnIndex - The column index used to retrieve the corresponding column group
collabseable - true to set the column group collapseable, false to set it not to be collapseable.

isPartOfAnUnbreakableGroup

public boolean isPartOfAnUnbreakableGroup(int columnIndex)
Check if the column at the specified column index belongs to a ColumnGroupModel.ColumnGroup and if this ColumnGroupModel.ColumnGroup is unbreakable.

Parameters:
columnIndex - The column index used to retrieve the corresponding column group
Returns:
true if the column at the specified column index belongs to a ColumnGroupModel.ColumnGroup and this ColumnGroupModel.ColumnGroup is unbreakable, false if not.

setColumnGroupUnbreakable

public void setColumnGroupUnbreakable(int columnIndex,
                                      boolean unbreakable)
Set the ColumnGroupModel.ColumnGroup to which the column and the specified column index belongs to, to be unbreakable/breakable.

Parameters:
columnIndex - The column index used to retrieve the corresponding column group
unbreakable - true to set the column group unbreakable, false to remove the unbreakable state.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015. All rights reserved.