JIDE 3.5.15

com.jidesoft.pivot
Class DefaultExpandableValue

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.pivot.DefaultExpandableValue
All Implemented Interfaces:
Expandable, Node, ExpandableValue, Value

public class DefaultExpandableValue
extends DefaultExpandable
implements ExpandableValue

Default implementation of ExpandableValue interface. This is the main class used in HeaderTableModel to store the data.

The equality of two DefaultExpandableValues is depending on the actual value from getValue(). To improve the performance, it also stores the hash code if PivotDataModel.isValueImmutable() return true. In the other word, if the value passed to DefaultExpandableValue(Object value) as parameter is immutable or you will make sure they are used as immutable even the value itself is mutable, we will cache the hash code. In Java, all primitive types and String are immutable so this will cover a large percentage of use cases.


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.Expandable
PROPERTY_EXPANDABLE, PROPERTY_EXPANDED
 
Fields inherited from interface com.jidesoft.grid.Node
PROPERTY_ADJUSTING
 
Constructor Summary
DefaultExpandableValue(Object value)
           
 
Method Summary
 Object addChild(int index, Object child)
          Adds a child.
 void addChildren(int index, List<? extends Row> children)
          Adds a list of children.
 boolean equals(Object o)
           
 Object getFirstDescendantValueAt(int level)
          Gets the first descendant value at the specified level.
 int getNumberOfVisibleExpandable()
          Overrides this method to do a different calculation.
 Object getValue()
          Gets the value.
 int hashCode()
           
 void removeAllChildren()
          Removes all children from this expandable.
 boolean removeChild(Object child)
          Removes a child.
 void setValue(Object value)
          Sets the value.
 String toString()
           
 
Methods inherited from class com.jidesoft.grid.DefaultExpandable
breadthFirstEnumeration, depthFirstEnumeration, getChildren, postorderEnumeration, preorderEnumeration, setChildren
 
Methods inherited from class com.jidesoft.grid.AbstractExpandable
addChild, getAllChildrenCount, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildrenCount, getNumberOfVisibleChildren, getTreeTableModel, hasChildren, hasVisibleChildren, isAdjusting, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildDeleted, notifyChildInserted, notifyChildrenDeleted, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, 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, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.jidesoft.grid.Expandable
addChild, getAllVisibleChildrenCount, getChildAt, getChildIndex, getChildren, getChildrenCount, hasChildren, isExpandable, isExpanded, moveDownChild, moveUpChild, notifyChildDeleted, notifyChildInserted, notifyChildrenDeleted, notifyChildrenInserted, notifyChildrenUpdated, notifyChildUpdated, removeChildren, setChildren, setExpandable, setExpanded
 
Methods inherited from interface com.jidesoft.grid.Node
getLevel, getNextSibling, getParent, getPreviousSibling, setParent
 

Constructor Detail

DefaultExpandableValue

public DefaultExpandableValue(Object value)
Method Detail

getValue

public Object getValue()
Description copied from interface: Value
Gets the value.

Specified by:
getValue in interface Value
Returns:
the value.

setValue

public void setValue(Object value)
Description copied from interface: Value
Sets the value.

Specified by:
setValue in interface Value
Parameters:
value - the actual value for this Value object.

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getNumberOfVisibleExpandable

public int getNumberOfVisibleExpandable()
Overrides this method to do a different calculation.

Specified by:
getNumberOfVisibleExpandable in interface Expandable
Overrides:
getNumberOfVisibleExpandable in class AbstractExpandable
Returns:
the number of visible expandable.

addChild

public Object addChild(int index,
                       Object child)
Description copied from class: AbstractExpandable
Adds a child.

Specified by:
addChild in interface Expandable
Overrides:
addChild in class AbstractExpandable
Parameters:
index - the index where the child to be inserted.
child - the child to be added.
Returns:
the child just added.

addChildren

public void addChildren(int index,
                        List<? extends Row> children)
Description copied from class: AbstractExpandable
Adds a list of children.

Specified by:
addChildren in interface Expandable
Overrides:
addChildren in class AbstractExpandable
Parameters:
index - the index where the children to be inserted.
children - the children to be added.

removeAllChildren

public void removeAllChildren()
Description copied from class: AbstractExpandable
Removes all children from this expandable.

Specified by:
removeAllChildren in interface Expandable
Overrides:
removeAllChildren in class AbstractExpandable

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.

getFirstDescendantValueAt

public Object getFirstDescendantValueAt(int level)
Gets the first descendant value at the specified level. If level is 0, the value of this DefaultExpandableValue will be returned. If the level is 1, the value of the first child of this DefaultExpandableValue will be returned. If level is 2, the value of the first child of the first child of the DefaultExpandableValue will be returned, and so on. If the DefaultExpandableValue doesn't have that many levels or, it will return null.

Parameters:
level - the descendant level
Returns:
the first descendant value at the specified level

JIDE 3.5.15