|
||||||||||
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.Radio
Provides a Radio control: <input type='radio'>.
Radio |
RadioGroup
Javadoc example.
When used with a RadioGroup the Radio control will derrive 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 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 | |
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 net.sf.click.control.Field |
getError, getErrorLabel, getFocus, getFocusJavaScript, getForm, getHelp, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValidationJavaScript, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, onInit, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setForm, setHelp, setLabel, setListener, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setValueObject, setWidth, validate |
Methods inherited from class net.sf.click.control.AbstractControl |
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getControlSizeEst, getHtmlImports, getMessage, getMessage, getMessage, getMessages, 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 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 examle 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
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 |