|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.click.control.AbstractControl
net.sf.click.control.Field
net.sf.click.extras.control.AbstractContainerField
public abstract class AbstractContainerField
Provides an abstract convenience class that implements Container and extend Field.
AbstractContainerField delegates Contain specific actions to an internal Container instance. You can access the Container instance throughgetContainer().
If you need to bind a request parameter to this fields value, please see
bindRequestValue().
Here is an example of a Border Control that can wrap a Button and render
a div border around it.
public class ButtonBorder extends AbstractContainerField {
public ButtonBorder(String name) {
super(name);
}
public String getTag() {
return "div";
}
public Control addControl(Button button) {
return getContainer().addControl(button);
}
}
| Field Summary | |
|---|---|
protected AbstractContainer |
container
Internal container instance. |
| Fields inherited from class net.sf.click.control.Field |
|---|
disabled, error, focus, form, help, label, readonly, required, tabindex, title, validate, value |
| Fields inherited from class net.sf.click.control.AbstractControl |
|---|
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles |
| Fields inherited from interface net.sf.click.Control |
|---|
CONTROL_MESSAGES |
| Constructor Summary | |
|---|---|
AbstractContainerField()
Create a ContainerField with no name defined. |
|
AbstractContainerField(String name)
Create a ContainerField with the given name. |
|
| Method Summary | |
|---|---|
Control |
add(Control control)
|
void |
bindRequestValue()
This method does nothing by default. |
boolean |
contains(Control control)
|
Container |
getContainer()
Return the internal container instance. |
Control |
getControl(String controlName)
|
protected Map |
getControlMap()
Return the map of controls where each map's key / value pair will consist of the control name and instance. |
List |
getControls()
|
protected int |
getControlSizeEst()
|
String |
getHtmlImports()
Return the HTML head import statements for contained controls. |
boolean |
hasControls()
Returns true if this container has existing controls, false otherwise. |
Control |
insert(Control control,
int index)
|
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 |
renderTagEnd(String tagName,
HtmlStringBuffer buffer)
|
String |
toString()
Returns the HTML representation of this control. |
| Methods inherited from class net.sf.click.control.Field |
|---|
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setValue, setValueObject, setWidth, validate |
| Methods inherited from class net.sf.click.control.AbstractControl |
|---|
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasStyles, onDeploy, registerActionEvent, removeStyleClass, renderTagBegin, setActionListener, setAttribute, setId, setName, setParent, setStyle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.sf.click.Control |
|---|
getContext, getId, getMessages, getName, getParent, onDeploy, setListener, setName, setParent |
| Field Detail |
|---|
protected AbstractContainer container
| Constructor Detail |
|---|
public AbstractContainerField()
public AbstractContainerField(String name)
name - the ContainerField name| Method Detail |
|---|
public Control add(Control control)
add in interface Containercontrol - the control to add to the container and return
Container.add(net.sf.click.Control).
public Control insert(Control control,
int index)
insert in interface Containercontrol - the control to add to the container and returnindex - the index at which the control is to be inserted
Container.insert(net.sf.click.Control, int).public boolean remove(Control control)
remove in interface Containercontrol - the control to remove from the container
Container.remove(net.sf.click.Control)public Container getContainer()
public List getControls()
getControls in interface ContainerContainer.getControls()public Control getControl(String controlName)
getControl in interface ContainercontrolName - the name of the control to get from the container
Container.getControl(java.lang.String)public boolean contains(Control control)
contains in interface Containercontrol - the control whose presence in this container is to be tested
Container.contains(net.sf.click.Control)public boolean hasControls()
hasControls in interface ContainerAbstractContainer.hasControls()public String getHtmlImports()
getHtmlImports in interface ControlgetHtmlImports in class AbstractControlControl.getHtmlImports()public void bindRequestValue()
public CoolField extends AbstractContainerField {
public CoolField(String name) {
super(name);
}
public void bindRequestValue() {
setValue(getRequestValue());
}
// Below is the actual getRequestValue implementation as defined
// in Field. This is done solely to show how to retrieve the
// request parameter based on the fields name.
protected String getRequestValue() {
String value = getContext().getRequestParameter(getName());
if (value != null) {
return value.trim();
} else {
return "";
}
}
}
Note you can use method Field.getRequestValue() to retrieve the
fields value if the request parameter is the fields name.
bindRequestValue in class Fieldpublic boolean onProcess()
onProcess in interface ControlonProcess in class FieldControl.onProcess()public void onDestroy()
onDestroy in interface ControlonDestroy in class AbstractControlControl.onDestroy()public void onInit()
onInit in interface ControlonInit in class FieldControl.onInit()public void onRender()
onRender in interface ControlonRender in class AbstractControlControl.onRender()public void render(HtmlStringBuffer buffer)
AbstractControl.getTag() returns null,
this method will render only its child controls.
render in interface Controlrender in class AbstractControlbuffer - the specified buffer to render the control's output toAbstractControl.render(net.sf.click.util.HtmlStringBuffer)public String toString()
render(net.sf.click.util.HtmlStringBuffer). The size of buffer
is determined by getControlSizeEst().
toString in class AbstractControl
protected void renderTagEnd(String tagName,
HtmlStringBuffer buffer)
renderTagEnd in class AbstractControltagName - the name of the tag to closebuffer - the buffer to append the output toAbstractControl.renderTagEnd(java.lang.String, net.sf.click.util.HtmlStringBuffer)protected void renderContent(HtmlStringBuffer buffer)
buffer - the buffer to append the output toAbstractContainer.renderContent(net.sf.click.util.HtmlStringBuffer)protected void renderChildren(HtmlStringBuffer buffer)
buffer - the buffer to append the output toAbstractContainer.renderChildren(net.sf.click.util.HtmlStringBuffer)protected Map getControlMap()
AbstractContainer.getControlMap()protected int getControlSizeEst()
getControlSizeEst in class AbstractControlAbstractControl.getControlSizeEst()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||