org.jwarp.flow.form.model
Class Container

java.lang.Object
  |
  +--org.jwarp.flow.form.model.Component
        |
        +--org.jwarp.flow.form.model.Container
All Implemented Interfaces:
IComponent, IContainer
Direct Known Subclasses:
Form, Navigation

public abstract class Container
extends Component
implements IContainer

A generic JWeb container object is a component that can contain other element components.

Components added to a container are tracked in a list. The order of the list will define the components' front-to-back stacking order within the container. If no index is specified when adding a component to a container, it will be added to the end of the list (and hence to the bottom of the stacking order).

Version:
1.0, 02/01/01
Author:
Anatole Tresch
See Also:
Container

Field Summary
 java.util.Vector components
          The actual subcomponents
 java.util.Vector containerListeners
          The registered listeners
 
Fields inherited from class org.jwarp.flow.form.model.Component
componentListeners, description, enabled, id, locale, name, parent
 
Constructor Summary
Container(int id, java.lang.String name, IContainer parent)
           
Container(java.lang.String name, IContainer parent)
           
 
Method Summary
 void add(IComponent comp)
          Adds the specified component to the end of this container.
 void add(IComponent comp, int index)
          Adds the specified component to this container at the given position.
 void addContainerListener(IContainerListener l)
          Adds the specified container listener to receive container events from this container.
 boolean contains(IComponent c)
          Checks if the component is contained in the component hierarchy of this container.
 IComponent getComponent(int n)
          Gets the nth component in this container.
 int getComponentCount()
          Gets the number of components in this panel.
 java.util.Iterator getComponents()
          Gets all the components in this container.
 void handleEvent(ComponentEvent event)
          Handles the events.
 void remove(IComponent comp)
          Removes the specified component from this container.
 IComponent remove(int index)
          Removes the component, specified by index, from this container.
 void removeAll()
          Removes all the components from this container.
 void removeContainerListener(IContainerListener l)
          Removes the specified container listener so it no longer receives container events from this container.
 
Methods inherited from class org.jwarp.flow.form.model.Component
addComponentListener, getDescription, getFullName, getID, getListeners, getLocale, getName, getParent, getXMLTree, isEnabled, removeComponentListener, setDescription, setEnabled, setFlowData, setLocale, setName, setParent
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jwarp.flow.form.model.IComponent
addComponentListener, getDescription, getFullName, getID, getListeners, getLocale, getName, getParent, getXMLTree, isEnabled, removeComponentListener, setEnabled, setFlowData, setLocale
 

Field Detail

components

public java.util.Vector components
The actual subcomponents

containerListeners

public java.util.Vector containerListeners
The registered listeners
Constructor Detail

Container

public Container(int id,
                 java.lang.String name,
                 IContainer parent)

Container

public Container(java.lang.String name,
                 IContainer parent)
Method Detail

getComponentCount

public int getComponentCount()
Gets the number of components in this panel.
Specified by:
getComponentCount in interface IContainer
Returns:
the number of components in this panel.
Since:
JDK1.1
See Also:
Container.getComponent(int)

getComponent

public IComponent getComponent(int n)
Gets the nth component in this container.
Specified by:
getComponent in interface IContainer
Parameters:
n - the index of the component to get.
Returns:
the nth component in this container.
Throws:
ArrayIndexOutOfBoundsException - if the nth value does not exist.

getComponents

public java.util.Iterator getComponents()
Gets all the components in this container.
Specified by:
getComponents in interface IContainer
Returns:
an array of all the components in this container.

add

public void add(IComponent comp)
Adds the specified component to the end of this container.
Specified by:
add in interface IContainer
Parameters:
comp - the component to be added.
Returns:
the component argument.

add

public void add(IComponent comp,
                int index)
Adds the specified component to this container at the given position.
Specified by:
add in interface IContainer
Parameters:
comp - the component to be added.
index - the position at which to insert the component, or -1 to insert the component at the end.
Returns:
the component comp
See Also:
remove(int)

remove

public IComponent remove(int index)
Removes the component, specified by index, from this container.
Specified by:
remove in interface IContainer
Parameters:
index - the index of the component to be removed.
See Also:
add(org.jwarp.flow.form.model.IComponent)

remove

public void remove(IComponent comp)
Removes the specified component from this container.
Specified by:
remove in interface IContainer
Parameters:
comp - the component to be removed
See Also:
add(org.jwarp.flow.form.model.IComponent)

removeAll

public void removeAll()
Removes all the components from this container.
Specified by:
removeAll in interface IContainer
See Also:
add(org.jwarp.flow.form.model.IComponent), remove(int)

addContainerListener

public void addContainerListener(IContainerListener l)
Adds the specified container listener to receive container events from this container.
Specified by:
addContainerListener in interface IContainer
Parameters:
l - the container listener

removeContainerListener

public void removeContainerListener(IContainerListener l)
Removes the specified container listener so it no longer receives container events from this container. If l is null, no exception is thrown and no action is performed.
Specified by:
removeContainerListener in interface IContainer
Parameters:
l - the container listener

contains

public boolean contains(IComponent c)
Checks if the component is contained in the component hierarchy of this container.
Specified by:
contains in interface IContainer
Parameters:
c - the component
Returns:
true if it is an ancestor; false otherwise.
Since:
JDK1.1

handleEvent

public void handleEvent(ComponentEvent event)
Description copied from interface: IComponent
Handles the events.
Specified by:
handleEvent in interface IComponent
Overrides:
handleEvent in class Component
Following copied from interface: org.jwarp.flow.form.model.IComponent
Parameters:
event - The event to be handled

©   O R C A   S y s t e m s