|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.click.control.AbstractControl org.apache.click.control.Field org.apache.click.extras.control.AbstractContainerField
public abstract class AbstractContainerField
Provides an abstract convenience class that implements Container and extend Field.
This control is only rarely used or necessary. The primary use case is for creating custom Containers that will be treated asField
instances by the Form
.
Here is an example of a FieldBorder which wraps Fields in a
<div> element. The FieldBorder container can be passed to the
Form and will be treated as a normal Field.
public class FieldBorder extends AbstractContainerField { public FieldBorder(String name) { super(name); } public String getTag() { return "div"; } public Control add(Field field) { return getContainer().add(field); } }If you need to bind a request parameter to this field value, please see
bindRequestValue()
.
Field Summary | |
---|---|
protected Map<String,Control> |
controlMap
The map of controls keyed by field name. |
protected List<Control> |
controls
The list of controls. |
Fields inherited from class org.apache.click.control.Field |
---|
disabled, error, focus, form, help, label, labelStyle, labelStyleClass, parentStyleClassHint, parentStyleHint, readonly, required, tabindex, title, trim, validate, value |
Fields inherited from class org.apache.click.control.AbstractControl |
---|
actionListener, attributes, behaviors, headElements, listener, listenerMethod, messages, name, parent, styles |
Fields inherited from interface org.apache.click.Control |
---|
CONTROL_MESSAGES |
Constructor Summary | |
---|---|
AbstractContainerField()
Create an AbstractContainerField with no name defined. |
|
AbstractContainerField(String name)
Create an AbstractContainerField with the given name. |
|
AbstractContainerField(String name,
String label)
Construct an AbstractContainerField with the given name and label. |
Method Summary | |
---|---|
Control |
add(Control control)
|
void |
bindRequestValue()
This method does nothing by default. |
boolean |
contains(Control control)
|
Container |
getContainer()
Deprecated. the internal container instance was removed, AbstractContainerField can be used without accessing the internal container |
Control |
getControl(String controlName)
|
protected Map<String,Control> |
getControlMap()
Return the map of controls where each map's key / value pair will consist of the control name and instance. |
List<Control> |
getControls()
|
protected int |
getControlSizeEst()
|
boolean |
hasControls()
Returns true if this container has existing controls, false otherwise. |
Control |
insert(Control control,
int index)
Add the control to the container at the specified index, and return the added instance. |
void |
onDestroy()
|
void |
onInit()
|
boolean |
onProcess()
|
void |
onRender()
|
boolean |
remove(Control control)
|
void |
render(HtmlStringBuffer buffer)
By default render the container and all its child controls to the specified buffer. |
protected void |
renderChildren(HtmlStringBuffer buffer)
Render this container children to the specified buffer. |
protected void |
renderContent(HtmlStringBuffer buffer)
Render this container content to the specified buffer. |
protected void |
renderTagBegin(String tagName,
HtmlStringBuffer buffer)
Render the Container tag and common attributes including id ,
class and style. |
protected void |
renderTagEnd(String tagName,
HtmlStringBuffer buffer)
|
Control |
replace(Control currentControl,
Control newControl)
Deprecated. this method was used for stateful pages, which have been deprecated |
void |
setParent(Object parent)
Set the parent of the Field. |
String |
toString()
Returns the HTML representation of this control. |
Methods inherited from class org.apache.click.control.Field |
---|
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, removeState, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth, validate |
Methods inherited from class org.apache.click.control.AbstractControl |
---|
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, removeBehavior, removeStyleClass, setActionListener, setAttribute, setId, setName, setStyle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.click.Control |
---|
getBehaviors, getContext, getHeadElements, getId, getMessages, getName, getParent, hasBehaviors, isAjaxTarget, onDeploy, setListener, setName |
Field Detail |
---|
protected List<Control> controls
protected Map<String,Control> controlMap
Constructor Detail |
---|
public AbstractContainerField()
public AbstractContainerField(String name)
name
- the ContainerField namepublic AbstractContainerField(String name, String label)
name
- the name of the Fieldlabel
- the label of the FieldMethod Detail |
---|
public Control add(Control control)
add
in interface Container
control
- the control to add to the container and return
IllegalArgumentException
- if the control is nullPlease note: if the container contains a control with the same name
as the given control, that control will be
{@link #replace(org.apache.click.Control, org.apache.click.Control) replaced}
by the given control. If a control has no name defined it cannot be replaced.
public Control insert(Control control, int index)
replaced
by the given control. If a control has no name defined it cannot be replaced.
insert
in interface Container
control
- the control to add to the container and returnindex
- the index at which the control is to be inserted
IllegalArgumentException
- if the control is null or if the control
and container is the same instanceContainer.insert(org.apache.click.Control, int).
public boolean remove(Control control)
remove
in interface Container
control
- the control to remove from the container
Container.remove(org.apache.click.Control)
public Control replace(Control currentControl, Control newControl)
replace
in interface Container
currentControl
- the control currently contained in the containernewControl
- the control to replace the current control contained in
the container
IllegalArgumentException
- if the currentControl or newControl is
null
IllegalStateException
- if the currentControl is not contained in
the containerContainer.replace(org.apache.click.Control, org.apache.click.Control)
public Container getContainer()
public List<Control> getControls()
getControls
in interface Container
Container.getControls()
public Control getControl(String controlName)
getControl
in interface Container
controlName
- the name of the control to get from the container
Container.getControl(java.lang.String)
public boolean contains(Control control)
contains
in interface Container
control
- the control whose presence in this container is to be tested
Container.contains(org.apache.click.Control)
public boolean hasControls()
hasControls
in interface Container
AbstractContainer.hasControls()
public void setParent(Object parent)
setParent
in interface Control
setParent
in class Field
parent
- the parent of the Control
IllegalArgumentException
- if the given parent instance is
referencing this object: if (parent == this)Control.setParent(Object)
public void bindRequestValue()
public CoolField extends AbstractContainerField { public CoolField(String name) { super(name); } public void bindRequestValue() { setValue(getRequestValue()); } }
bindRequestValue
in class Field
Field.getRequestValue()
public boolean onProcess()
onProcess
in interface Control
onProcess
in class Field
Control.onProcess()
public void onDestroy()
onDestroy
in interface Control
onDestroy
in class AbstractControl
Control.onDestroy()
public void onInit()
onInit
in interface Control
onInit
in class AbstractControl
Control.onInit()
public void onRender()
onRender
in interface Control
onRender
in class AbstractControl
Control.onRender()
public void render(HtmlStringBuffer buffer)
AbstractControl.getTag()
returns null,
this method will render only its child controls.
render
in interface Control
render
in class AbstractControl
buffer
- the specified buffer to render the control's output toAbstractControl.render(org.apache.click.util.HtmlStringBuffer)
public String toString()
render(org.apache.click.util.HtmlStringBuffer)
. The size of buffer
is determined by getControlSizeEst()
.
toString
in class AbstractControl
protected void renderTagBegin(String tagName, HtmlStringBuffer buffer)
id
,
class and style. The name
attribute
is not rendered by this container.
renderTagBegin
in class Field
tagName
- the name of the tag to renderbuffer
- the buffer to append the output toAbstractControl.renderTagBegin(java.lang.String, org.apache.click.util.HtmlStringBuffer)
protected void renderTagEnd(String tagName, HtmlStringBuffer buffer)
renderTagEnd
in class AbstractControl
tagName
- the name of the tag to closebuffer
- the buffer to append the output toAbstractControl.renderTagEnd(java.lang.String, org.apache.click.util.HtmlStringBuffer)
protected void renderContent(HtmlStringBuffer buffer)
buffer
- the buffer to append the output toAbstractContainer.renderContent(org.apache.click.util.HtmlStringBuffer)
protected void renderChildren(HtmlStringBuffer buffer)
buffer
- the buffer to append the output toAbstractContainer.renderChildren(org.apache.click.util.HtmlStringBuffer)
protected Map<String,Control> getControlMap()
AbstractContainer.getControlMap()
protected int getControlSizeEst()
getControlSizeEst
in class AbstractControl
AbstractControl.getControlSizeEst()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |