org.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel
Class ReverseDbTreeNode

java.lang.Object
  extended byorg.apache.ojb.tools.mapping.reversedb2.propertyEditors.EditableTreeNodeWithProperties
      extended byorg.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel.ReverseDbTreeNode
All Implemented Interfaces:
PropertyEditorTarget, java.io.Serializable, javax.swing.tree.TreeNode
Direct Known Subclasses:
DBMetaCatalogNode, DBMetaColumnNode, DBMetaRootNode, DBMetaSchemaNode, DBMetaTableNode

public abstract class ReverseDbTreeNode
extends EditableTreeNodeWithProperties
implements java.io.Serializable

Abstract implementation of a treenode representing an metadata object in a database. It implements loading the children of the node in a separate thread, thus not blocking the user interface.

Author:
Administrator
See Also:
Serialized Form

Field Summary
protected  java.util.ArrayList alChildren
          List of children of this treenode.
 
Fields inherited from class org.apache.ojb.tools.mapping.reversedb2.propertyEditors.EditableTreeNodeWithProperties
propertyChangeDelegate
 
Constructor Summary
ReverseDbTreeNode(java.sql.DatabaseMetaData pdbMeta, DatabaseMetaDataTreeModel pdbMetaTreeModel, ReverseDbTreeNode pparent)
           
 
Method Summary
protected abstract  boolean _load()
          Purpose of this method is to fill the children of the node.
 java.util.Enumeration children()
           
abstract  boolean getAllowsChildren()
           
 javax.swing.tree.TreeNode getChildAt(int index)
           
 int getChildCount()
           
protected  java.sql.DatabaseMetaData getDbMeta()
          Access method for the DatabaseMetaData object of this tree model
protected  DatabaseMetaDataTreeModel getDbMetaTreeModel()
          Access method for the TreeModel this node is associated to.
 int getIndex(javax.swing.tree.TreeNode o)
           
 javax.swing.tree.TreeNode getParent()
           
abstract  boolean isLeaf()
           
 void load(boolean recursive, boolean replace, boolean inNewThread)
          Loads the children of this TreeNode.
 void loadWait(boolean recursive, boolean replace, boolean inNewThread)
          Loads the children of this TreeNode.
 
Methods inherited from class org.apache.ojb.tools.mapping.reversedb2.propertyEditors.EditableTreeNodeWithProperties
addPropertyChangeListener, addPropertyChangeListener, getAttribute, removePropertyChangeListener, removePropertyChangeListener, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.ojb.tools.mapping.reversedb2.propertyEditors.PropertyEditorTarget
getPropertyEditorClass
 

Field Detail

alChildren

protected java.util.ArrayList alChildren
List of children of this treenode.

Constructor Detail

ReverseDbTreeNode

public ReverseDbTreeNode(java.sql.DatabaseMetaData pdbMeta,
                         DatabaseMetaDataTreeModel pdbMetaTreeModel,
                         ReverseDbTreeNode pparent)
Method Detail

getChildAt

public javax.swing.tree.TreeNode getChildAt(int index)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode
See Also:
TreeNode.getChildAt(int)

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode
See Also:
TreeNode.getChildCount()

getParent

public javax.swing.tree.TreeNode getParent()
Specified by:
getParent in interface javax.swing.tree.TreeNode
See Also:
TreeNode.getParent()

getIndex

public int getIndex(javax.swing.tree.TreeNode o)
Specified by:
getIndex in interface javax.swing.tree.TreeNode
See Also:
TreeNode.getIndex(TreeNode)

getAllowsChildren

public abstract boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
See Also:
TreeNode.getAllowsChildren()

isLeaf

public abstract boolean isLeaf()
Specified by:
isLeaf in interface javax.swing.tree.TreeNode
See Also:
TreeNode.isLeaf()

children

public java.util.Enumeration children()
Specified by:
children in interface javax.swing.tree.TreeNode
See Also:
TreeNode.children()

load

public void load(boolean recursive,
                 boolean replace,
                 boolean inNewThread)
Loads the children of this TreeNode. If another Thread is already active on this node the method returns without doing anything (if a separate Thread is started the method returns anyway, but the Thread might do nothing).

Parameters:
recursive - If true, all children down to the leaf node are retrieved
replace - If true the children are loaded unconditionally. If false the retrieval is only done if the node has not been populated before.
inNewThread - if true the load is done in a new thread.

loadWait

public void loadWait(boolean recursive,
                     boolean replace,
                     boolean inNewThread)
Loads the children of this TreeNode. If the node is already populated, this method returns without action. If there is already a Thread populating this treenode the method waits until the other Thread has finished

Parameters:
recursive - if true, all children down to the leaf node are retrieved.
replace - if false and the list of children is already populated, return without action. If recursive is true, all children down to the leaf of the tree are checked.

getDbMeta

protected java.sql.DatabaseMetaData getDbMeta()
Access method for the DatabaseMetaData object of this tree model


getDbMetaTreeModel

protected DatabaseMetaDataTreeModel getDbMetaTreeModel()
Access method for the TreeModel this node is associated to.


_load

protected abstract boolean _load()
Purpose of this method is to fill the children of the node. It should replace all children in alChildren (the arraylist containing the children) of this node and notify the TreeModel that a change has occurred.



Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14