***  This class is subject to change.  ***

com.sas.swing.models
Class OLAPDataSetInterfaceToTreeModelAdapter

com.sas.swing.models.OLAPDataSetInterfaceToTreeModelAdapter
All Implemented Interfaces:
ViewDefaultModel, javax.swing.tree.TreeModel

public class OLAPDataSetInterfaceToTreeModelAdapter
implements javax.swing.tree.TreeModel, ViewDefaultModel

A default tree model for viewing an OLAPDataSetInterface.


Field Summary
protected  boolean defaultModelAttached
           
protected  javax.swing.event.EventListenerList listenerList
          Listeners.
protected  OLAPDataSetInterface model
           
protected  java.lang.Object root
           
 
Constructor Summary
OLAPDataSetInterfaceToTreeModelAdapter()
          Default constructor, calls this(null.
OLAPDataSetInterfaceToTreeModelAdapter(OLAPDataSetInterface model)
          Creates a TreeModel representation for the OLAPDataSetINterface that is passed in.
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener listener)
          Registers a listener to receive notification whenever the tree model changes.
protected  void fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
           
protected  void fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
           
protected  void fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
           
protected  void fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
           
 int[] getAxesUsed()
          Returns an array of ints that map to the constants in AxisInterface for the various axes being displayed in the tree model.
 java.lang.Object getChild(java.lang.Object parent, int index)
          Returns a child at a particular index from the specifed parent.
 int getChildCount(java.lang.Object parent)
          Returns the number of child that the specified node contains.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          Returns the index of the specified child in its parent list.
 OLAPDataSetInterface getModel()
          Returns the OLAPDataSetInterface that is being as the data for the tree model.
 java.lang.Object getParent(java.lang.Object child)
          Returns the parent of the specified object.
 javax.swing.tree.TreePath getPathToRoot(java.lang.Object node)
          Returns the path from the root node down to the specified node.
 java.lang.Object getRoot()
          Returns the root object in the tree.
 boolean isAxesVisible()
           
 boolean isDefaultModelAttached()
          Returns whether the default model is attached, which in this case is a OLAPDataSet with no tuples or axes set.
 boolean isLeaf(java.lang.Object object)
          Indicates if the specified object is a leaf.
protected  OLAPDataSetInterface newDefaultModel()
          Create a new default model, which by default is a com.sas.storage.olap.embedded.OLAPDataSet with no tuples or axes set.
 void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
          Removes a listener from receiving notifications whenever the tree model changes.
 void setAxesUsed(int[] axes)
          Sets the axes being displayed in the tree, by default the axes are AxisInterface.COLUMNS_AXIS, AxisInterface.ROWS_AXIS and AxisInterface.SLICERS_AXIS.
 void setAxesVisible(boolean areAxesVisible)
           
protected  void setDefaultModelAttached(boolean defaultModelUsed)
          Sets whether the default model is attached or not.
 void setModel(OLAPDataSetInterface newModel)
          Sets the model on the adapter, if null, a default embedded OLAPDataSet will be used.
 void setRoot(java.lang.Object root)
          Sets the root object in the tree.
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object value)
          Not implemented yet.
 

Field Detail

listenerList

protected javax.swing.event.EventListenerList listenerList
Listeners.


defaultModelAttached

protected boolean defaultModelAttached

model

protected OLAPDataSetInterface model

root

protected java.lang.Object root
Constructor Detail

OLAPDataSetInterfaceToTreeModelAdapter

public OLAPDataSetInterfaceToTreeModelAdapter()
Default constructor, calls this(null.


OLAPDataSetInterfaceToTreeModelAdapter

public OLAPDataSetInterfaceToTreeModelAdapter(OLAPDataSetInterface model)
Creates a TreeModel representation for the OLAPDataSetINterface that is passed in. If the model is null, the model will be set to the model returned from createDefaultModel().

Parameters:
model - the OLAP model to create a tree representation for
Method Detail

setAxesUsed

public void setAxesUsed(int[] axes)
Sets the axes being displayed in the tree, by default the axes are AxisInterface.COLUMNS_AXIS, AxisInterface.ROWS_AXIS and AxisInterface.SLICERS_AXIS. The order the axes are set in teh array are the order they will appear in the tree, so you can control which axis you want to see first.

Parameters:
axes - an array of ints that use the constants from the AxisInterface
See Also:
getAxesUsed()

getAxesUsed

public int[] getAxesUsed()
Returns an array of ints that map to the constants in AxisInterface for the various axes being displayed in the tree model. By default, the axes are AxisInterface.COLUMNS_AXIS, AxisInterface.ROWS_AXIS and AxisInterface.SLICERS_AXIS.

Returns:
an array of ints that map to the axes beings used in the tree model
See Also:
setAxesUsed(int[])

isAxesVisible

public boolean isAxesVisible()

setAxesVisible

public void setAxesVisible(boolean areAxesVisible)

getModel

public OLAPDataSetInterface getModel()
Returns the OLAPDataSetInterface that is being as the data for the tree model.

Returns:
an instance of an OLAPDataSetInterface that is the model for the tree
See Also:
setModel(OLAPDataSetInterface)

setModel

public void setModel(OLAPDataSetInterface newModel)
Sets the model on the adapter, if null, a default embedded OLAPDataSet will be used.

Parameters:
newModel - the new model for the adapter
See Also:
getModel()

newDefaultModel

protected OLAPDataSetInterface newDefaultModel()
Create a new default model, which by default is a com.sas.storage.olap.embedded.OLAPDataSet with no tuples or axes set.

Returns:
a default model to use for the adapter if null is set as the model

isDefaultModelAttached

public boolean isDefaultModelAttached()
Returns whether the default model is attached, which in this case is a OLAPDataSet with no tuples or axes set.

Specified by:
isDefaultModelAttached in interface ViewDefaultModel
Returns:
true if a default model is being used, false otherwise
See Also:
setDefaultModelAttached(boolean)

setDefaultModelAttached

protected void setDefaultModelAttached(boolean defaultModelUsed)
Sets whether the default model is attached or not.

Parameters:
defaultModelUsed - true if a default model is attached, false otherwise
See Also:
isDefaultModelAttached()

getRoot

public java.lang.Object getRoot()
Returns the root object in the tree.

Specified by:
getRoot in interface javax.swing.tree.TreeModel
Returns:
the root object in the tree

setRoot

public void setRoot(java.lang.Object root)
Sets the root object in the tree.

Parameters:
root - the new root object

getChildCount

public int getChildCount(java.lang.Object parent)
Returns the number of child that the specified node contains. This method delegates the work to the type-specific methods.

Specified by:
getChildCount in interface javax.swing.tree.TreeModel
Parameters:
parent - the node the get the child count from
Returns:
the number of children contained by parent

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Returns a child at a particular index from the specifed parent.

Specified by:
getChild in interface javax.swing.tree.TreeModel
Parameters:
parent - the node to get the child from
index - the index of the child to get
Returns:
the child at the specified index

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Returns the index of the specified child in its parent list.

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel
Parameters:
parent - the parent of the child node
child - the node to get the index of
Returns:
the index of the child in the parent's child list

isLeaf

public boolean isLeaf(java.lang.Object object)
Indicates if the specified object is a leaf. A child is a leaf if it contains no children. This is an alias for:
    getChildCount(object) <= 0;
 

Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Parameters:
object - the object to determine if its a leaf or not
Returns:
true if the object is a leaf, otherwise false

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object value)
Not implemented yet.

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel
See Also:
TreeModel.valueForPathChanged(TreePath, Object)

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener listener)
Registers a listener to receive notification whenever the tree model changes.

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
listener - the listener to register

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
Removes a listener from receiving notifications whenever the tree model changes.

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel
Parameters:
listener - the listener to remove

getPathToRoot

public javax.swing.tree.TreePath getPathToRoot(java.lang.Object node)
Returns the path from the root node down to the specified node.

Parameters:
node - the node to find the path of
Returns:
the path from the root to node

getParent

public java.lang.Object getParent(java.lang.Object child)
Returns the parent of the specified object.

Parameters:
child - the child node to get the parent of
Returns:
the parent of the specified child object

fireTreeNodesChanged

protected void fireTreeNodesChanged(java.lang.Object source,
                                    java.lang.Object[] path,
                                    int[] childIndices,
                                    java.lang.Object[] children)
Parameters:
source -
path -
childIndices -
children -

fireTreeNodesInserted

protected void fireTreeNodesInserted(java.lang.Object source,
                                     java.lang.Object[] path,
                                     int[] childIndices,
                                     java.lang.Object[] children)
Parameters:
source -
path -
childIndices -
children -

fireTreeNodesRemoved

protected void fireTreeNodesRemoved(java.lang.Object source,
                                    java.lang.Object[] path,
                                    int[] childIndices,
                                    java.lang.Object[] children)
Parameters:
source -
path -
childIndices -
children -

fireTreeStructureChanged

protected void fireTreeStructureChanged(java.lang.Object source,
                                        java.lang.Object[] path,
                                        int[] childIndices,
                                        java.lang.Object[] children)
Parameters:
source -
path -
childIndices -
children -

***  This class is subject to change.  ***




Copyright © 2009 SAS Institute Inc. All Rights Reserved.