com.metamatrix.common.tree
Interface TreeView

All Superinterfaces:
PropertiedObjectView, UserTransactionFactory
All Known Subinterfaces:
DirectoryEntryView
All Known Implementing Classes:
AbstractTreeView, BasicTreeView, DefaultTreeView, FileSystemView, RuledDirectoryEntryViewImpl, RuledTreeViewImpl

public interface TreeView
extends PropertiedObjectView

This interface defines a view of a hierarchy of TreeNode instances.


Method Summary
 boolean allowsChild(TreeNode parent, TreeNode potentialChild)
          Determine whether the specified parent TreeNode may contain the specified child node.
 boolean allowsChildren(TreeNode entry)
          Determine whether the specified TreeNode may contain children.
 java.util.List getChildren(TreeNode parent)
          Obtain the set of entries that are considered the children of the specified TreeNode.
 java.util.Comparator getComparator()
          Set the comparator that provides the order for children returned from this view.
 TreeNodeFilter getFilter()
          Set the filter that limits the set of TreeNode instances returned from this view.
 TreeNode getHome()
          Obtain the TreeNode that represents the home for the underlying system.
 java.util.Set getMarked()
          Return the set of marked nodes for this view.
 TreeNode getParent(TreeNode entry)
          Determine the parent TreeNode for the specified entry, or null if the specified entry is a root.
 java.lang.String getPath(TreeNode entry)
          Obtain the abstract path for this TreeNode.
 java.util.List getPropertyDefinitions()
          Get the definitions of the properties for the TreeNode instances returned from this view.
 java.util.List getRoots()
          Returns all root partitians on this TreeNode system.
 java.lang.String getSeparator()
          Obtain the character (as a String) that is used to separate names in a path sequence for the abstract path.
 char getSeparatorChar()
          Obtain the character that is used to separate names in a path sequence for the abstract path.
 TreeNodeEditor getTreeNodeEditor()
          Return the tree node editor for this view.
 boolean isAncestorOf(TreeNode ancestor, TreeNode descendent)
          Determine whether the specified node is a descendent of the given ancestor node.
 boolean isHidden(TreeNode entry)
          Determine whether the specified TreeNode is hidden.
 boolean isMarked(TreeNode entry)
          Return the marked state of the specified entry.
 boolean isParentOf(TreeNode parent, TreeNode child)
          Determine whether the specified node is a child of the given parent node.
 boolean isRoot(TreeNode entry)
          Determine whether the specified TreeNode is a root of the underlying system.
 java.util.Iterator iterator()
          Obtain an iterator for this whole view, which navigates the view's nodes using pre-order rules (i.e., it visits a node before its children).
 java.util.Iterator iterator(TreeNode startingPoint)
          Obtain an iterator for the view starting at the specified node.
 void setComparator(java.util.Comparator comparator)
          Set the comparator that should be used to order the children.
 void setFilter(TreeNodeFilter filter)
          Set the filter that limits the set of TreeNode instances returned from this view.
 void setMarked(TreeNode entry, boolean markedState)
          Set the marked state of the specified entry.
 
Methods inherited from interface com.metamatrix.common.object.PropertiedObjectView
getPropertiedObjectEditor
 
Methods inherited from interface com.metamatrix.common.transaction.UserTransactionFactory
createReadTransaction, createWriteTransaction, createWriteTransaction
 

Method Detail

setFilter

void setFilter(TreeNodeFilter filter)
Set the filter that limits the set of TreeNode instances returned from this view.

Parameters:
filter - the filter, or null if the default "pass-through" filter should be used.

getFilter

TreeNodeFilter getFilter()
Set the filter that limits the set of TreeNode instances returned from this view.

Returns:
the current filter; never null

setComparator

void setComparator(java.util.Comparator comparator)
Set the comparator that should be used to order the children.

Parameters:
comparator - the comparator, or null if entry name sorting should be used.

getComparator

java.util.Comparator getComparator()
Set the comparator that provides the order for children returned from this view.

Returns:
the current comparator; never null

getPropertyDefinitions

java.util.List getPropertyDefinitions()
Get the definitions of the properties for the TreeNode instances returned from this view.

Returns:
the unmodifiable list of PropertyDefinition instances; never null

getRoots

java.util.List getRoots()
Returns all root partitians on this TreeNode system.

Returns:
the unmodifiable list of TreeNode instances that represent the roots

isRoot

boolean isRoot(TreeNode entry)
Determine whether the specified TreeNode is a root of the underlying system.

Parameters:
entry - the TreeNode instance that is to be checked; may not be null
Returns:
true if the entry is a root, or false otherwise.

allowsChildren

boolean allowsChildren(TreeNode entry)
Determine whether the specified TreeNode may contain children.

Parameters:
entry - the TreeNode instance that is to be checked; may not be null
Returns:
true if the entry can contain children, or false otherwise.

allowsChild

boolean allowsChild(TreeNode parent,
                    TreeNode potentialChild)
Determine whether the specified parent TreeNode may contain the specified child node.

Parameters:
parent - the TreeNode instance that is to be the parent; may not be null
potentialChild - the TreeNode instance that is to be the child; may not be null
Returns:
true if potentialChild can be placed as a child of parent, or false otherwise.

isHidden

boolean isHidden(TreeNode entry)
Determine whether the specified TreeNode is hidden.

Parameters:
entry - the TreeNode instance that is to be checked; may not be null
Returns:
true if the entry is hidden, or false otherwise.

isMarked

boolean isMarked(TreeNode entry)
Return the marked state of the specified entry.

Returns:
the marked state of the entry.

setMarked

void setMarked(TreeNode entry,
               boolean markedState)
Set the marked state of the specified entry.

Parameters:
true - if the node is to be marked, or false if it is to be un-marked.

getMarked

java.util.Set getMarked()
Return the set of marked nodes for this view.

Parameters:
the - unmodifiable set of marked nodes; never null

getHome

TreeNode getHome()
Obtain the TreeNode that represents the home for the underlying system. If the underlying system does not support a home entry concept, null is returned.

Returns:
the entry that represents the home, or null if no home concept is supported.

getPath

java.lang.String getPath(TreeNode entry)
Obtain the abstract path for this TreeNode.

Returns:
the string that represents the abstract path of this entry; never null

getSeparatorChar

char getSeparatorChar()
Obtain the character that is used to separate names in a path sequence for the abstract path. This character is completely dependent upon the implementation.

Returns:
the charater used to delimit names in the abstract path.

getSeparator

java.lang.String getSeparator()
Obtain the character (as a String) that is used to separate names in a path sequence for the abstract path.

Returns:
the string containing the charater used to delimit names in the abstract path; never null

getParent

TreeNode getParent(TreeNode entry)
Determine the parent TreeNode for the specified entry, or null if the specified entry is a root.

Parameters:
entry - the TreeNode instance for which the parent is to be obtained; may not be null
Returns:
the parent entry, or null if there is no parent

getChildren

java.util.List getChildren(TreeNode parent)
Obtain the set of entries that are considered the children of the specified TreeNode.

Parameters:
parent - the TreeNode instance for which the child entries are to be obtained; may not be null
Returns:
the unmodifiable list of TreeNode instances that are considered the children of the specified entry; never null but possibly empty

isParentOf

boolean isParentOf(TreeNode parent,
                   TreeNode child)
Determine whether the specified node is a child of the given parent node.

Returns:
true if the node is a child of the given parent node.

isAncestorOf

boolean isAncestorOf(TreeNode ancestor,
                     TreeNode descendent)
Determine whether the specified node is a descendent of the given ancestor node.

Returns:
true if the node is a descendent of the given ancestor node.

getTreeNodeEditor

TreeNodeEditor getTreeNodeEditor()
Return the tree node editor for this view.

Returns:
the TreeNodeEditor instance

iterator

java.util.Iterator iterator()
Obtain an iterator for this whole view, which navigates the view's nodes using pre-order rules (i.e., it visits a node before its children).

Returns:
the iterator that traverses the nodes in this view; never null

iterator

java.util.Iterator iterator(TreeNode startingPoint)
Obtain an iterator for the view starting at the specified node. This implementation currently navigates the subtree using pre-order rules (i.e., it visits a node before its children).

Parameters:
startingPoint - the root of the subtree over which the iterator is to navigate; may not be null
Returns:
the iterator that traverses the nodes in the subtree starting at the specified node; never null


Copyright © 2009. All Rights Reserved.