org.opencms.workplace.tools
Class CmsIdentifiableObjectContainer

java.lang.Object
  extended by org.opencms.workplace.tools.CmsIdentifiableObjectContainer

public class CmsIdentifiableObjectContainer
extends java.lang.Object

Default implementation of a named object container.

It can handle relative or absolute orderings and unique names.

Since:
6.0.0
Version:
$Revision: 1.8 $
Author:
Michael Moossen

Constructor Summary
CmsIdentifiableObjectContainer(boolean uniqueIds, boolean relativeOrdered)
          Default Constructor.
 
Method Summary
 void addIdentifiableObject(java.lang.String id, java.lang.Object idObject)
          Appends the specified object to the end of this container.
 void addIdentifiableObject(java.lang.String id, java.lang.Object idObject, float position)
          Inserts the specified object at the specified position in this container.
 void clear()
          Resets the container.
 java.util.List elementList()
          Returns the list of objects.
 java.lang.Object getObject(java.lang.String id)
          Returns the object with the given id.
 void removeObject(java.lang.String id)
          Removes an object with the given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsIdentifiableObjectContainer

public CmsIdentifiableObjectContainer(boolean uniqueIds,
                                      boolean relativeOrdered)
Default Constructor.

Parameters:
uniqueIds - if the list show check for unique ids
relativeOrdered - if the list show use relative ordering, instead of absolute ordering
Method Detail

addIdentifiableObject

public void addIdentifiableObject(java.lang.String id,
                                  java.lang.Object idObject)
Appends the specified object to the end of this container.

Parameters:
id - the object identifier
idObject - the object add to the container
See Also:
List.add(Object)

addIdentifiableObject

public void addIdentifiableObject(java.lang.String id,
                                  java.lang.Object idObject,
                                  float position)
Inserts the specified object at the specified position in this container.

Shifts the object currently at that position (if any) and any subsequent objects to the right (adds one to their indices).

Parameters:
id - the object identifier
idObject - the object add to the container
position - the insertion point
See Also:
List.add(int, Object)

clear

public void clear()
Resets the container.


elementList

public java.util.List elementList()
Returns the list of objects.

Returns:
the a list of Objects.

getObject

public java.lang.Object getObject(java.lang.String id)
Returns the object with the given id.

If uniqueIds is set to false an Object containing a List with all the objects with the given id is returned.

If the container no contains any object with the given id, null is returned.

Parameters:
id - the id of the object
Returns:
the object if found, or null
See Also:
Map.get(Object)

removeObject

public void removeObject(java.lang.String id)
Removes an object with the given id.

if m_uniqueIds is set, it will remove at most one object. otherwise it will remove all elements with the given id.

Parameters:
id - the id of the object to remove