|
||||||||||
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.Checkbox
Provides a Checkbox control: <input type='checkbox'>.
Checkbox |
Field.required
property and Control listeners.
See also W3C HTML reference
INPUT
Field Summary | |
protected boolean |
checked
The field checked value. |
protected static String |
VALIDATE_CHECKBOX_FUNCTION
The field validation JavaScript function template. |
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 | |
Checkbox()
Create a Checkbox field with no name defined. |
|
Checkbox(String name)
Create a Checkbox field with the given name. |
|
Checkbox(String name,
boolean required)
Create a Checkbox field with the given name and required flag. |
|
Checkbox(String name,
String label)
Create a Checkbox field with the given name and label. |
Method Summary | |
void |
bindRequestValue()
Set the checked property to true if the fields value is
submitted. |
String |
getTag()
Return the checkbox's html tag: input. |
String |
getType()
Return the input type: 'checkbox'. |
String |
getValidationJavaScript()
Return the Checkbox JavaScript client side validation function. |
String |
getValue()
Returns "true" if the checkbox is checked, or false otherwise. |
Object |
getValueObject()
Return the field Boolean value. |
boolean |
isChecked()
Return true if the checkbox is checked, or false otherwise. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the Checkbox. |
void |
setChecked(boolean value)
Set the selected value of the checkbox. |
void |
setValue(String value)
Set checked value of the field. |
void |
setValueObject(Object object)
Set the checked value of the field using the given object. |
void |
validate()
Validate the Checkbox request submission. |
Methods inherited from class net.sf.click.control.Field |
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, onInit, onProcess, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setParent, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setWidth |
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 static final String VALIDATE_CHECKBOX_FUNCTION
protected boolean checked
Constructor Detail |
public Checkbox(String name)
name
- the name of the fieldpublic Checkbox(String name, String label)
name
- the name of the fieldlabel
- the label of the fieldpublic Checkbox(String name, boolean required)
name
- the name of the fieldrequired
- the name required statuspublic Checkbox()
Method Detail |
public String getTag()
getTag
in class AbstractControl
AbstractControl.getTag()
public boolean isChecked()
public void setChecked(boolean value)
value
- the selected valuepublic String getType()
public String getValue()
getValue
in class Field
Field.getValue()
public void setValue(String value)
setValue
in class Field
value
- the Field valueField.setValue(String)
public Object getValueObject()
getValueObject
in class Field
Field.getValueObject()
public void setValueObject(Object object)
setValueObject
in class Field
object
- the object value to setField.setValueObject(Object)
public String getValidationJavaScript()
getValidationJavaScript
in class Field
public void bindRequestValue()
checked
property to true if the fields value is
submitted.
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 toAbstractControl.toString()
public void validate()
Field.required
and the Checkbox is not
checked the error message defined by not-checked-error
property will be displayed.
validate
in class Field
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |