|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.Completable
com.arsdigita.bebop.SimpleComponent
A simple implementation of the Component interface.
Field Summary | |
protected Attributes |
m_attr
The Attribute object is protected to make it easier for the Form Builder service to persist the SimpleComponent. |
static String |
versionId
|
Fields inherited from interface com.arsdigita.bebop.Component |
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE |
Constructor Summary | |
SimpleComponent()
|
Method Summary | |
Iterator |
children()
Returns an iterator over the children of this component. |
Object |
clone()
Clones a component. |
protected void |
exportAttributes(Element target)
Adds the attributes set with setAttribute to the
element target . |
void |
generateXML(PageState state,
Element p)
Adds [J]DOM nodes for this component. |
protected String |
getAttribute(String name)
Gets the value of an attribute. |
String |
getClassAttr()
Gets the class attribute. |
String |
getIdAttr()
Gets the id attribute. |
String |
getKey()
Retrieves a key for parameter name mangling. |
String |
getMetaDataAttribute(String name)
|
String |
getStyleAttr()
Gets the style attribute. |
protected boolean |
hasAttributes()
Returns true if any attributes have been set. |
boolean |
isLocked()
Return whether an object is locked and thus immutable, or can still be modified. |
boolean |
isVisible(PageState s)
Determines whether the component is visible in the request represented by state . |
void |
lock()
Lock an object. |
void |
register(Form f,
FormModel m)
Registers form parameters with the form model for this form. |
void |
register(Page p)
Registers state parameters for the page with its model. |
void |
respond(PageState state)
Does processing that is special to the component receiving the click. |
protected void |
setAttribute(String name,
String value)
Sets an attribute. |
void |
setClassAttr(String theClass)
Sets the class attribute. |
void |
setIdAttr(String id)
Sets the id attribute. |
Component |
setKey(String key)
Supplies a key for parameter name mangling. |
void |
setMetaDataAttribute(String name,
String value)
|
void |
setStyleAttr(String style)
Sets the style attribute. |
void |
setVisible(PageState s,
boolean v)
Changes the visibility of the component. |
Methods inherited from class com.arsdigita.bebop.Completable |
addCompletionListener, fireCompletionEvent |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String versionId
protected Attributes m_attr
Constructor Detail |
public SimpleComponent()
Method Detail |
public Object clone() throws CloneNotSupportedException
CloneNotSupportedException
public void register(Page p)
Component
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"
register
in interface Component
public void register(Form f, FormModel m)
Component
form
sections
and widgets
(components that have a connection to an HTML form). Other
components can implement it as a no-op.
register
in interface Component
public void respond(PageState state) throws javax.servlet.ServletException
respond
in interface Component
state
- the current page state
javax.servlet.ServletException
public Iterator children()
Component
null
) iterator.
children
in interface Component
public void generateXML(PageState state, Element p)
generateXML
in interface Component
state
- represents the current requestp
- the node under which the DOM subtree should be addedpublic final boolean isLocked()
Lockable
isLocked
in interface Lockable
public void lock()
Lockable
setXXX
method
should lead to an exception.
Most lockable Bebop classes throw an IllegalStateException
if an attempt is made to modify a
locked instance.
lock
in interface Lockable
public String getClassAttr()
getClassAttr
in interface Component
Component.setClassAttr(String)
,
Standard Attributespublic void setClassAttr(String theClass)
setClassAttr
in interface Component
theClass
- a valid XML nameComponent.getClassAttr()
public String getStyleAttr()
getStyleAttr
in interface Component
Component.setStyleAttr(java.lang.String)
,
Standard Attributespublic void setStyleAttr(String style)
style
should be a valid CSS
style, since its value will be copied verbatim to the output and
appear as a style attribute in the top level XML or HTML
output element.
setStyleAttr
in interface Component
style
- a valid CSS style description for use in the
style attribute of an HTML tagpublic String getIdAttr()
getIdAttr
in interface Component
setIdAttr(String id)
public void setIdAttr(String id)
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.
setIdAttr
in interface Component
id
- a valid XML identifierprotected final void setAttribute(String name, String value)
generateXML
.
name
- attribute name, case insensitivevalue
- new attribute valueprotected final String getAttribute(String name)
name
- attribute name, case insensitive
setAttribute
, or null
if none was set.setAttribute(java.lang.String, java.lang.String)
protected final void exportAttributes(Element target)
setAttribute
to the
element target
. The attributes set with
exportAttributes
overwrite attributes with identical names
that target
might already have.
target
- element to which attributes are addedsetAttribute(java.lang.String, java.lang.String)
protected final boolean hasAttributes()
true
if any attributes have been set.
true
if any attributes have been set;
false
otherwise.public final void setMetaDataAttribute(String name, String value)
public final String getMetaDataAttribute(String name)
public Component setKey(String key)
setKey
in interface Component
key
- the key to manglepublic final String getKey()
getKey
in interface Component
public boolean isVisible(PageState s)
Component
state
.
isVisible
in interface Component
s
- represents the current request
true
if the component is visible in the request;
false
otherwise.setVisible
,
Description of Visibility
abovepublic void setVisible(PageState s, boolean v)
Component
setVisible
in interface Component
s
- represents the current requestv
- true
if the component should be visible
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |