|
|||||||||
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.RadioGroup
public class 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<Radio> |
radioList
The list of Radio controls. |
protected static String |
VALIDATE_RADIOGROUP_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 | |
---|---|
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<?> 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(Collection<Radio> options)
Add the given collection Radio item options to the RadioGroup. |
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<Radio> |
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 org.apache.click.control.Field |
---|
bindRequestValue, getError, getErrorLabel, getFocus, getForm, getHelp, getId, getLabel, getLabelStyle, getLabelStyleClass, getParentStyleClassHint, getParentStyleHint, getRequestValue, getState, getTabIndex, getTextAlign, getTitle, getValidate, getValue, getValueObject, getWidth, isDisabled, isHidden, isReadonly, isRequired, isTrim, isValid, removeState, renderTagBegin, restoreState, saveState, setDisabled, setError, setErrorMessage, setErrorMessage, setFocus, setHelp, setLabel, setLabelStyle, setLabelStyleClass, setListener, setParent, setParentStyleClassHint, setParentStyleHint, setReadonly, setRequired, setState, setTabIndex, setTextAlign, setTitle, setTrim, setValidate, setValue, setValueObject, setWidth |
Methods inherited from class org.apache.click.control.AbstractControl |
---|
addBehavior, addStyleClass, appendAttributes, dispatchActionEvent, getActionListener, getAttribute, getAttributes, getBehaviors, getContext, getHeadElements, getHtmlImports, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasBehaviors, hasStyles, isAjaxTarget, onDeploy, onRender, removeBehavior, removeStyleClass, 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<Radio> 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<Radio> 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<Radio> getRadioList()
public boolean hasRadios()
public String getValidationJavaScript()
getValidationJavaScript
in class Field
public void onInit()
AbstractControl
onInit
in interface Control
onInit
in class AbstractControl
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:org.apache.click.control.MessageProperties
- select-error
validate
in class Field
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |