org.PingOO.DLAI.lib.directorytree
Class DirectoryComponent

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

public abstract class DirectoryComponent
extends javax.swing.tree.DefaultMutableTreeNode

Common abstract class for all directory components.

Since:
PingOO 2.0
Version:
2.0
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
DefaultMutableTreeNode, 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
protected  java.util.Hashtable accessTable
          Defines the access rights of the current user on the visible fields.
protected  java.util.Vector attributeVector
          Vector of the component's attributes (keys).
static java.lang.String CREATION_DATE_KEY
           
static java.lang.String DESCRIPTION_KEY
           
static java.lang.String DN_SEPAPATOR
           
protected static java.lang.String[] EMPTY_ARRAY_ATTRIBUTE
           
static java.lang.String EXPIRATION_DATE_KEY
           
protected  java.util.Hashtable exportationTable
          Defines if a field is exportable.
static java.lang.String FIELD_SEPAPATOR
           
static java.lang.String ICON_KEY
           
protected  java.util.Hashtable labelTable
          Contains the label (titleKey in fact) associated with each ressource.
static java.lang.String MODIFICATION_DATE_KEY
           
protected  boolean modified
          Indicates if the componet has been modified.
static java.lang.String OBJECT_CLASS_KEY
           
static java.lang.String PROGRAM_KEY
           
protected  java.util.Vector requiredVector
          Vector of required fields.
static java.lang.String RESOURCE_KEY
           
protected  boolean upToDate
          Indicates if the component have all is up to date attributes.
protected  java.util.Hashtable valueTable
          Contains the values associated with each resource.
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DirectoryComponent(java.lang.String name, java.lang.String type)
          Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object.
DirectoryComponent(java.lang.String name, java.lang.String type, boolean allowsChildren)
          Creates a tree node with no parent, no children, initialized with the specified user object, and that allows children only if specified.
 
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 attributes()
          Returns an enumeration of all attributes in this node.
abstract  java.util.Enumeration children(boolean recursiveSearch)
          Returns the list of all child of the same class this node allows.
abstract  java.util.Enumeration children(java.lang.Class objectClass)
          Returns the list of all child of the same class this node allows.
abstract  java.util.Enumeration children(java.lang.Class objectClass, boolean recursiveSearch)
          Returns the list of all child of the same class this node allows.
 boolean getAccessValue(java.lang.String attributeKey)
           
 java.util.Hashtable getAccessValues()
          Returns a copy of this node's access table.
 java.lang.String getAttributeLabel(java.lang.String attributeKey)
          Returns the default label associated with a given value.
 java.util.Hashtable getAttributeTextKeys()
          Returns a copy of this node's attributes' labels table.
 java.lang.Object getAttributeValue(java.lang.String attributeKey)
          Returns one of this node's attribute's value .
 java.util.Hashtable getAttributeValues()
          Returns a copy of this node's attributes table.
 java.lang.String getDN()
          Returns the dinstinguished name of this component.
 boolean getExportationValue(java.lang.String attributeKey)
           
 java.lang.String getName()
          Return the name of this component.
static java.lang.String getNewDN(DirectoryComponent parentComponent, DirectoryComponent childComponent)
          Return a new complete DN for a new component that is about inserted in the tree.
 java.lang.String getRDN()
          Returns the relative dinstinguished name of this component.
abstract  java.lang.String getType()
          Returns the type of this component.
 boolean hasRequiredAttributes()
          Tests if this component has the required attributes.
 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 isAccessible()
           
 boolean isModified()
          Indicates if this node has been modified.
 boolean isUpToDate()
          Indicates if this node has up to date informations.
 void prepareMessage(MessageHashtable message)
           
 void remove(javax.swing.tree.MutableTreeNode aChild)
          Removes aChild from this node's child array, giving it a null parent.
 java.util.Enumeration requiredAttributes()
          Returns an enumeration of the required attributes for this node.
 void setAccessValue(java.lang.String attributeKey, boolean value)
           
 void setAccessValues(java.util.Hashtable updatedTable)
           
 void setAccessValues(MessageHashtable updatedTable)
           
 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.
 void setDefaultAccess()
          Sets the defautl access on this node (read-only access.
protected  void setDefaultExportation()
           
 void setExportationValue(java.lang.String attributeKey, boolean value)
           
 void setModified(boolean b)
          Sets if this node has been modified.
 void setName(java.lang.String name)
          Sets the name of this component.
 void setUpToDate(boolean b)
          Sets if this node has up to date informations.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, 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, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, readObject, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString, writeObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

EMPTY_ARRAY_ATTRIBUTE

protected static final java.lang.String[] EMPTY_ARRAY_ATTRIBUTE

DN_SEPAPATOR

public static final java.lang.String DN_SEPAPATOR

FIELD_SEPAPATOR

public static final java.lang.String FIELD_SEPAPATOR

OBJECT_CLASS_KEY

public static final java.lang.String OBJECT_CLASS_KEY

CREATION_DATE_KEY

public static final java.lang.String CREATION_DATE_KEY

EXPIRATION_DATE_KEY

public static final java.lang.String EXPIRATION_DATE_KEY

MODIFICATION_DATE_KEY

public static final java.lang.String MODIFICATION_DATE_KEY

RESOURCE_KEY

public static final java.lang.String RESOURCE_KEY

PROGRAM_KEY

public static final java.lang.String PROGRAM_KEY

ICON_KEY

public static final java.lang.String ICON_KEY

DESCRIPTION_KEY

public static final java.lang.String DESCRIPTION_KEY

upToDate

protected boolean upToDate
Indicates if the component have all is up to date attributes.

modified

protected boolean modified
Indicates if the componet has been modified.

attributeVector

protected final java.util.Vector attributeVector
Vector of the component's attributes (keys).

requiredVector

protected final java.util.Vector requiredVector
Vector of required fields.

labelTable

protected final java.util.Hashtable labelTable
Contains the label (titleKey in fact) associated with each ressource.

valueTable

protected final java.util.Hashtable valueTable
Contains the values associated with each resource.

accessTable

protected final java.util.Hashtable accessTable
Defines the access rights of the current user on the visible fields.

exportationTable

protected final java.util.Hashtable exportationTable
Defines if a field is exportable.
Constructor Detail

DirectoryComponent

public DirectoryComponent(java.lang.String name,
                          java.lang.String type)
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object.
Parameters:
name - This component's name.
type - The type of this component.

DirectoryComponent

public DirectoryComponent(java.lang.String name,
                          java.lang.String type,
                          boolean allowsChildren)
Creates a tree node with no parent, no children, initialized with the specified user object, and that allows children only if specified.
Parameters:
name - This component's name.
type - The type of this component.
allowsChildren - If true the component will allow chilfren to be added, if false, it will not be possible to add children.
Method Detail

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 javax.swing.tree.DefaultMutableTreeNode

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 javax.swing.tree.DefaultMutableTreeNode

remove

public void remove(javax.swing.tree.MutableTreeNode aChild)
Removes aChild from this node's child array, giving it a null parent.
Parameters:
aChild - A child of this node to remove.
Overrides:
remove in class javax.swing.tree.DefaultMutableTreeNode

getType

public abstract java.lang.String getType()
Returns the type of this component.
Returns:
The type of this component.

getName

public java.lang.String getName()
Return the name of this component.
Returns:
The name of this component.

setName

public void setName(java.lang.String name)
Sets the name of this component.
Parameters:
name - The new name of this component.

getNewDN

public static final java.lang.String getNewDN(DirectoryComponent parentComponent,
                                              DirectoryComponent childComponent)
Return a new complete DN for a new component that is about inserted in the tree.
Returns:
A new complete DN for a new component that is about inserted in the tree, null if the child component is null.

getRDN

public java.lang.String getRDN()
Returns the relative dinstinguished name of this component.
Returns:
Returns the relative dinstinguished name of this component.

getDN

public java.lang.String getDN()
Returns the dinstinguished name of this component.
Returns:
The dinstinguished name of this component.

children

public abstract 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.

children

public abstract 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.

children

public abstract 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.

prepareMessage

public final void prepareMessage(MessageHashtable message)

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.

setAttributeValues

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

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.

getAttributeValue

public final java.lang.Object getAttributeValue(java.lang.String attributeKey)
Returns one of this node's attribute's value .
Parameters:
attributeKey - The attribute's key.
Returns:
One of this node's attribute's value or null if the key is unknown to this node or if the value is empty.

getAttributeLabel

public final java.lang.String getAttributeLabel(java.lang.String attributeKey)
Returns the default label associated with a given value.
Parameters:
attributeKey - The attribute's key.
Returns:
This node's attribute's default label or null if the key is unknown to this node or if the label is empty.

getAttributeValues

public final java.util.Hashtable getAttributeValues()
Returns a copy of this node's attributes table.
Returns:
A copy of this node's attributes table.

getAttributeTextKeys

public final java.util.Hashtable getAttributeTextKeys()
Returns a copy of this node's attributes' labels table.
Returns:
A copy of this node's attributes' labels table.

hasRequiredAttributes

public boolean hasRequiredAttributes()
Tests if this component has the required attributes.
Returns:
Allways true since the basic required attribute is the object class and all object has its own objectclass.

attributes

public java.util.Enumeration attributes()
Returns an enumeration of all attributes in this node.
Returns:
An enumeration of all attributes in this node.

requiredAttributes

public java.util.Enumeration requiredAttributes()
Returns an enumeration of the required attributes for this node.
Returns:
An enumeration of the required attributes for this node.

setDefaultAccess

public final void setDefaultAccess()
Sets the defautl access on this node (read-only access.

isAccessible

public boolean isAccessible()

getAccessValues

public final java.util.Hashtable getAccessValues()
Returns a copy of this node's access table.
Returns:
A copy of this node's acces table.

setAccessValues

public void setAccessValues(MessageHashtable updatedTable)

setAccessValues

public void setAccessValues(java.util.Hashtable updatedTable)

setAccessValue

public final void setAccessValue(java.lang.String attributeKey,
                                 boolean value)

getAccessValue

public final boolean getAccessValue(java.lang.String attributeKey)

setDefaultExportation

protected final void setDefaultExportation()

setExportationValue

public final void setExportationValue(java.lang.String attributeKey,
                                      boolean value)

getExportationValue

public final boolean getExportationValue(java.lang.String attributeKey)

isUpToDate

public final boolean isUpToDate()
Indicates if this node has up to date informations.
Returns:
true if this node has up to date informations, false otherwise.

setUpToDate

public final void setUpToDate(boolean b)
Sets if this node has up to date informations.
Parameters:
b - true if this node has up to date informations, false otherwise.

isModified

public final boolean isModified()
Indicates if this node has been modified.
Returns:
true if this node has been modified, false otherwise.

setModified

public final void setModified(boolean b)
Sets if this node has been modified.
Parameters:
b - true if this node has been modified, false otherwise.