|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.click.control.AbstractControl net.sf.click.control.Field net.sf.click.control.HiddenField
Provides a Hidden Field control: <input type='hidden'>.
The HiddenField control is useful for storing state information in a Form, such as object ids, instead of using the Session object. This control is capable of supporting the following classes:Serializable non-primitive objects will be serialized, compressed and Base64 encoded, using
- Boolean
- Date
- Double
- Float
- Integer
- Long
- Short
- String
- Serializable
ClickUtils.encode(Object)
method, and decoded using the corresponding
ClickUtils.decode(String)
method.
public class CountPage extends Page { public Form form = new Form(); public Integer count; private HiddenField counterField = new HiddenField("counterField", Integer.class); public CountPage() { form.add(counterField); form.add(new Submit("ok", " OK ")); } public void onGet() { count = new Integer(0); counterField.setValueObject(count); } public void onPost() { count = (Integer) counterField.getValueObject(); count = new Integer(count.intValue() + 1); counterField.setValueObject(count); } }See also W3C HTML reference INPUT
Field Summary | |
protected Class |
valueClass
The field value Class. |
protected Object |
valueObject
The field value Object. |
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 | |
HiddenField()
Create an HiddenField with no name or Class defined. |
|
HiddenField(String name,
Class valueClass)
Construct a HiddenField with the given name and Class. |
|
HiddenField(String name,
Object value)
Construct a HiddenField with the given name and value object. |
Method Summary | |
void |
bindRequestValue()
This method binds the submitted request value to the Field's value. |
String |
getTag()
Return the hiddenfield's html tag: input. |
String |
getType()
Return the input type: 'hidden'. |
String |
getValidationJavaScript()
Returns null to ensure no client side JavaScript validation is performed. |
String |
getValue()
Return the Field value. |
Class |
getValueClass()
Return the registered Class for the Hidden Field value Object. |
Object |
getValueObject()
Return the value Object of the hidden field. |
boolean |
isHidden()
Returns true. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the HiddenField. |
void |
setValue(String value)
Set the Field value. |
void |
setValueClass(Class valueClass)
Set the registered Class for the Hidden Field value Object. |
void |
setValueObject(Object value)
Set the value of the field using the given object. |
Methods inherited from class net.sf.click.control.Field |
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getWidth, isDisabled, isReadonly, isRequired, isValid, onInit, onProcess, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setParent, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setWidth, validate |
Methods inherited from class net.sf.click.control.AbstractControl |
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getControlSizeEst, getHtmlImports, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasStyles, onDeploy, onDestroy, onRender, registerActionEvent, removeStyleClass, renderTagBegin, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Object valueObject
protected Class valueClass
Constructor Detail |
public HiddenField(String name, Class valueClass)
name
- the name of the hidden fieldvalueClass
- the Class of the value Objectpublic HiddenField(String name, Object value)
name
- the name of the hidden fieldvalue
- the value objectpublic HiddenField()
Method Detail |
public String getTag()
getTag
in class AbstractControl
AbstractControl.getTag()
public boolean isHidden()
isHidden
in class Field
Field.isHidden()
public String getType()
public String getValue()
Field
getValue
in class Field
Field.getValue()
public void setValue(String value)
Field
setValue
in class Field
value
- the Field valueField.setValue(String)
public Class getValueClass()
public void setValueClass(Class valueClass)
valueClass
- the registered Class for the Hidden Field value Objectpublic Object getValueObject()
getValueObject
in class Field
Field.getValueObject()
public void setValueObject(Object value)
Field
setValueObject
in class Field
value
- the object value to setField.setValueObject(Object)
public String getValidationJavaScript()
getValidationJavaScript
in class Field
public void bindRequestValue()
bindRequestValue
in class Field
public void render(HtmlStringBuffer buffer)
render
in interface Control
render
in class AbstractControl
buffer
- the specified buffer to render the control's output toControl.render(net.sf.click.util.HtmlStringBuffer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |