|
||||||||||
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.RadioGroup
Provides a RadioGroup control.
Radio Group | Red Green Blue |
public class Purchase extends Page { public Form form = new Form(); private RadioGroup radioGroup = new RadioGroup("packaging"); public Purchase() { radioGroup.add(new Radio("STD", "Standard ")); radioGroup.add(new Radio("PRO", "Protective ")); radioGroup.add(new Radio("GFT", "Gift Wrap ")); radioGroup.setValue("STD"); radioGroup.setVerticalLayout(true); form.add(radioGroup); .. } }This radio group field would be render as:
Packaging |
Standard Protective Gift Wrap |
Radio
,
Serialized FormField Summary | |
protected boolean |
isVerticalLayout
The layout is vertical flag (default false). |
protected List |
radioList
The list of Radio controls. |
protected static String |
VALIDATE_RADIOGROUP_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 | |
RadioGroup()
Create a RadioGroup field with no name. |
|
RadioGroup(String name)
Create a RadioGroup with the given name. |
|
RadioGroup(String name,
boolean required)
Create a RadioGroup with the given name and required status. |
|
RadioGroup(String name,
String label)
Create a RadioGroup with the given name and label. |
|
RadioGroup(String name,
String label,
boolean required)
Create a RadioGroup with the given name, label and required status. |
Method Summary | |
void |
add(Radio radio)
Add the given radio to the radio group. |
void |
addAll(Collection options)
Add the given collection Radio item options to the RadioGroup. |
void |
addAll(Collection objects,
String value,
String label)
Add the given collection of objects to the RadioGroup, creating new Radio instances based on the object properties specified by value and label. |
void |
addAll(Map options)
Add the given Map of radio values and labels to the RadioGroup. |
int |
getControlSizeEst()
Return the estimated rendered control size in characters. |
String |
getFocusJavaScript()
Return the RadioGroup focus JavaScript. |
List |
getRadioList()
Return the list of radio controls. |
String |
getValidationJavaScript()
Return the RadioGroup JavaScript client side validation function. |
boolean |
hasRadios()
Return true if RadioGroup has Radio controls, or false otherwise. |
boolean |
isVerticalLayout()
Return true if the radio control layout is vertical. |
void |
onDestroy()
This method does nothing. |
void |
onInit()
This method does nothing. |
boolean |
onProcess()
Process the request Context setting the checked value and invoking the controls listener if defined. |
void |
render(HtmlStringBuffer buffer)
Render the HTML representation of the RadioGroup. |
void |
setForm(Form form)
Set the Field's the parent Form. |
void |
setVerticalLayout(boolean vertical)
Set the vertical radio control layout flag. |
String |
toString()
Return the HTML rendered RadioGroup string. |
void |
validate()
Validate the RadioGroup request submission. |
Methods inherited from class net.sf.click.control.Field |
bindRequestValue, getError, getErrorLabel, getFocus, getForm, getHelp, getId, getLabel, getRequestValue, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isValid, setDisabled, setError, setErrorMessage, setErrorMessage, setErrorMessage, setErrorMessage, setFocus, setHelp, setLabel, setListener, setParent, setReadonly, setRequired, setTabIndex, setTextAlign, setTitle, setValidate, setValue, setValueObject, setWidth |
Methods inherited from class net.sf.click.control.AbstractControl |
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getHtmlImports, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasStyles, onDeploy, onRender, registerActionEvent, removeStyleClass, renderTagBegin, renderTagEnd, setActionListener, setAttribute, setId, setName, setStyle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final String VALIDATE_RADIOGROUP_FUNCTION
protected List radioList
protected boolean isVerticalLayout
Constructor Detail |
public RadioGroup(String name)
name
- the name of the fieldpublic RadioGroup(String name, boolean required)
name
- the name of the fieldrequired
- the field required statuspublic RadioGroup(String name, String label)
name
- the name of the fieldlabel
- the label of the fieldpublic RadioGroup(String name, String label, boolean required)
name
- the name of the fieldlabel
- the label of the fieldrequired
- the field required statuspublic RadioGroup()
Method Detail |
public void add(Radio radio)
radio
- the radio control to add to the radio group
IllegalArgumentException
- if the radio parameter is nullpublic void addAll(Collection options)
options
- the collection of Radio items to add
IllegalArgumentException
- if options is nullpublic void addAll(Map options)
options
- the Map of radio option values and labels to add
IllegalArgumentException
- if options is nullpublic void addAll(Collection objects, String value, String label)
RadioGroup radioGroup = new RadioGroup("type", "Type:"); radioGroup.addAll(getCustomerService().getCustomerTypes(), "id", "name"); form.add(select);
objects
- the collection of objects to render as radio optionsvalue
- the name of the object property to render as the Radio valuelabel
- the name of the object property to render as the Radio label
IllegalArgumentException
- if options, value or label parameter is nullpublic String getFocusJavaScript()
getFocusJavaScript
in class Field
public void setForm(Form form)
Field
setForm
in class Field
form
- Field's parent FormField.setForm(Form)
public boolean isVerticalLayout()
public void setVerticalLayout(boolean vertical)
vertical
- the vertical layout flagpublic List getRadioList()
public boolean hasRadios()
public String getValidationJavaScript()
getValidationJavaScript
in class Field
public void onInit()
Field
onInit
in interface Control
onInit
in class Field
Control.onInit()
public boolean onProcess()
onProcess
in interface Control
onProcess
in class Field
Control.onProcess()
public void onDestroy()
AbstractControl
onDestroy
in interface Control
onDestroy
in class AbstractControl
Control.onDestroy()
public int getControlSizeEst()
AbstractControl
getControlSizeEst
in class AbstractControl
AbstractControl.getControlSizeEst()
public void render(HtmlStringBuffer buffer)
render
in interface Control
render
in class AbstractControl
buffer
- the specified buffer to render the control's output totoString()
public String toString()
toString
in class AbstractControl
Object.toString()
public void validate()
Error message bundle key names include:net.sf.click.control.MessageProperties
- field-required-error
validate
in class Field
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |