Package mondrian.gui
Class SchemaTreeModel
- java.lang.Object
-
- javax.swing.tree.DefaultTreeModel
-
- mondrian.gui.SchemaTreeModel
-
- All Implemented Interfaces:
Serializable,TreeModel
public class SchemaTreeModel extends DefaultTreeModel
- Author:
- sean
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) MondrianGuiDef.Schemaschema-
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
-
-
Constructor Summary
Constructors Constructor Description SchemaTreeModel()Creates a SchemaTreeModel.SchemaTreeModel(MondrianGuiDef.Schema s)Creates a new instance of SchemaTreeModel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetChild(Object parent, int index)Returns the child ofparentat indexindexin the parent's child array.intgetChildCount(Object parent)Returns the number of children ofparent.intgetIndexOfChild(Object parent, Object child)Returns the index of child in parent.ObjectgetRoot()Returns the root of the tree.booleanisLeaf(Object node)Returnstrueifnodeis a leaf.voidvalueForPathChanged(TreePath path, Object newValue)-
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getListeners, getPathToRoot, getPathToRoot, getTreeModelListeners, insertNodeInto, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot
-
-
-
-
Field Detail
-
schema
MondrianGuiDef.Schema schema
-
-
Constructor Detail
-
SchemaTreeModel
public SchemaTreeModel()
Creates a SchemaTreeModel.
-
SchemaTreeModel
public SchemaTreeModel(MondrianGuiDef.Schema s)
Creates a new instance of SchemaTreeModel
-
-
Method Detail
-
getChild
public Object getChild(Object parent, int index)
Returns the child ofparentat indexindexin the parent's child array.parentmust be a node previously obtained from this data source. This should not returnnullifindexis a valid index forparent(that isindex >= 0 && index < getChildCount(parent)).- Specified by:
getChildin interfaceTreeModel- Overrides:
getChildin classDefaultTreeModel- Parameters:
parent- a node in the tree, obtained from this data source- Returns:
- the child of
parentat indexindex
-
getChildCount
public int getChildCount(Object parent)
Returns the number of children ofparent. Returns 0 if the node is a leaf or if it has no children.parentmust be a node previously obtained from this data source.- Specified by:
getChildCountin interfaceTreeModel- Overrides:
getChildCountin classDefaultTreeModel- Parameters:
parent- a node in the tree, obtained from this data source- Returns:
- the number of children of the node
parent
-
getIndexOfChild
public int getIndexOfChild(Object parent, Object child)
Returns the index of child in parent. Ifparentisnullorchildisnull, returns -1.- Specified by:
getIndexOfChildin interfaceTreeModel- Overrides:
getIndexOfChildin classDefaultTreeModel- Parameters:
parent- a note in the tree, obtained from this data sourcechild- the node we are interested in- Returns:
- the index of the child in the parent, or -1 if either
childorparentarenull
-
getRoot
public Object getRoot()
Returns the root of the tree. Returnsnullonly if the tree has no nodes.- Specified by:
getRootin interfaceTreeModel- Overrides:
getRootin classDefaultTreeModel- Returns:
- the root of the tree
-
isLeaf
public boolean isLeaf(Object node)
Returnstrueifnodeis a leaf. It is possible for this method to returnfalseeven ifnodehas no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.- Specified by:
isLeafin interfaceTreeModel- Overrides:
isLeafin classDefaultTreeModel- Parameters:
node- a node in the tree, obtained from this data source- Returns:
- true if
nodeis a leaf
-
valueForPathChanged
public void valueForPathChanged(TreePath path, Object newValue)
- Specified by:
valueForPathChangedin interfaceTreeModel- Overrides:
valueForPathChangedin classDefaultTreeModel
-
-