com.novell.admin.ns
Class ValueList

java.lang.Object
  extended bycom.novell.admin.ns.ValueComponent
      extended bycom.novell.admin.ns.ValueList
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public final class ValueList
extends ValueComponent
implements java.beans.PropertyChangeListener, java.lang.Cloneable, java.io.Serializable

Storage for all composite syntax types.

This class is used to store syntaxes that are composed of more than one atomic type, even of the same type. This class is mutable and generates PropertyChangeEvents when any change occurs.

See Also:
Serialized Form

Constructor Summary
ValueList(Syntax syn)
          Constructs a ValueList object.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a property change listener.
 boolean canInsertComponent(ValueComponent comp)
          Determines if this a specific typed of ValueComponent can be inserted into this ValueList.
 boolean canRemoveComponent(ValueComponent comp)
          Tests to determine if a specific ValueComponent can be removed from this list.
 java.lang.Object clone()
          Creates an exact duplicate of this ValueList.
 boolean contains(ValueComponent comp)
          Determines if the current list contains a specific ValueComponent.
 java.lang.Object createFacade()
          Returns the facade for this value list.
 int getComponentCount()
          Returns the number of components in the list.
 java.util.Enumeration getComponents()
          Returns an Enumeration of the ValueComponents in the list.
 ValueComponent getElementAt(int index)
          Returns a ValueComponent located at a specific location in the list.
 ValueList getRootListClone()
          ObjectAttribute calls this to get the old value component for the root list.
 int indexOf(ValueComponent comp)
          Returns the index of a specific ValueComponent in the list.
 void initList(ValueComponent comp)
          Shortcut method used to populate the list with ValueComponents.
 boolean insertComponent(ValueComponent comp)
          Inserts a ValueComponent at the end of this list.
 boolean insertComponentAt(ValueComponent comp, int index)
          Inserts a ValueComponent into a specific position in this list.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Handles property change notification from subordinate ValueLists.
 boolean removeComponent(ValueComponent comp)
          Removes a specific ValueComponent from this list.
 boolean removeComponentAt(int index)
          Removes a ValueComponent from a specific position.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener.
 boolean replaceComponent(ValueComponent oldComp, ValueComponent newComp)
          Replaces a specific ValueComponent with another.
 boolean replaceComponentAt(ValueComponent newComp, int index)
          Replaces a specific ValueComponent with another.
 void setListAsRoot()
          Sets the current list as the root ValueList.
 
Methods inherited from class com.novell.admin.ns.ValueComponent
compareTo, equals, getSyntax, isWithinBounds, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ValueList

public ValueList(Syntax syn)
Constructs a ValueList object.

Parameters:
syn - The syntax associated with this list.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener.

Parameters:
listener - The listener being added.

canInsertComponent

public boolean canInsertComponent(ValueComponent comp)
Determines if this a specific typed of ValueComponent can be inserted into this ValueList.

Parameters:
comp - ValueComponent to test.
Returns:
True if the component can be inserted into this list, otherwise false

canRemoveComponent

public boolean canRemoveComponent(ValueComponent comp)
Tests to determine if a specific ValueComponent can be removed from this list.

Parameters:
comp - The ValueComponent to test.
Returns:
True if comp can be removed from this list, otherwise false.

clone

public java.lang.Object clone()
Creates an exact duplicate of this ValueList.

Returns:
New ValueList as an Object type.

contains

public boolean contains(ValueComponent comp)
Determines if the current list contains a specific ValueComponent.

Parameters:
comp - The component to check for.
Returns:
True if the component is in the list, false otherwise.

createFacade

public java.lang.Object createFacade()
Returns the facade for this value list.

Returns:
A newly constructed facade for this value list, or null if none is defined.

getComponentCount

public int getComponentCount()
Returns the number of components in the list.

Returns:
The number of components in the list.

getComponents

public java.util.Enumeration getComponents()
Returns an Enumeration of the ValueComponents in the list.

Returns:
An Enumeration of ValueComponents.

getElementAt

public ValueComponent getElementAt(int index)
                            throws java.lang.ArrayIndexOutOfBoundsException
Returns a ValueComponent located at a specific location in the list.

Parameters:
index - The index of the specific item in the list.
Returns:
The specified ValueComponent in the list.
Throws:
java.lang.ArrayIndexOutOfBoundsException - Thrown when the index is not in the value list.

getRootListClone

public ValueList getRootListClone()
ObjectAttribute calls this to get the old value component for the root list.

This is used as the oldComponent for changes made in this value list.

Returns:
The old value component for the root list or null if not root list.

indexOf

public int indexOf(ValueComponent comp)
Returns the index of a specific ValueComponent in the list.

Parameters:
comp - The component to return.
Returns:
The index of the component if found; otherwise returns -1.

initList

public void initList(ValueComponent comp)
Shortcut method used to populate the list with ValueComponents.

This method does not check for compatibility and does not notify listeners. This should be called only by syntax strategies. Applications should not call this method directly.

Parameters:
comp - The ValueComponent to insert into the list.

insertComponent

public boolean insertComponent(ValueComponent comp)
Inserts a ValueComponent at the end of this list.

Parameters:
comp - The ValueComponent to insert.
Returns:
True if the ValueComponent was inserted successfully, otherwise false.

insertComponentAt

public boolean insertComponentAt(ValueComponent comp,
                                 int index)
                          throws java.lang.ArrayIndexOutOfBoundsException
Inserts a ValueComponent into a specific position in this list.

Parameters:
comp - The ValueComponent to insert.
Returns:
True if the ValueComponent was inserted successfully, otherwise false.
Throws:
java.lang.ArrayIndexOutOfBoundsException - index is not in the value list.

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Handles property change notification from subordinate ValueLists.

ValueLists are registered as listeners to subordinate value lists. If subordinate value lists are modified, the current ValueList is notified. Values are not mutable, so Value objects do not return events.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - The event that caused a property change to occur.

removeComponent

public boolean removeComponent(ValueComponent comp)
Removes a specific ValueComponent from this list.

Parameters:
comp - The ValueComponent to remove.
Returns:
True if the ValueComponent was removed successfully, otherwise false.

removeComponentAt

public boolean removeComponentAt(int index)
Removes a ValueComponent from a specific position.

This method should only be used on syntaxes with optional components at the end, such as NameAndUID. It does not call the canRemoveComponent() check.

Parameters:
index - The index of the ValueComponent to remove.
Returns:
True if the ValueComponent was removed successfully, otherwise false.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener.

Parameters:
listener - The listener being removed.

replaceComponent

public boolean replaceComponent(ValueComponent oldComp,
                                ValueComponent newComp)
Replaces a specific ValueComponent with another.

This is the only way to modify a ValueList when individual values cannot be removed or inserted.

Parameters:
oldComp - The ValueComponent to be replaced
newComp - The replacement ValueComponent.
Returns:
True if the ValueComponent was replaced successfully, otherwise false.

replaceComponentAt

public boolean replaceComponentAt(ValueComponent newComp,
                                  int index)
                           throws java.lang.ArrayIndexOutOfBoundsException
Replaces a specific ValueComponent with another.

This is the only way to modify a ValueList when individual values cannot be removed or inserted.

Parameters:
newComp - The replacement ValueComponent.
index - The location of the component to replace.
Returns:
True if the ValueComponent was replaced successfully, otherwise false.
Throws:
java.lang.ArrayIndexOutOfBoundsException - Thrown when the index is not in the value list.

setListAsRoot

public void setListAsRoot()
Sets the current list as the root ValueList.

An ObjectAttribute calls this method to indicate this is the top-most top ValueList. This is used as the oldComponent for changes made in this value list.



API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.