org.PingOO.DLAI.lib.directorytree
Class DirectoryNode

java.lang.Object
  |
  +--javax.swing.tree.DefaultMutableTreeNode
        |
        +--org.PingOO.DLAI.lib.directorytree.DirectoryComponent
              |
              +--org.PingOO.DLAI.lib.directorytree.DirectoryNode
Direct Known Subclasses:
GroupNode, HomeNode, RootNode

public abstract class DirectoryNode
extends DirectoryComponent

Defines the component used to describe a node in the directory.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
Serialized Form

Inner classes inherited from class javax.swing.tree.DefaultMutableTreeNode
javax.swing.tree.DefaultMutableTreeNode.BreadthFirstEnumeration, javax.swing.tree.DefaultMutableTreeNode.PathBetweenNodesEnumeration, javax.swing.tree.DefaultMutableTreeNode.PostorderEnumeration, javax.swing.tree.DefaultMutableTreeNode.PreorderEnumeration
 
Field Summary
static java.lang.String ADMINISTRATOR_ALIAS_CHILD
          Defines an administrator alias.
static java.lang.String ALLOW_KEY
          The list of this component attributes.
protected  java.util.Hashtable childrenAllowed
           
static java.lang.String COUNTRY_NODE_CHILD
          defines a country.
static java.lang.String DEPARTEMENT_NODE_CHILD
          Defines a departement.
static java.lang.String LIST_GROUP_CHILD
          Defines a list group.
static java.lang.String LIST_HOME_CHILD
          Defines a list home.
static java.lang.String LIST_SHEET_CHILD
          Defines a list sheet.
static java.lang.String ORGANIZATION_NODE_CHILD
          Defines an organization.
static java.lang.String PEOPLE_HOME_CHILD
          Defines a user group home.
static java.lang.String RESOURCE_ALIAS_CHILD
          Defines a resource alias.
static java.lang.String RESOURCE_GROUP_CHILD
          Defines a resource group.
static java.lang.String RESOURCE_HOME_CHILD
          Defines a resource group.
static java.lang.String RESOURCE_SHEET_CHILD
          Defines a resource sheet.
static java.lang.String SECTION_NODE_CHILD
          Defines a section.
static java.lang.String USER_ALIAS_CHILD
          Defines a user alias.
static java.lang.String USER_GROUP_CHILD
          Defines a user group.
static java.lang.String USER_SHEET_CHILD
          Defines a user sheet.
 
Fields inherited from class org.PingOO.DLAI.lib.directorytree.DirectoryComponent
accessTable, attributeVector, CREATION_DATE_KEY, DESCRIPTION_KEY, DN_SEPAPATOR, EMPTY_ARRAY_ATTRIBUTE, EXPIRATION_DATE_KEY, exportationTable, FIELD_SEPAPATOR, ICON_KEY, labelTable, MODIFICATION_DATE_KEY, modified, OBJECT_CLASS_KEY, PROGRAM_KEY, requiredVector, RESOURCE_KEY, upToDate, valueTable
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DirectoryNode(java.lang.String name, java.lang.String type)
          Creates a new node.
 
Method Summary
 void add(javax.swing.tree.MutableTreeNode newChild)
          Removes newChild from its parent and makes it a child of this node by adding it to the end of this node's child array.
 java.util.Enumeration administrators()
           
 java.util.Enumeration children(boolean recursiveSearch)
          Returns the list of all child of the same class this node allows.
 java.util.Enumeration children(java.lang.Class objectClass)
          Returns the list of all child of the same class this node allows.
 java.util.Enumeration children(java.lang.Class objectClass, boolean recursiveSearch)
          Returns the list of all child of the same class this node allows.
 boolean getAllowsChildren()
          Returns true if the receiver allows children.
 boolean getAllowsChildren(java.lang.String childType)
          Returns true if the receiver allows children of the designed type.
 void insert(javax.swing.tree.MutableTreeNode newChild, int childIndex)
          Removes newChild from its present parent (if it has a parent), sets the child's parent to this node, and then adds the child to this node's child array at index childIndex.newChild must not be null and must not be an ancestor of this node.
 boolean isLeaf()
          Returns true if the receiver is a leaf.
 java.util.Enumeration leaves()
          Returns the list of all sub leaves of this node.
 java.util.Enumeration leaves(boolean recursiveSearch)
          Returns the list of all sub leaves of this node.
 java.util.Enumeration nodes()
          Returns the list of all sub nodes of this node
 java.util.Enumeration nodes(boolean recursiveSearch)
          Returns the list of all sub nodes of this node
 void setAdministrator(AdministratorAlias administrator)
           
 void setAdministrator(UserAlias administrator)
           
 void setAdministrator(UserSheet administrator)
           
 void setAllowsChildren(boolean allows)
          Determines whether or not this node is allowed to have children.
 void setAllowsChildren(java.lang.String childType, boolean allows)
          Determines whether or not this node is allowed to have children of the designed type.
 void setAttributeValue(java.lang.String attributeKey, java.lang.Object value)
          Sets one attribute of this component.
 void setAttributeValues(java.util.Hashtable updatedTable)
          Sets the attributes of this component.
 void setAttributeValues(MessageHashtable updatedTable)
          Sets the attributes of this component.
private  void setAutorization()
          defines the type of children this node allows.
 
Methods inherited from class org.PingOO.DLAI.lib.directorytree.DirectoryComponent
attributes, getAccessValue, getAccessValues, getAttributeLabel, getAttributeTextKeys, getAttributeValue, getAttributeValues, getDN, getExportationValue, getName, getNewDN, getRDN, getType, hasRequiredAttributes, isAccessible, isModified, isUpToDate, prepareMessage, remove, requiredAttributes, setAccessValue, setAccessValues, setAccessValues, setDefaultAccess, setDefaultExportation, setExportationValue, setModified, setName, setUpToDate
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, readObject, remove, removeAllChildren, removeFromParent, setParent, setUserObject, toString, writeObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

COUNTRY_NODE_CHILD

public static final java.lang.String COUNTRY_NODE_CHILD
defines a country.

DEPARTEMENT_NODE_CHILD

public static final java.lang.String DEPARTEMENT_NODE_CHILD
Defines a departement.

SECTION_NODE_CHILD

public static final java.lang.String SECTION_NODE_CHILD
Defines a section.

ORGANIZATION_NODE_CHILD

public static final java.lang.String ORGANIZATION_NODE_CHILD
Defines an organization.

USER_SHEET_CHILD

public static final java.lang.String USER_SHEET_CHILD
Defines a user sheet.

USER_ALIAS_CHILD

public static final java.lang.String USER_ALIAS_CHILD
Defines a user alias.

ADMINISTRATOR_ALIAS_CHILD

public static final java.lang.String ADMINISTRATOR_ALIAS_CHILD
Defines an administrator alias.

USER_GROUP_CHILD

public static final java.lang.String USER_GROUP_CHILD
Defines a user group.

PEOPLE_HOME_CHILD

public static final java.lang.String PEOPLE_HOME_CHILD
Defines a user group home.

RESOURCE_SHEET_CHILD

public static final java.lang.String RESOURCE_SHEET_CHILD
Defines a resource sheet.

RESOURCE_ALIAS_CHILD

public static final java.lang.String RESOURCE_ALIAS_CHILD
Defines a resource alias.

RESOURCE_GROUP_CHILD

public static final java.lang.String RESOURCE_GROUP_CHILD
Defines a resource group.
Not implemented yet.

RESOURCE_HOME_CHILD

public static final java.lang.String RESOURCE_HOME_CHILD
Defines a resource group.
Not implemented yet.

LIST_SHEET_CHILD

public static final java.lang.String LIST_SHEET_CHILD
Defines a list sheet.

LIST_GROUP_CHILD

public static final java.lang.String LIST_GROUP_CHILD
Defines a list group.
Not implemented yet.

LIST_HOME_CHILD

public static final java.lang.String LIST_HOME_CHILD
Defines a list home.
Not implemented yet.

ALLOW_KEY

public static final java.lang.String ALLOW_KEY
The list of this component attributes.

childrenAllowed

protected final java.util.Hashtable childrenAllowed
Constructor Detail

DirectoryNode

public DirectoryNode(java.lang.String name,
                     java.lang.String type)
Creates a new node.
Parameters:
name - This node's name.
type - The type of this node.
Method Detail

setAttributeValues

public final void setAttributeValues(MessageHashtable updatedTable)
Sets the attributes of this component.
Parameters:
updatedTable - The table that contains the new attributes for this object.
Overrides:
setAttributeValues in class DirectoryComponent

setAttributeValues

public void setAttributeValues(java.util.Hashtable updatedTable)
Sets the attributes of this component.
Parameters:
updatedTable - The table that contains the new attributes for this object.
Overrides:
setAttributeValues in class DirectoryComponent

setAttributeValue

public void setAttributeValue(java.lang.String attributeKey,
                              java.lang.Object value)
Sets one attribute of this component.
Parameters:
attributeKey - The attribute's key.
value - The new value for this attribute.
Overrides:
setAttributeValue in class DirectoryComponent

setAutorization

private final void setAutorization()
defines the type of children this node allows.

getAllowsChildren

public boolean getAllowsChildren()
Returns true if the receiver allows children.
Returns:
true if the receiver allows children, false otherwise.
Overrides:
getAllowsChildren in class javax.swing.tree.DefaultMutableTreeNode

getAllowsChildren

public boolean getAllowsChildren(java.lang.String childType)
Returns true if the receiver allows children of the designed type.
Parameters:
childType - The type to test.
Returns:
true if the receiver allows children of this type, false otherwise.

setAllowsChildren

public final void setAllowsChildren(boolean allows)
Determines whether or not this node is allowed to have children.
If allows is false, all of this node's children are removed.

Note : by default, a node does not allows children.

Parameters:
allows - true if this node is allowed to have children.
Overrides:
setAllowsChildren in class javax.swing.tree.DefaultMutableTreeNode

setAllowsChildren

public final void setAllowsChildren(java.lang.String childType,
                                    boolean allows)
Determines whether or not this node is allowed to have children of the designed type.
If allows is false, all of this node's children that have this type are removed.

Note: By default, a node allows all types of children.

Parameters:
childType - The type to be removed.
allows - true if this node is allowed to have children of this type.

isLeaf

public final boolean isLeaf()
Returns true if the receiver is a leaf.
Returns:
true if the receiver is a leaf, false otherwise.
Overrides:
isLeaf in class javax.swing.tree.DefaultMutableTreeNode

children

public java.util.Enumeration children(boolean recursiveSearch)
Returns the list of all child of the same class this node allows.
Parameters:
recursiveSearch - If true look for all children under this node.
Overrides:
children in class DirectoryComponent

children

public java.util.Enumeration children(java.lang.Class objectClass)
Returns the list of all child of the same class this node allows.
Parameters:
objectClass - The class used to filter the children.
Overrides:
children in class DirectoryComponent

children

public java.util.Enumeration children(java.lang.Class objectClass,
                                      boolean recursiveSearch)
Returns the list of all child of the same class this node allows.
Parameters:
recursiveSearch - If true look for all children under this node.
objectClass - The class used to filter the children.
Overrides:
children in class DirectoryComponent

setAdministrator

public final void setAdministrator(AdministratorAlias administrator)

setAdministrator

public final void setAdministrator(UserSheet administrator)

setAdministrator

public final void setAdministrator(UserAlias administrator)

nodes

public java.util.Enumeration nodes()
Returns the list of all sub nodes of this node
Returns:
The list of all sub nodes of this node

nodes

public java.util.Enumeration nodes(boolean recursiveSearch)
Returns the list of all sub nodes of this node
Parameters:
recursiveSearch - If true look for all nodes under this node.
Returns:
The list of all sub nodes of this node

leaves

public java.util.Enumeration leaves()
Returns the list of all sub leaves of this node.
Returns:
The list of all sub nodes of this node

leaves

public java.util.Enumeration leaves(boolean recursiveSearch)
Returns the list of all sub leaves of this node.
Parameters:
recursiveSearch - If true look for all leaves under this node.
Returns:
The list of all sub nodes of this node

administrators

public final java.util.Enumeration administrators()

add

public void add(javax.swing.tree.MutableTreeNode newChild)
Removes newChild from its parent and makes it a child of this node by adding it to the end of this node's child array.
Parameters:
newChild - The noode to add as a child of this node.
Overrides:
add in class DirectoryComponent

insert

public void insert(javax.swing.tree.MutableTreeNode newChild,
                   int childIndex)
            throws java.lang.ArrayIndexOutOfBoundsException,
                   java.lang.IllegalArgumentException,
                   java.lang.IllegalStateException
Removes newChild from its present parent (if it has a parent), sets the child's parent to this node, and then adds the child to this node's child array at index childIndex.newChild must not be null and must not be an ancestor of this node.
Parameters:
newChild - The MutableTreeNode to insert under this node.
childIndex - The index in this node's child array where this node is to be inserted.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If childIndex is out of bounds.
java.lang.IllegalArgumentException - If newChild is null or is an ancestor of this node.
java.lang.IllegalStateException - If this node does not allow children.
Overrides:
insert in class DirectoryComponent