com.arsdigita.toolbox.ui
Class NullComponent

java.lang.Object
  extended bycom.arsdigita.toolbox.ui.NullComponent
All Implemented Interfaces:
Component, Lockable

public final class NullComponent
extends Object
implements Component

Version:
$Id: //core-platform/dev/src/com/arsdigita/toolbox/ui/NullComponent.java#5 $
Author:
Justin Ross <jross@redhat.com>

Field Summary
static String versionId
           
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
NullComponent()
           
 
Method Summary
 Iterator children()
          Returns an iterator over the children of this component.
 void generateXML(PageState state, Element parent)
          Adds a DOM subtree representing this component under the given parent node.
 String getClassAttr()
          Gets the class attribute.
 String getIdAttr()
          Gets the id attribute.
 String getKey()
          Retrieves the programmer-supplied key.
 String getStyleAttr()
          Gets the style attribute.
 boolean isLocked()
          Return whether an object is locked and thus immutable, or can still be modified.
 boolean isVisible(PageState state)
          Determines whether the component is visible in the request represented by state.
 void lock()
          Lock an object.
 void register(Form form, FormModel model)
          Registers form parameters with the form model for this form.
 void register(Page page)
          Registers state parameters for the page with its model.
 void respond(PageState state)
          Responds to the request.
 void setClassAttr(String clacc)
          Sets the class attribute.
 void setIdAttr(String id)
          Sets the id attribute.
 Component setKey(String key)
          Supplies a key for making parameter names unique.
 void setStyleAttr(String style)
          Sets the style attribute.
 void setVisible(PageState state, boolean visible)
          Changes the visibility of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

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

NullComponent

public NullComponent()
Method Detail

generateXML

public void generateXML(PageState state,
                        Element parent)
Description copied from interface: Component

Adds a DOM subtree representing this component under the given parent node. Uses the request values stored in state.

Specified by:
generateXML in interface Component
Parameters:
state - represents the current request
parent - the node under which the DOM subtree should be added

respond

public void respond(PageState state)
             throws javax.servlet.ServletException
Description copied from interface: Component

Responds to the request. This method is only called if the request was made from a link or form that the component put on the page in the PageState.stateAsURL() previous request.

No output should be generated on the HTTP response. The component can store intermediate results in the state by calling setAttribute.

This method is called before any output is printed to the HTTP response so that the component can forward to a different page and thereby commit the response.

Specified by:
respond in interface Component
Parameters:
state - represents the current request
Throws:
javax.servlet.ServletException

children

public Iterator children()
Description copied from interface: Component
Returns an iterator over the children of this component. If the component has no children, returns an empty (not null) iterator.

Specified by:
children in interface Component
Returns:
an iterator over the children of this component.

register

public void register(Page page)
Description copied from interface: Component
Registers state parameters for the page with its model. A simple component with a state parameter param would do the following in the body of this method:
   p.addComponent(this);
   p.addComponentStateParam(this, param);
 
You should override this method to set the default visibility of your component:
 public void register(Page p) {
     super.register(p);
     p.setVisibleDefault(childNotInitiallyShown,false);
     p.setVisibleDefault(anotherChild, false);
 }
 
Always call super.register when you override register. Otherwise your component may malfunction and produce errors like "Widget ... isn't associated with any Form"

Specified by:
register in interface Component

register

public void register(Form form,
                     FormModel model)
Description copied from interface: Component
Registers form parameters with the form model for this form. This method is only important for form sections and widgets (components that have a connection to an HTML form). Other components can implement it as a no-op.

Specified by:
register in interface Component

getClassAttr

public String getClassAttr()
Description copied from interface: Component
Gets the class attribute.

Specified by:
getClassAttr in interface Component
Returns:
the class attribute.
See Also:
Component.setClassAttr(String), Standard Attributes

setClassAttr

public void setClassAttr(String clacc)
Description copied from interface: Component
Sets the class attribute.

Specified by:
setClassAttr in interface Component
Parameters:
clacc - a valid XML name
See Also:
Standard Attributes, Component.getClassAttr()

getStyleAttr

public String getStyleAttr()
Description copied from interface: Component
Gets the style attribute.

Specified by:
getStyleAttr in interface Component
Returns:
the style attribute.
See Also:
Component.setStyleAttr(java.lang.String), Standard Attributes

setStyleAttr

public void setStyleAttr(String style)
Description copied from interface: Component
Sets the style attribute. style should be a valid CSS style, because its value will be copied verbatim to the output and appear as a style attribute in the top level XML or HTML output element.

Specified by:
setStyleAttr in interface Component
Parameters:
style - a valid CSS style description for use in the style attribute of an HTML tag
See Also:
Standard Attributes

getIdAttr

public String getIdAttr()
Description copied from interface: Component
Gets the id attribute.

Specified by:
getIdAttr in interface Component
Returns:
the id attribute.
See Also:
Standard Attributes, Component.setIdAttr(String id)

setIdAttr

public void setIdAttr(String id)
Description copied from interface: Component
Sets the id attribute. id should be an XML name that is unique within the Page in which this component is contained. The value of id is copied literally to the output and not used for internal processing.

Specified by:
setIdAttr in interface Component
Parameters:
id - a valid XML identifier
See Also:
Standard Attributes

setKey

public Component setKey(String key)
Description copied from interface: Component
Supplies a key for making parameter names unique. To be used instead of the component's index (see Component Prefix). To avoid collision with indexOf, it should (1) be a legal fragment of a cgi parameter, (2) differ from "g", and (3) not start with a digit.

Specified by:
setKey in interface Component

getKey

public String getKey()
Description copied from interface: Component
Retrieves the programmer-supplied key. Normally, there is no such key and the method returns null.

Specified by:
getKey in interface Component
Returns:
the programmer-supplied key.

isVisible

public boolean isVisible(PageState state)
Description copied from interface: Component
Determines whether the component is visible in the request represented by state.

Specified by:
isVisible in interface Component
Parameters:
state - represents the current request
Returns:
true if the component is visible in the request; false otherwise.
See Also:
setVisible, Description of Visibility above

setVisible

public void setVisible(PageState state,
                       boolean visible)
Description copied from interface: Component
Changes the visibility of the component. The component will keep the visibility that is set with this method in subsequent requests to this page.

Specified by:
setVisible in interface Component
Parameters:
state - represents the current request
visible - true if the component should be visible
See Also:
Description of Visibility above

lock

public void lock()
Description copied from interface: Lockable
Lock an object. Locked objects are to be considered immutable. Any attempt to modify them, e.g., through a setXXX method should lead to an exception.

Most lockable Bebop classes throw an IllegalStateException if an attempt is made to modify a locked instance.

Specified by:
lock in interface Lockable

isLocked

public boolean isLocked()
Description copied from interface: Lockable
Return whether an object is locked and thus immutable, or can still be modified.

Specified by:
isLocked in interface Lockable


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