Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.olap
Class DefaultOlapTableModel

java.lang.Object
  extended by com.citra.treetable.AbstractTreeTableModel
      extended by com.citra.treetable.MutableTreeTableModel
          extended by com.citra.treetable.ComparableTreeTableModel
              extended by com.citra.treetable.ObjectTreeTableModel
                  extended by com.citra.pivot.olap.DefaultOlapTableModel
All Implemented Interfaces:
OlapTableModel, PivotConstants, ReorderModel, TreeTableModel, Serializable, TreeModel

public class DefaultOlapTableModel
extends ObjectTreeTableModel
implements OlapTableModel

DefaultOlapTableModel is the default model for creating a tree structure of an olap hierarchy. The tree can either be created automatically, given a datasource and a parent member, or manually, by supplying only the model's name in the constructor.


Field Summary
protected  OlapHierarchy hierarchy
          the model's hierarchy
 
Fields inherited from class com.citra.treetable.ComparableTreeTableModel
addChildForGroup, comparators, defaultComparatorsByColumnClass
 
Fields inherited from class com.citra.treetable.MutableTreeTableModel
classes, columns
 
Fields inherited from class com.citra.treetable.AbstractTreeTableModel
listenerList, root
 
Fields inherited from interface com.citra.treetable.TreeTableModel
CHANGE_COLUMN_SOURCE
 
Fields inherited from interface com.citra.pivot.PivotConstants
GRAND_TOTAL_TYPE, NORMAL_TYPE, SUBTOTAL_TYPE
 
Constructor Summary
DefaultOlapTableModel(OlapHierarchy hierarchy)
          Constructs a DefaultOlapTableModel by supplying only the hierarchy.
DefaultOlapTableModel(OlapHierarchy hierarchy, Connection connection)
          Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection and the hierarchy.
DefaultOlapTableModel(OlapHierarchy hierarchy, Connection connection, String name)
          Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection the hierarchy and its name.
DefaultOlapTableModel(OlapMember rootMember, Connection connection)
          Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection and the parent root member.
DefaultOlapTableModel(OlapMember rootMember, Connection connection, String name)
          Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection the parent root member and the hierarchy's name.
DefaultOlapTableModel(String name)
          Constructs a DefaultOlapTableModel by supplying only the hierarchy's name.
 
Method Summary
 MutableTreeNode addEntry(OlapEdge edge)
          Adds a member to the tree structure at the end of the tree's root.
 MutableTreeNode addEntry(OlapMember member)
          Adds a member to the tree structure at the end of the tree's root.
 String getName(Object node)
          Retrieves the name of the node.
 OlapHierarchy getOlapHierarchy()
          Retrieves the hierarchy that the model represents.
 OlapMeasure getOlapMeasure(Object node)
          Retrieves the olap measure at the specified node.
 OlapMember getOlapMember(Object node)
          Retrieves the olap member at the specified node.
 int getOlapType(Object node)
          Retrieves the type of the pivoted member at the specified node.
 MutableTreeNode insertEntry(OlapEdge edge, MutableTreeNode parent)
          Adds a member to the tree structure at a position specified by the passed arguments.
 MutableTreeNode insertEntry(OlapEdge edge, MutableTreeNode parent, int index)
          Adds a member to the tree structure at a position specified by the passed arguments.
 MutableTreeNode insertEntry(OlapMember member, MutableTreeNode parent)
          Adds a member to the tree structure at a position specified by the passed arguments.
 MutableTreeNode insertEntry(OlapMember member, MutableTreeNode parent, int index)
          Adds a member to the tree structure at a position specified by the passed arguments.
 void setMember(OlapEdge edge, Object node)
          Assigns a member to a given node.
 void setName(String name, Object node)
          Assigns a name to a given node.
 void setOlapHierarchy(OlapHierarchy hierarchy)
          Assigns the model's hierarchy.
 void setRootMember(OlapEdge edge)
          Assigns a new member to be used as the root.
 void setRootMember(OlapMember member)
          Assigns a new member to be used as the root.
 
Methods inherited from class com.citra.treetable.ObjectTreeTableModel
createLeafNode, createNonLeafNode, getObjectAt, getValueAt, replicateLeafNode, setObjectAt, setValueAt
 
Methods inherited from class com.citra.treetable.ComparableTreeTableModel
add, add, addNode, addRowComparator, clearComparators, comparatorsChanged, createDefaultComparators, findTreeNode, getAddChildForGroup, getDefaultComparator, getRowComparator, getRowComparators, getRowComparatorSize, insertRowComparator, loadComparators, refreshComparators, removeRowComparator, removeRowComparator, saveComparators, setAddChildForGroup, setDefaultComparator, setRowComparator
 
Methods inherited from class com.citra.treetable.MutableTreeTableModel
addColumn, addColumn, addReorderListener, clear, fireRowsMapped, fireRowsReordered, getChild, getChildCount, getColumnClass, getColumnCount, getColumnName, getIndexOfChild, getPathToRoot, getPathToRoot, insertNodeInto, isCellEditable, isLeaf, moveNode, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, removeNodeFromParent, removeReorderListener, setColumnClasses, setColumnNames, valueForPathChanged
 
Methods inherited from class com.citra.treetable.AbstractTreeTableModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeTableStructureChanged, fireTreeTableStructureChanged, getRoot, isAggregate, isFooter, isHeader, removeTreeModelListener, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.citra.treetable.TreeTableModel
getColumnClass, getColumnCount, getColumnName, getValueAt, isAggregate, isCellEditable, isFooter, isHeader, setValueAt
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 

Field Detail

hierarchy

protected OlapHierarchy hierarchy
the model's hierarchy

Constructor Detail

DefaultOlapTableModel

public DefaultOlapTableModel(OlapHierarchy hierarchy)
Constructs a DefaultOlapTableModel by supplying only the hierarchy. The tree will be empty at first. The addEntry or insertEntry methods must be then called, in order to add some members to the tree.


DefaultOlapTableModel

public DefaultOlapTableModel(OlapHierarchy hierarchy,
                             Connection connection)
Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection and the hierarchy. The model will then create the tree by retrieving the children members of the required parent member, on demand.


DefaultOlapTableModel

public DefaultOlapTableModel(OlapHierarchy hierarchy,
                             Connection connection,
                             String name)
Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection the hierarchy and its name. The model will then create the tree by retrieving the children members of the required parent member, on demand.


DefaultOlapTableModel

public DefaultOlapTableModel(OlapMember rootMember,
                             Connection connection)
Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection and the parent root member. The model will then create the tree by retrieving the children members of the required members, on demand.


DefaultOlapTableModel

public DefaultOlapTableModel(OlapMember rootMember,
                             Connection connection,
                             String name)
Constructs a DefaultOlapTableModel dynamically by supplying the datasource connection the parent root member and the hierarchy's name. The model will then create the tree by retrieving the children members of the required members, on demand.


DefaultOlapTableModel

public DefaultOlapTableModel(String name)
Constructs a DefaultOlapTableModel by supplying only the hierarchy's name. The tree will be empty at first. The addEntry or insertEntry methods must be then called, in order to add some members to the tree. Note that in order to use the model constructed in this way in a pivot table, you must set the hierarchy with the setOlapHierarchy method.

Method Detail

addEntry

public MutableTreeNode addEntry(OlapMember member)
Adds a member to the tree structure at the end of the tree's root.

Parameters:
member - the member to add
Returns:
the newly-created node

addEntry

public MutableTreeNode addEntry(OlapEdge edge)
Adds a member to the tree structure at the end of the tree's root.

Parameters:
edge - the edge object to add, containing the member and measure
Returns:
the newly-created node

getName

public String getName(Object node)
Retrieves the name of the node. This value will be used when displaying information on a pivot table.

Specified by:
getName in interface OlapTableModel
Parameters:
node - the node for which the name is returned
Returns:
the node's name

getOlapHierarchy

public OlapHierarchy getOlapHierarchy()
Retrieves the hierarchy that the model represents.

Specified by:
getOlapHierarchy in interface OlapTableModel
Returns:
the model's hierarchy

getOlapMeasure

public OlapMeasure getOlapMeasure(Object node)
Retrieves the olap measure at the specified node. This method may return null.

Specified by:
getOlapMeasure in interface OlapTableModel
Parameters:
node - the node for which the measure is returned
Returns:
the measure at node

getOlapMember

public OlapMember getOlapMember(Object node)
Retrieves the olap member at the specified node.

Specified by:
getOlapMember in interface OlapTableModel
Parameters:
node - the node for which the member is returned
Returns:
the member at node

getOlapType

public int getOlapType(Object node)
Retrieves the type of the pivoted member at the specified node. The type is taken from PivotConstants and can be NORMAL_TYPE, SUBTOTAL_TYPE or GRAND_TOTAL_TYPE.

Specified by:
getOlapType in interface OlapTableModel
Parameters:
node - the node for which the type is returned
Returns:
the type for the member at node

insertEntry

public MutableTreeNode insertEntry(OlapMember member,
                                   MutableTreeNode parent)
Adds a member to the tree structure at a position specified by the passed arguments.

Parameters:
member - the member to add
parent - the parent the member is added to
Returns:
the newly-created node

insertEntry

public MutableTreeNode insertEntry(OlapMember member,
                                   MutableTreeNode parent,
                                   int index)
Adds a member to the tree structure at a position specified by the passed arguments.

Parameters:
member - the member to add
parent - the parent the member is added to
index - the child position at which the member is added
Returns:
the newly-created node

insertEntry

public MutableTreeNode insertEntry(OlapEdge edge,
                                   MutableTreeNode parent)
Adds a member to the tree structure at a position specified by the passed arguments.

Parameters:
edge - the edge object to add, containing the member and measure
parent - the parent the member is added to
Returns:
the newly-created node

insertEntry

public MutableTreeNode insertEntry(OlapEdge edge,
                                   MutableTreeNode parent,
                                   int index)
Adds a member to the tree structure at a position specified by the passed arguments.

Parameters:
edge - the edge object to add, containing the member and measure
parent - the parent the member is added to
index - the child position at which the member is added
Returns:
the newly-created node

setMember

public void setMember(OlapEdge edge,
                      Object node)
Assigns a member to a given node.

Parameters:
edge - the edge member to assign
node - the node the assignment takes place

setName

public void setName(String name,
                    Object node)
Assigns a name to a given node.

Specified by:
setName in interface OlapTableModel
Parameters:
name - the name to assign
node - the node the assignment takes place

setOlapHierarchy

public void setOlapHierarchy(OlapHierarchy hierarchy)
Assigns the model's hierarchy.

Parameters:
hierarchy - the hierarchy to assign

setRootMember

public void setRootMember(OlapMember member)
Assigns a new member to be used as the root.

Parameters:
member - the new root member to assign

setRootMember

public void setRootMember(OlapEdge edge)
Assigns a new member to be used as the root.

Parameters:
edge - the new root member edge to assign

Copyright © 2011 Citra Technologies. All Rights Reserved.