com.virtualweaver.xotics.datamodel
Class XoContainerSupport

java.lang.Object
  extended bycom.virtualweaver.xotics.datamodel.XoObjectSupport
      extended bycom.virtualweaver.xotics.datamodel.XoContainerSupport
All Implemented Interfaces:
java.lang.Cloneable, XoContainer, XoNode, XoObject

public class XoContainerSupport
extends XoObjectSupport
implements XoContainer

This is a default XoContainer implementation developpers can use, by derivation, to increase productivity when an XoContainer implementation has no requirement to derive from any specific Java object.

Version:
4.1

Field Summary
protected  XoContainerEventSupport containerEventSupport
          container event support object, usable by derived object from this
 
Fields inherited from class com.virtualweaver.xotics.datamodel.XoObjectSupport
propertyChangeSupport, vetoableChangeSupport
 
Constructor Summary
XoContainerSupport()
          Empty param constructor, as required in JavaBeans specs.
 
Method Summary
 int addXoChild(XoObject child, int index)
          Adds an XO Object as child, at index specified by index param.
 void addXoContainerListener(XoContainerListener listener)
          Adds a listener of XoContainerEvent.
 java.lang.Object clone()
          Updated from XoObject.clone() to clone this container
 XoObject[] getXoChildren()
          Returns the XO children objects as an XoObject array.
 XoObject getXoChildren(int index)
          Returns the XO child object standing at index position.
 int getXoChildrenCount()
          Returns the number of children of this XO Container.
 XoContainerListener[] getXoContainerListeners()
          Returns the registered listeners of XoContainerEvent fired for this container.
 XoContentModel getXoContentModel()
          This method returns null, as there is no content-model defined here.
 boolean isXoObjectWelcome(XoObject maybeChild, int index)
          This method returns allways true and so should be overriden to perform specific checks
 XoObject removeXoChild(int index)
          Removes the child at the index position from the list of children.
 void removeXoContainerListener(XoContainerListener listener)
          Removes a listener of XoContainerEvent previously added by corresponding add method.
 
Methods inherited from class com.virtualweaver.xotics.datamodel.XoObjectSupport
addPropertyChangeListener, addVetoableChangeListener, checkXoValidity, clone, equalsXoObject, getLocale, getXmlLocalName, getXmlNameSpace, getXmlWhiteSpace, getXoDMInstance, getXoParent, isXoPropertyToWrite, removePropertyChangeListener, removeVetoableChangeListener, setIntegrated, setLocale, setXmlLocalName, setXmlNameSpace, setXmlWhiteSpace, setXoDMInstance, setXoParent, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.virtualweaver.xotics.datamodel.XoObject
addPropertyChangeListener, addVetoableChangeListener, checkXoValidity, equalsXoObject, getLocale, getXmlLocalName, getXmlNameSpace, getXmlWhiteSpace, getXoDMInstance, getXoParent, isXoPropertyToWrite, removePropertyChangeListener, removeVetoableChangeListener, setIntegrated, setLocale, setXmlLocalName, setXmlNameSpace, setXmlWhiteSpace, setXoDMInstance, setXoParent
 

Field Detail

containerEventSupport

protected XoContainerEventSupport containerEventSupport
container event support object, usable by derived object from this

Constructor Detail

XoContainerSupport

public XoContainerSupport()
Empty param constructor, as required in JavaBeans specs.

Method Detail

getXoChildren

public XoObject getXoChildren(int index)
                       throws java.lang.ArrayIndexOutOfBoundsException
Description copied from interface: XoContainer
Returns the XO child object standing at index position.

Specified by:
getXoChildren in interface XoContainer
Parameters:
index - the position where resides the object to get
Returns:
the object wanted
Throws:
java.lang.ArrayIndexOutOfBoundsException - when the index param is invalid
See Also:
XoContainer.getXoChildren(int)

getXoChildren

public XoObject[] getXoChildren()
Description copied from interface: XoContainer
Returns the XO children objects as an XoObject array.

Specified by:
getXoChildren in interface XoContainer
Returns:
the children array
See Also:
XoContainer.getXoChildren()

getXoContentModel

public XoContentModel getXoContentModel()
This method returns null, as there is no content-model defined here.

Specified by:
getXoContentModel in interface XoContainer
Returns:
null.
See Also:
XoContainer.getXoContentModel()

addXoChild

public int addXoChild(XoObject child,
                      int index)
               throws XoException
Description copied from interface: XoContainer
Adds an XO Object as child, at index specified by index param. It is allowed for index to be equal to -1 or XoContainer.getXoChildrenCount() : these both values indicate to append child at the end of current children list.

Specified by:
addXoChild in interface XoContainer
Parameters:
child - the XO object to add as new child
index - position in children list where to add child : -1 and getXoChildrenCount() are valid indexes.
Returns:
effective add index
Throws:
XoException - when :
  • child param is null, or represents an invalid XO object (for example when it is not allowed to add such kind of object),
  • when index is out of bounds, or when child can not be inserted at this index,
  • or for any other reason depending on specific implementations
See Also:
XoContainer.addXoChild(com.virtualweaver.xotics.datamodel.XoObject, int)

addXoContainerListener

public void addXoContainerListener(XoContainerListener listener)
Description copied from interface: XoContainer
Adds a listener of XoContainerEvent. Such event is fired by an XoDMInstance after a complete add/remove child process.

Specified by:
addXoContainerListener in interface XoContainer
Parameters:
listener - a listener of type XoContainerListener to add
See Also:
XoContainer.addXoContainerListener(XoContainerListener)

removeXoContainerListener

public void removeXoContainerListener(XoContainerListener listener)
Description copied from interface: XoContainer
Removes a listener of XoContainerEvent previously added by corresponding add method.

Specified by:
removeXoContainerListener in interface XoContainer
Parameters:
listener - a listener of type XoContainerListener to remove
See Also:
XoContainer.removeXoContainerListener(XoContainerListener)

getXoContainerListeners

public XoContainerListener[] getXoContainerListeners()
Description copied from interface: XoContainer
Returns the registered listeners of XoContainerEvent fired for this container. The event fire process is managed by XoDMInstance owner of this container. So, it needs to get the list of listeners on this container object.

Specified by:
getXoContainerListeners in interface XoContainer
Returns:
the listeners of type XoContainerEvent registered for this container
See Also:
XoContainer.getXoContainerListeners()

getXoChildrenCount

public int getXoChildrenCount()
Description copied from interface: XoContainer
Returns the number of children of this XO Container.

Specified by:
getXoChildrenCount in interface XoContainer
Returns:
the number of children of this container
See Also:
XoContainer.getXoChildrenCount()

isXoObjectWelcome

public boolean isXoObjectWelcome(XoObject maybeChild,
                                 int index)
This method returns allways true and so should be overriden to perform specific checks

Specified by:
isXoObjectWelcome in interface XoContainer
Parameters:
maybeChild - the object to check whether it can be added
index - the index where willing to add maybeChild
Returns:
true
See Also:
XoContainer.isXoObjectWelcome(XoObject, int)

removeXoChild

public XoObject removeXoChild(int index)
                       throws java.lang.ArrayIndexOutOfBoundsException
Description copied from interface: XoContainer
Removes the child at the index position from the list of children.

Specified by:
removeXoChild in interface XoContainer
Parameters:
index - position where the child to remove resides
Returns:
the child removed
Throws:
java.lang.ArrayIndexOutOfBoundsException - if there is no child at the specified index
See Also:
XoContainer.removeXoChild(int)

clone

public java.lang.Object clone()
Updated from XoObject.clone() to clone this container

Specified by:
clone in interface XoObject
Overrides:
clone in class XoObjectSupport
Returns:
a new instance of this Xo Container