Package com.vaadin.client.ui
Class VRadioButtonGroup
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Composite
-
- com.vaadin.client.widgets.FocusableFlowPanelComposite
-
- com.vaadin.client.ui.VRadioButtonGroup
-
- All Implemented Interfaces:
com.google.gwt.event.dom.client.ClickHandler,com.google.gwt.event.dom.client.HasAllFocusHandlers,com.google.gwt.event.dom.client.HasBlurHandlers,com.google.gwt.event.dom.client.HasFocusHandlers,com.google.gwt.event.logical.shared.HasAttachHandlers,com.google.gwt.event.shared.EventHandler,com.google.gwt.event.shared.HasHandlers,com.google.gwt.user.client.EventListener,com.google.gwt.user.client.ui.HasEnabled,com.google.gwt.user.client.ui.HasVisibility,com.google.gwt.user.client.ui.IsRenderable,com.google.gwt.user.client.ui.IsWidget,Focusable,Field
public class VRadioButtonGroup extends FocusableFlowPanelComposite implements Field, com.google.gwt.event.dom.client.ClickHandler, com.google.gwt.user.client.ui.HasEnabled
The client-side widget for theRadioButtonGroupcomponent.- Since:
- 8.0
- Author:
- Vaadin Ltd.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLASSNAMEDefault classname for this widget.static StringCLASSNAME_OPTIONDefault classname for all radio buttons within this widget.static StringCLASSNAME_OPTION_SELECTEDDefault classname for the selected radio button within this widget.ApplicationConnectionclientFor internal use only.
-
Constructor Summary
Constructors Constructor Description VRadioButtonGroup()Constructs a widget for the RadioButtonGroup component.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RegistrationaddSelectionChangeHandler(Consumer<elemental.json.JsonObject> selectionChanged)Adds the given selection change handler to this widget.voidbuildOptions(List<elemental.json.JsonObject> items)Build all the options.voidfocus()Set focus to the selected radio button (or first radio button if there is no selection).elemental.json.JsonObjectgetItem(com.google.gwt.dom.client.Element element)Returns the JsonObject used to populate the RadioButton widget that contains given Element.booleanisEnabled()booleanisHtmlContentAllowed()Returns whether HTML is allowed in the item captions.booleanisReadonly()Returns whether this radio button group is read-only or not.voidonClick(com.google.gwt.event.dom.client.ClickEvent event)voidselectItemKey(String selectedItemKey)Removes previous selection and adds new selection.voidsetEnabled(boolean enabled)voidsetHtmlContentAllowed(boolean htmlContentAllowed)Sets whether HTML is allowed in the item captions.voidsetReadonly(boolean readonly)Sets the read-only status of this radio button group.voidsetTabIndex(int tabIndex)Sets the tabulator index for the container element that holds the radio buttons.protected voidupdateEnabledState()Sets radio buttons enabled according to this widget's enabled and read-only status, as well as each option's own enabled status.protected voidupdateItemEnabled(com.google.gwt.user.client.ui.RadioButton radioButton, boolean value)Updates the enabled state of a radio button.protected voidupdateItemSelection(com.google.gwt.user.client.ui.RadioButton radioButton, boolean value)Updates the selected state of a radio button.-
Methods inherited from class com.vaadin.client.widgets.FocusableFlowPanelComposite
addBlurHandler, addFocusHandler, getWidget
-
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
-
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
-
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
-
-
-
-
Field Detail
-
CLASSNAME
public static final String CLASSNAME
Default classname for this widget.- See Also:
- Constant Field Values
-
CLASSNAME_OPTION
public static final String CLASSNAME_OPTION
Default classname for all radio buttons within this widget.- See Also:
- Constant Field Values
-
CLASSNAME_OPTION_SELECTED
public static final String CLASSNAME_OPTION_SELECTED
Default classname for the selected radio button within this widget.- See Also:
- Constant Field Values
-
client
public ApplicationConnection client
For internal use only. May be removed or replaced in the future.
-
-
Method Detail
-
buildOptions
public void buildOptions(List<elemental.json.JsonObject> items)
Build all the options.- Parameters:
items- the list of options
-
getItem
public elemental.json.JsonObject getItem(com.google.gwt.dom.client.Element element)
Returns the JsonObject used to populate the RadioButton widget that contains given Element.- Parameters:
element- the element to search for- Returns:
- the related JsonObject;
nullif not found - Since:
- 8.2
-
onClick
public void onClick(com.google.gwt.event.dom.client.ClickEvent event)
- Specified by:
onClickin interfacecom.google.gwt.event.dom.client.ClickHandler
-
setTabIndex
public void setTabIndex(int tabIndex)
Sets the tabulator index for the container element that holds the radio buttons. It represents the entire radio button group within the browser's focus cycle.- Parameters:
tabIndex- tabulator index for the radio button group
-
updateEnabledState
protected void updateEnabledState()
Sets radio buttons enabled according to this widget's enabled and read-only status, as well as each option's own enabled status.
-
isHtmlContentAllowed
public boolean isHtmlContentAllowed()
Returns whether HTML is allowed in the item captions.- Returns:
trueif the captions are used as HTML,falseif used as plain text
-
setHtmlContentAllowed
public void setHtmlContentAllowed(boolean htmlContentAllowed)
Sets whether HTML is allowed in the item captions. If set totrue, the captions are displayed as HTML and the developer is responsible for ensuring no harmful HTML is used. If set tofalse, the content is displayed as plain text.This value is delegated from the RadioButtonGroupState.
- Parameters:
htmlContentAllowed-trueif the captions are used as HTML,falseif used as plain text
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfacecom.google.gwt.user.client.ui.HasEnabled
-
isReadonly
public boolean isReadonly()
Returns whether this radio button group is read-only or not.- Returns:
trueif this widget is read-only,falseotherwise
-
setReadonly
public void setReadonly(boolean readonly)
Sets the read-only status of this radio button group.- Parameters:
readonly-trueif this widget should be read-only,falseotherwise
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabledin interfacecom.google.gwt.user.client.ui.HasEnabled
-
addSelectionChangeHandler
public Registration addSelectionChangeHandler(Consumer<elemental.json.JsonObject> selectionChanged)
Adds the given selection change handler to this widget.- Parameters:
selectionChanged- the handler that should be triggered when selection changes- Returns:
- the registration object for removing the given handler when no longer needed
-
selectItemKey
public void selectItemKey(String selectedItemKey)
Removes previous selection and adds new selection.- Parameters:
selectedItemKey- the key of the selected radio button
-
focus
public void focus()
Set focus to the selected radio button (or first radio button if there is no selection).- Specified by:
focusin interfaceFocusable- Overrides:
focusin classFocusableFlowPanelComposite
-
updateItemSelection
protected void updateItemSelection(com.google.gwt.user.client.ui.RadioButton radioButton, boolean value)Updates the selected state of a radio button.- Parameters:
radioButton- the radio button to updatevalue-trueif selected;falseif not
-
updateItemEnabled
protected void updateItemEnabled(com.google.gwt.user.client.ui.RadioButton radioButton, boolean value)Updates the enabled state of a radio button.- Parameters:
radioButton- the radio button to updatevalue-trueif enabled;falseif not- Since:
- 8.3.3
-
-