Class HtmlRadioButton


public class HtmlRadioButton
extends HtmlInput

This class represents a html radio button. i.e.

<input type="radio" ... >

This widget is normally used with a group of radio buttons. The widget allows the user to select one option from a group of options. All radio buttons should have a unique value, otherwise the object will not be able to correctly identify the selected radio button.

Unlike the other control widgets, more than one radio button can have the same control name. When radio buttons have the same control name then they're grouped together. Only one radio button in the same group can ever be selected.

The widget emits these signals:

Fields inherited from class objectivehtml.htmlwidget.HtmlControlWidget
m_bAutoEscape, m_bAutoUpdate
Fields inherited from class objectivehtml.htmlwidget.HtmlWidget
m_bDestroyed, m_bVisible, m_objHtmlForm, m_objParentWidget
Fields inherited from class objectivehtml.htmlwidget.HtmlElement
m_hmAttributes, m_sEndTag, m_sQuoteType, m_sStartTag
Constructor Summary
HtmlRadioButton(HtmlContainerWidget objParent, java.lang.String sGroupName)
          Constructs an instance of HtmlRadioButton belonging to the radio button group sGroupName.
Method Summary
 void destroy()
          Deletes itself and removes itself from the radio button group.
 HtmlRadioButtonGroup getRadioButtonGroup()
          Returns a reference to the radio button group managing this radio button.
 boolean isChecked()
          Returns true if the radio button is checked, false otherwise
 Signal selectionChanged(boolean bChecked)
          This signal is emitted when the "checked" attribute of this object is changed.
 void setBooleanAttribute(java.lang.String sAttributeName, boolean bIsOn)
          Sets a boolean-attribute of this object.
 void setChecked(boolean bChecked)
          Sets the radio button to be checked/unchecked.
 void updateData(javax.servlet.http.HttpServletRequest objRequest)
          Updates this object with the data submitted from the client.
Methods inherited from class objectivehtml.htmlwidget.HtmlInput
genStartTag, getText, getType, getValue, setAttribute, setText, setType, setValue, valueChanged
Methods inherited from class objectivehtml.htmlwidget.HtmlControlWidget
dataSubmitted, dataSubmitted, getName, getOnBlur, getOnChange, getOnFocus, getOnSelect, getSubmittedData, getSubmittedDataSet, getTabIndex, getUpdateOrder, isAutoEscape, isAutoUpdate, isDisabled, printHtml, printHtml, setAutoEscape, setAutoUpdate, setDisabled, setOnBlur, setOnChange, setOnFocus, setOnSelect, setTabIndex, setUpdateOrder, setVisible
Methods inherited from class objectivehtml.htmlwidget.HtmlWidget
changeParent, changeParent, getClassAttribute, getHtmlForm, getID, getOnClick, getOnDblClick, getOnKeyDown, getOnKeyPress, getOnKeyUp, getOnMouseDown, getOnMouseMove, getOnMouseOut, getOnMouseOver, getOnMouseUp, getParent, getStyle, isDestroyed, isVisible, setClassAttribute, setID, setOnClick, setOnDblClick, setOnKeyDown, setOnKeyPress, setOnKeyUp, setOnMouseDown, setOnMouseMove, setOnMouseOut, setOnMouseOver, setOnMouseUp, setStyle
Methods inherited from class objectivehtml.htmlwidget.HtmlElement
genEndTag, genStartTag, getAttribute, getAttributes, getBooleanAttribute, getQuoteType, printHtml, printHtml, printHtml, printHtml, printHtml, printHtml, setQuoteType, toString, toString
Methods inherited from class objectivehtml.oms.OMSObject
compareClasses, connect, disconnect, emit, isAlive, setAlive, signal, slot, slot
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public HtmlRadioButton(HtmlContainerWidget objParent,
                       java.lang.String sGroupName)
                throws InvalidControlNameException,
Constructs an instance of HtmlRadioButton belonging to the radio button group sGroupName.
objParent - the parent of this widget
sName - the group control name for the object
InvalidControlNameException - if the control name is not valid
InvalidParentWidgetException - if the specified parent widget is not valid
InvalidChildWidgetException - if the parent widget does not accept this widget as a child
Method Detail


public HtmlRadioButtonGroup getRadioButtonGroup()

Returns a reference to the radio button group managing this radio button.

All radio buttons belong to a radio button group. The group a button belongs to is determined by its group name.

the group object that this radio button belongs to


public void setChecked(boolean bChecked)

Sets the radio button to be checked/unchecked. If the radio button is checked then all other will be unchecked if the group object has been set to synchronized.

The html attribute it sets is "checked".

If false is specified the attribute is cleared.

bChecked - true if checked, false otherwise
See Also:
setBooleanAttribute(String, boolean), isChecked(), HtmlRadioButtonGroup.isSynchronized()


public boolean isChecked()
Returns true if the radio button is checked, false otherwise
true if checked, false if unchecked
See Also:
HtmlElement.getBooleanAttribute(String), setChecked(boolean)


public void updateData(javax.servlet.http.HttpServletRequest objRequest)

Updates this object with the data submitted from the client. If the submitted data for this object equals the current value for this object then the object will become checked. If no data is submitted or the submitted data does not equal the current value of the object then the object will be unchecked.

The object will only be updated if the auto-update is on and if the object is visible and not disabled.

updateData in class HtmlControlWidget
objRequest - the request object that contains the user submitted data
See Also:
HtmlInput.getValue(), HtmlWidget.isVisible(), HtmlControlWidget.isDisabled(), HtmlControlWidget.isAutoUpdate(), HtmlControlWidget.getSubmittedData(HttpServletRequest)


public void destroy()
Deletes itself and removes itself from the radio button group. If this is the last radio button in the group then it also destroys the group.
destroy in class HtmlControlWidget
Following copied from class: objectivehtml.htmlwidget.HtmlWidget
See Also:


public Signal selectionChanged(boolean bChecked)
This signal is emitted when the "checked" attribute of this object is changed.
bChecked - true if the object has been checked, false if unchecked
the signal


public void setBooleanAttribute(java.lang.String sAttributeName,
                                boolean bIsOn)
                         throws InvalidAttributeException

Sets a boolean-attribute of this object.

setBooleanAttribute in class HtmlInput
sAttributeName - the name of the attribute
bIsOn - true if attribute should be set, if false is specified then the attribute is cleared