|
|||||||||
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.Radio
public class Radio
Provides a Radio control: <input type='radio'>.
Radio |
RadioGroup
Javadoc example.
When used with a RadioGroup the Radio control will derive its name from the
parent RadioGroup, if the Radio's name is not defined.
See also W3C HTML reference
INPUT
RadioGroup
,
Serialized FormField Summary | |
---|---|
protected boolean |
checked
The field checked value. |
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 | |
---|---|
Radio()
Create an Radio field with no name defined. |
|
Radio(String value)
Create a radio field with the given value. |
|
Radio(String value,
String label)
Create a radio field with the given value and label. |
|
Radio(String value,
String label,
String name)
Create a radio field with the given value, label and name. |
Method Summary | |
---|---|
void |
bindRequestValue()
Bind the request submission, setting the Field checked property
if defined in the request. |
String |
getId()
Return the Radio field id attribute. |
String |
getLabel()
Return the field display label. |
String |
getName()
Return the name of the Radio field. |
String |
getTag()
Return the radio's html tag: input. |
String |
getType()
Return the input type: 'radio'. |
boolean |
isChecked()
Return true if the radio is checked, or false otherwise. |
boolean |
onProcess()
Process the request Context setting the checked value if selected and invoking the controls listener if defined. |
void |
render(HtmlStringBuffer buffer)
Render a HTML Radio string. |
void |
setChecked(boolean value)
Set the selected value of the radio. |
void |
setParent(Object parent)
Set the parent of the Field. |
void |
setValue(String value)
Set the radio value, setting the checked status if given value is the same as the radio field value. |
Methods inherited from class org.apache.click.control.Field |
---|
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValueObject, setWidth, validate |
Methods inherited from class org.apache.click.control.AbstractControl |
---|
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getControlSizeEst, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, 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 boolean checked
Constructor Detail |
---|
public Radio(String value)
value
- the label of the fieldpublic Radio(String value, String label)
value
- the label of the fieldlabel
- the name of the fieldpublic Radio(String value, String label, String name)
value
- the label of the fieldlabel
- the label of the fieldname
- the name of the fieldpublic Radio()
Method Detail |
---|
public String getTag()
getTag
in class AbstractControl
AbstractControl.getTag()
public boolean isChecked()
public void setChecked(boolean value)
value
- the selected valuepublic String getId()
getId
in interface Control
getId
in class Field
Control.getId()
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 String getLabel()
super.getName() + ".label"If the Radio name attribute is null and the parent of the Radio is the RadioGroup:
parent.getName() + "." + getValue() + ".label"If not found then the message will be looked up in the /click-control.properties file using the same key. If a value still cannot be found then the Field name will be the radio value. For example given a CustomerPage with the properties file CustomerPage.properties:
gender.M.label=Male gender.F.label=FemaleThe page Radio code:
public class CustomerPage extends Page { public Form form = new Form(); private RadioGroup radioGroup = new RadioGroup("gender"); public CustomerPage() { radioGroup.add(new Radio("M")); radioGroup.add(new Radio("F")); form.add(radioGroup); .. } }Will render the Radio label properties as:
<input type="radio" name="gender" value="M"><label>Male</label></label><br/> <input type="radio" name="gender" value="F"><label>Female</label></label>
getLabel
in class Field
public String getName()
getName
in interface Control
getName
in class AbstractControl
Control.getName()
public String getType()
public void setValue(String value)
setValue
in class Field
value
- the Field valueField.setValue(String)
public void bindRequestValue()
checked
property
if defined in the request.
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |