org.opencms.workplace.tools
Class CmsIdentifiableObjectContainer

java.lang.Object
  extended byorg.opencms.workplace.tools.CmsIdentifiableObjectContainer
All Implemented Interfaces:
I_CmsIdentifiableObjectContainer

public class CmsIdentifiableObjectContainer
extends java.lang.Object
implements I_CmsIdentifiableObjectContainer

Default implementation of a named object container.

It can handle relative or absolute orderings and unique names.

Since:
6.0.0
Version:
$Revision: 1.3 $
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)
Description copied from interface: I_CmsIdentifiableObjectContainer
Appends the specified object to the end of this container.

Specified by:
addIdentifiableObject in interface I_CmsIdentifiableObjectContainer
Parameters:
id - the object identifier
idObject - the object add to the container
See Also:
I_CmsIdentifiableObjectContainer.addIdentifiableObject(java.lang.String, java.lang.Object)

addIdentifiableObject

public void addIdentifiableObject(java.lang.String id,
                                  java.lang.Object idObject,
                                  float position)
Description copied from interface: I_CmsIdentifiableObjectContainer
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).

Specified by:
addIdentifiableObject in interface I_CmsIdentifiableObjectContainer
Parameters:
id - the object identifier
idObject - the object add to the container
position - the insertion point
See Also:
I_CmsIdentifiableObjectContainer.addIdentifiableObject(java.lang.String, java.lang.Object, float)

clear

public void clear()
Description copied from interface: I_CmsIdentifiableObjectContainer
Resets the container.

Specified by:
clear in interface I_CmsIdentifiableObjectContainer
See Also:
I_CmsIdentifiableObjectContainer.clear()

elementList

public java.util.List elementList()
Description copied from interface: I_CmsIdentifiableObjectContainer
Returns the list of objects.

Specified by:
elementList in interface I_CmsIdentifiableObjectContainer
Returns:
the a list of Objects.
See Also:
I_CmsIdentifiableObjectContainer.elementList()

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.

Specified by:
getObject in interface I_CmsIdentifiableObjectContainer
Parameters:
id - the id of the object
Returns:
the object if found, or null
See Also:
I_CmsIdentifiableObjectContainer.getObject(String)

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