|
|||||||||
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.control.Checkbox
public class 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 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 | |
---|---|
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. |
boolean |
onProcess()
Process the request Context setting the checked value if selected and invoking the control's listener if defined. |
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 org.apache.click.control.Field |
---|
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setWidth |
Methods inherited from class org.apache.click.control.AbstractControl |
---|
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getControlSizeEst, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, onDestroy, onInit, onRender, removeBehavior, removeStyleClass, 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 boolean onProcess()
onProcess
in interface Control
onProcess
in class Field
Control.onProcess()
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 |