Package com.groiss.gui.component
Class RadioButton
java.lang.Object
com.groiss.gui.AbstractComponent
com.groiss.gui.component.RadioButton
- All Implemented Interfaces:
Component
,Serializable
,Cloneable
A HTML radio button. <input type=radio ...
It is used for attributes that accept a single value from a set of alternatives. Each RadioButton
in the group should be given the same name. RadioButtons require an explicit VALUE and NAME attribute.
CHECKED is an optional attribute and can be used to specify which options are selected for
initial form display.
- See Also:
-
Field Summary
Fields inherited from class com.groiss.gui.AbstractComponent
ACTIVE, browserMode, DEFAULT, ID, IE, INVISIBLE, isSensitive, label, NS, ON_BLUR, ON_CHANGE, ON_CLICK, ON_DBLCLICK, ON_FOCUS, ON_KEY_DOWN, ON_KEY_PRESS, ON_KEY_UP, ON_LOAD, ON_MOUSE_DOWN, ON_MOUSE_MOVE, ON_MOUSE_OUT, ON_MOUSE_UP, ON_RESET, ON_SELECT, ON_SUBMIT, ON_UNLOAD, parent, parentElem, READONLY, root, viewMode
Fields inherited from interface com.groiss.gui.Component
LABELLEDBY
-
Constructor Summary
ConstructorDescriptionConstructs a new empty RadioButton.RadioButton
(String name, String value) Constructor with name and value.RadioButton
(String name, String value, boolean checked) Constructor with name, value and the initial state.RadioButton
(String name, String value, boolean checked, String styleClass) Constructor with name, value and the initial state. -
Method Summary
Modifier and TypeMethodDescriptiongetName()
getText()
getValue()
boolean
void
setChecked
(boolean checked) sets whether the radioButton is checked or notvoid
setContent
(Object o) Set the button text.void
sets the name of the radioButtonvoid
sets the textvoid
sets the value of the checkboxMethods inherited from class com.groiss.gui.AbstractComponent
addClass, clone, create, getAttribute, getBrowserMode, getId, getLabel, getParent, getParentElement, getRoot, getRootName, getStyle, getViewMode, init, init, init, removeAttribute, removeClass, setActionListener, setAttribute, setBrowserMode, setClass, setEncoding, setExpandEmptyElements, setId, setIndenting, setLabel, setNewLines, setParent, setParentElement, setRootName, setStyle, setViewMode, show, show, toggleClass, toString
-
Constructor Details
-
RadioButton
public RadioButton()Constructs a new empty RadioButton. -
RadioButton
Constructor with name and value.- Parameters:
name
- - the name of the RadioButton groupvalue
- - the value of the RadioButton
-
RadioButton
Constructor with name, value and the initial state.- Parameters:
name
- the name of the RadioButton groupvalue
- the value of this buttonchecked
- whether the RadioButton is checked or not
-
RadioButton
Constructor with name, value and the initial state.- Parameters:
name
- the name of the RadioButton groupvalue
- the value of this buttonchecked
- whether the RadioButton is checked or notstyleClass
- the name of a CSS class
-
-
Method Details
-
setChecked
public void setChecked(boolean checked) sets whether the radioButton is checked or not- Parameters:
checked
- the checked-mode of the radioButton
-
isChecked
public boolean isChecked() -
setName
sets the name of the radioButton- Specified by:
setName
in interfaceComponent
- Overrides:
setName
in classAbstractComponent
- Parameters:
name
- the name
-
getName
- Specified by:
getName
in interfaceComponent
- Overrides:
getName
in classAbstractComponent
- Returns:
- - the name of the component
-
setValue
sets the value of the checkbox- Parameters:
value
- the value of the checkbox
-
getValue
-
setText
sets the text- Parameters:
text
- the text String
-
getText
-
setContent
Set the button text.- Specified by:
setContent
in interfaceComponent
- Overrides:
setContent
in classAbstractComponent
- Parameters:
o
- any object where the string representation is used for rendering
-
getContent
- Specified by:
getContent
in interfaceComponent
- Overrides:
getContent
in classAbstractComponent
- Returns:
- the content object of the component
-