com.arsdigita.bebop
Interface Container

All Superinterfaces:
Component, Lockable
All Known Implementing Classes:
FormSection, Page, SimpleContainer

public interface Container
extends Component

The common interface that is implemented by all Bebop containers. The Container interface extends the Component interface. A container is simply a component that contains other components.

Version:
$Id: //core-platform/dev/src/com/arsdigita/bebop/Container.java#8 $
Author:
David Lutterkort, Uday Mathur

Field Summary
static String versionId
           
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Method Summary
 void add(Component pc)
          Adds a component to this container.
 void add(Component c, int constraints)
          Adds a component with the specified layout constraints to this container.
 boolean contains(Object o)
          Returns true if this list contains the specified element.
 Component get(int index)
          Gets the component at the specified position.
 int indexOf(Component pc)
           
 boolean isEmpty()
          Returns true if the container contains no components.
 int size()
          Returns the number of elements in this container.
 
Methods inherited from interface com.arsdigita.bebop.Component
children, generateXML, getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, register, respond, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked, lock
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Method Detail

add

public void add(Component pc)
Adds a component to this container.

Parameters:
pc - component to add to this container

add

public void add(Component c,
                int constraints)
Adds a component with the specified layout constraints to this container. Layout constraints are defined in each layout container as static ints. To specify multiple constraints, uses bitwise OR.

Parameters:
constraints - layout constraints (a bitwise OR of static ints in the particular layout)

contains

public boolean contains(Object o)
Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).

This method returns true only if the object has been directly added to this container. If this container contains another container that contains this object, this method returns false.

Parameters:
o - element whose presence in this container is to be tested
Returns:
true if this container contains the specified object directly; false otherwise.

get

public Component get(int index)
Gets the component at the specified position. Each call to the add method increments the index. Since the user has no control over the index of added components (other than counting each call to the add method), this method should be used in conjunction with indexOf.

Parameters:
index - the index of the item to be retrieved from this container
Returns:
the component at the specified position in this container.

indexOf

public int indexOf(Component pc)
Parameters:
pc - component to search for
Returns:
the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.

isEmpty

public boolean isEmpty()
Returns true if the container contains no components.

Returns:
true if this container contains no components; false otherwise.

size

public int size()
Returns the number of elements in this container. This does not recursively count components that are indirectly contained in this container.

Returns:
the number of components directly in this container.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC