JIDE 3.5.15

com.jidesoft.grid
Class DefaultGroupRow

java.lang.Object
  extended by com.jidesoft.grid.AbstractNode
      extended by com.jidesoft.grid.AbstractExpandable
          extended by com.jidesoft.grid.DefaultExpandable
              extended by com.jidesoft.grid.DefaultExpandableRow
                  extended by com.jidesoft.grid.DefaultGroupRow
All Implemented Interfaces:
Cacheable, Expandable, ExpandableRow, GroupCondition, GroupRow, Node, Row, Comparable

public class DefaultGroupRow
extends DefaultExpandableRow
implements GroupRow, GroupCondition, Comparable, Cacheable

Default implementation for GroupRow. This implementation implements both GroupRow and GroupCondition.


Field Summary
 
Fields inherited from class com.jidesoft.grid.DefaultExpandable
_children, EMPTY_ENUMERATION, PROPERTY_CHILDREN
 
Fields inherited from class com.jidesoft.grid.AbstractExpandable
_expandable, _expanded
 
Fields inherited from class com.jidesoft.grid.AbstractNode
_parent, PROPERTY_PARENT
 
Fields inherited from interface com.jidesoft.grid.Node
PROPERTY_ADJUSTING
 
Fields inherited from interface com.jidesoft.grid.Cacheable
INVALID_VALUE
 
Fields inherited from interface com.jidesoft.grid.Expandable
PROPERTY_EXPANDABLE, PROPERTY_EXPANDED
 
Constructor Summary
DefaultGroupRow()
           
 
Method Summary
 void addCondition(int columnIndex, Object value)
           
 void addCondition(int columnIndex, Object value, ObjectGrouper grouper)
           
 void clearConditions()
           
 int compareTo(Object o)
           
 GroupCondition configureParentCondition(GroupCondition condition)
          Configure the condition that immediately contains this condition.
 boolean contains(GroupCondition c)
          Checks if the specified condition is contained in this condition.
 Object getCachedValue()
          Gets the cached value.
 Class<?> getCellClassAt(int columnIndex)
          Gets the type for the cell at columnIndex.
 int getConditionColumn(int index)
           
 Object getConditionValue(int index)
          Gets the condition value.
 Object getConditionValueAsString(int index)
           
 ConverterContext getConverterContextAt(int columnIndex)
          Gets the converter context for the cell at columnIndex.
 int getNumberOfConditions()
          Gets the number of conditions.
 TreeTableModel getTreeTableModel()
           
 Object getValueAt(int columnIndex)
          Gets the value for cell at columnIndex
 void invalidateCache()
          Invalidates the cache.
 void invalidateCache(Object key)
          Invalidates the cached value which matches the key.
 boolean isCacheValid()
          Checks if the cache is valid.
 boolean removeChild(Object child)
          Removes a child.
 void removeCondition(int columnIndex)
           
 boolean satisfies(TableModel model, int rowIndex)
          Checks if a row in the table model satisfies the condition specified by this GroupCondition.
 void setCachedValue(Object value)
          Sets the cached value.
 String toString()
          Converts the group row to string.
 
Methods inherited from class com.jidesoft.grid.DefaultExpandableRow
cellUpdated, getEditorContextAt, isCellEditable, notifyCellUpdated, rowUpdated, setValueAt
 
Methods inherited from class com.jidesoft.grid.DefaultExpandable
breadthFirstEnumeration, depthFirstEnumeration, getChildren, postorderEnumeration, preorderEnumeration, setChildren
 
Methods inherited from class com.jidesoft.grid.AbstractExpandable
addChild, addChild, addChildren, getAllChildrenCount, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildrenCount, getNumberOfVisibleChildren, getNumberOfVisibleExpandable, hasChildren, hasVisibleChildren, isAdjusting, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildDeleted, notifyChildInserted, notifyChildrenDeleted, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, removeAllChildren, removeChildren, setAdjusting, setExpandable, setExpanded
 
Methods inherited from class com.jidesoft.grid.AbstractNode
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, getLevel, getNextSibling, getParent, getPreviousSibling, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jidesoft.grid.Row
cellUpdated, getEditorContextAt, isCellEditable, rowUpdated, setValueAt
 
Methods inherited from interface com.jidesoft.grid.Node
getLevel, getNextSibling, getParent, getPreviousSibling, setParent
 
Methods inherited from interface com.jidesoft.grid.Expandable
addChild, addChild, addChildren, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildren, getChildrenCount, getNumberOfVisibleExpandable, hasChildren, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildDeleted, notifyChildInserted, notifyChildrenDeleted, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, removeAllChildren, removeChildren, setChildren, setExpandable, setExpanded
 

Constructor Detail

DefaultGroupRow

public DefaultGroupRow()
Method Detail

addCondition

public void addCondition(int columnIndex,
                         Object value)

addCondition

public void addCondition(int columnIndex,
                         Object value,
                         ObjectGrouper grouper)

removeCondition

public void removeCondition(int columnIndex)

clearConditions

public void clearConditions()

getConditionValueAsString

public Object getConditionValueAsString(int index)

getConverterContextAt

public ConverterContext getConverterContextAt(int columnIndex)
Description copied from interface: Row
Gets the converter context for the cell at columnIndex.

Specified by:
getConverterContextAt in interface Row
Overrides:
getConverterContextAt in class DefaultExpandableRow
Parameters:
columnIndex - the column index
Returns:
the converter context for the specified cell.

getCellClassAt

public Class<?> getCellClassAt(int columnIndex)
Description copied from interface: Row
Gets the type for the cell at columnIndex.

Specified by:
getCellClassAt in interface Row
Overrides:
getCellClassAt in class DefaultExpandableRow
Parameters:
columnIndex - the column index
Returns:
the type for the specified cell.

getConditionValue

public Object getConditionValue(int index)
Description copied from interface: GroupCondition
Gets the condition value.

Specified by:
getConditionValue in interface GroupCondition
Parameters:
index - the index of the condition.
Returns:
the value of the condition.

getConditionColumn

public int getConditionColumn(int index)

getNumberOfConditions

public int getNumberOfConditions()
Description copied from interface: GroupCondition
Gets the number of conditions.

Specified by:
getNumberOfConditions in interface GroupCondition
Returns:
the number of conditions.

satisfies

public boolean satisfies(TableModel model,
                         int rowIndex)
Description copied from interface: GroupCondition
Checks if a row in the table model satisfies the condition specified by this GroupCondition.

Specified by:
satisfies in interface GroupCondition
Parameters:
model - the table model.
rowIndex - the row index.
Returns:
true if the row in the table model satisfies the group condition. Otherwise false.

configureParentCondition

public GroupCondition configureParentCondition(GroupCondition condition)
Description copied from interface: GroupCondition
Configure the condition that immediately contains this condition.

Specified by:
configureParentCondition in interface GroupCondition
Parameters:
condition - the condition to be configured.
Returns:
the parent condition. Null if the condition is a top level condition.

contains

public boolean contains(GroupCondition c)
Description copied from interface: GroupCondition
Checks if the specified condition is contained in this condition.

Specified by:
contains in interface GroupCondition
Parameters:
c - the condition to check.
Returns:
true if this condition is a super set of the condition c. Otherwise false.

getValueAt

public Object getValueAt(int columnIndex)
Description copied from interface: Row
Gets the value for cell at columnIndex

Specified by:
getValueAt in interface Row
Parameters:
columnIndex - the column whose value to be queried
Returns:
the value at the specified cell.

removeChild

public boolean removeChild(Object child)
Description copied from class: AbstractExpandable
Removes a child.

Specified by:
removeChild in interface Expandable
Overrides:
removeChild in class AbstractExpandable
Parameters:
child - child to be removed.
Returns:
true if child is removed successfully. If the child doesn't exist in the children list, return false.

getTreeTableModel

public TreeTableModel getTreeTableModel()
Specified by:
getTreeTableModel in interface GroupRow
Overrides:
getTreeTableModel in class AbstractExpandable

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getCachedValue

public Object getCachedValue()
Description copied from interface: Cacheable
Gets the cached value.

Specified by:
getCachedValue in interface Cacheable
Returns:
the cached value.

setCachedValue

public void setCachedValue(Object value)
Description copied from interface: Cacheable
Sets the cached value.

Specified by:
setCachedValue in interface Cacheable
Parameters:
value - the new cached value.

isCacheValid

public boolean isCacheValid()
Description copied from interface: Cacheable
Checks if the cache is valid. Cacheable.invalidateCache() will make this method return false.

Specified by:
isCacheValid in interface Cacheable
Returns:
true if valid.

invalidateCache

public void invalidateCache()
Description copied from interface: Cacheable
Invalidates the cache. It just set the cached value to Cacheable.INVALID_VALUE.

Specified by:
invalidateCache in interface Cacheable

invalidateCache

public void invalidateCache(Object key)
Description copied from interface: Cacheable
Invalidates the cached value which matches the key. It just set the cached value to Cacheable.INVALID_VALUE if current cached value matches the key.

Specified by:
invalidateCache in interface Cacheable
Parameters:
key - the key

toString

public String toString()
Converts the group row to string. Here is the default code. See below for the default code we used.
 StringBuffer buf = new StringBuffer();
 DefaultGroupTableModel defaultGroupTableModel = (DefaultGroupTableModel) getTreeTableModel();
 for (int i = 0; i < getNumberOfConditions(); i++) {
     buf.append(" ");
 

if (defaultGroupTableModel.isSingleLevelGrouping() || i == getNumberOfConditions() - 1) { buf.append(defaultGroupTableModel.getActualModel().getColumnName(getConditionColumn(i))); buf.append(": "); buf.append(getConditionValue(i)); } } return buf.toString();

Please note, you can either override this method or add a converter for DefaultGroupRow to do something like this.
 ObjectConverterManager.initDefaultConverter();
 ObjectConverterManager.registerConverter(DefaultGroupRow.class, new MyDefaultGroupRowConverter());
 
If so, MyDefaultGroupRowConverter will have a high priority than this toString method.

Overrides:
toString in class Object
Returns:
the String version of the DefaultGroupRow

JIDE 3.5.15