com.vaadin.flow.component.radiobutton.
Class RadioButtonGroup<T>
- java.lang.Object
-
- com.vaadin.flow.component.Component
-
- com.vaadin.flow.component.AbstractField<C,T>
-
- com.vaadin.flow.component.AbstractSinglePropertyField<R,T>
-
- com.vaadin.flow.component.radiobutton.GeneratedVaadinRadioGroup<RadioButtonGroup<T>,T>
-
- com.vaadin.flow.component.radiobutton.RadioButtonGroup<T>
-
All Implemented Interfaces:
AttachNotifier, DetachNotifier, HasComponents, HasElement, HasEnabled, HasStyle, HasValue<AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>, HasValueAndElement<AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>, HasDataProvider<T>, HasItems<T>, HasItemsAndComponents<T>, SingleSelect<RadioButtonGroup<T>,T>, Serializable
public class RadioButtonGroup<T> extends GeneratedVaadinRadioGroup<RadioButtonGroup<T>,T> implements HasItemsAndComponents<T>, SingleSelect<RadioButtonGroup<T>,T>, HasDataProvider<T>
A single select component using radio buttons as options.
This is a server side Java integration for the
vaadin-radio-group
element.Usage examples, see the demo in vaadin.com.
Author:
Vaadin Ltd.
See Also:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
AbstractField.ComponentValueChangeEvent<C extends Component,V>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.data.binder.HasItemsAndComponents
HasItemsAndComponents.ItemComponent<T>
-
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
HasValue.ValueChangeEvent<V>, HasValue.ValueChangeListener<E extends HasValue.ValueChangeEvent<?>>
-
-
Constructor Summary
Constructors Constructor and Description RadioButtonGroup()
-
Method Summary
All Methods Modifier and Type Method and Description DataProvider<T,?>
getDataProvider()
Gets the data provider.
SerializablePredicate<T>
getItemEnabledProvider()
Returns the item enabled predicate.
ComponentRenderer<? extends Component,T>
getItemRenderer()
Returns the item component renderer.
protected boolean
hasValidValue()
Checks whether the element property has a value that can be converted to the model type.
boolean
isReadOnly()
Returns whether this
HasValue
is in read-only mode or not.void
onEnabledStateChanged(boolean enabled)
Handle component enable state when the enabled state changes.
void
setDataProvider(DataProvider<T,?> dataProvider)
Sets the data provider for this listing.
void
setItemEnabledProvider(SerializablePredicate<T> itemEnabledProvider)
Sets the item enabled predicate for this radio button group.
void
setReadOnly(boolean readOnly)
Sets the read-only mode of this
HasValue
to given mode.void
setRenderer(ComponentRenderer<? extends Component,T> renderer)
Sets the item renderer for this radio button group.
-
Methods inherited from class com.vaadin.flow.component.radiobutton.GeneratedVaadinRadioGroup
isDisabledBoolean, setDisabled
-
Methods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
setPresentationValue, setSynchronizedEvent
-
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
-
Methods inherited from class com.vaadin.flow.component.Component
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getUI, hasListener, isTemplateMapped, isVisible, onAttach, onDetach, set, setElement, setId, setVisible
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.data.binder.HasItemsAndComponents
addComponents, getItemPosition, prependComponents
-
Methods inherited from interface com.vaadin.flow.component.HasComponents
add, remove, removeAll
-
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isRequiredIndicatorVisible, setRequiredIndicatorVisible
-
Methods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValue
-
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabled
-
Methods inherited from interface com.vaadin.flow.data.binder.HasDataProvider
setItems
-
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
-
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
-
-
-
-
Method Detail
-
hasValidValue
protected boolean hasValidValue()
Description copied from class:
AbstractSinglePropertyField
Checks whether the element property has a value that can be converted to the model type. Property changes from the element will be ignored if this method returns
false
. The default implementation always returntrue
.Overrides:
hasValidValue
in classAbstractSinglePropertyField<RadioButtonGroup<T>,T>
Returns:
true
if the element property value can be converted to the model type; otherwisefalse
-
setDataProvider
public void setDataProvider(DataProvider<T,?> dataProvider)
Description copied from interface:
HasDataProvider
Sets the data provider for this listing. The data provider is queried for displayed items as needed.
Specified by:
setDataProvider
in interfaceHasDataProvider<T>
Parameters:
dataProvider
- the data provider, not null
-
getDataProvider
public DataProvider<T,?> getDataProvider()
Gets the data provider.
Returns:
the data provider, not
null
-
getItemEnabledProvider
public SerializablePredicate<T> getItemEnabledProvider()
Returns the item enabled predicate.
Returns:
the item enabled predicate
See Also:
setItemEnabledProvider(com.vaadin.flow.function.SerializablePredicate<T>)
-
setItemEnabledProvider
public void setItemEnabledProvider(SerializablePredicate<T> itemEnabledProvider)
Sets the item enabled predicate for this radio button group. The predicate is applied to each item to determine whether the item should be enabled (
true
) or disabled (false
). Disabled items are displayed as grayed out and the user cannot select them. The default predicate always returns true (all the items are enabled).Parameters:
itemEnabledProvider
- the item enable predicate, notnull
-
getItemRenderer
public ComponentRenderer<? extends Component,T> getItemRenderer()
Returns the item component renderer.
Returns:
the item renderer
See Also:
-
setRenderer
public void setRenderer(ComponentRenderer<? extends Component,T> renderer)
Sets the item renderer for this radio button group. The renderer is applied to each item to create a component which represents the item.
Parameters:
renderer
- the item renderer, notnull
-
onEnabledStateChanged
public void onEnabledStateChanged(boolean enabled)
Description copied from class:
Component
Handle component enable state when the enabled state changes.
By default this sets or removes the 'disabled' attribute from the element. This can be overridden to have custom handling.
Overrides:
onEnabledStateChanged
in classComponent
Parameters:
enabled
- the new enabled state of the component
-
setReadOnly
public void setReadOnly(boolean readOnly)
Description copied from interface:
HasValue
Sets the read-only mode of this
HasValue
to given mode. The user can't change the value when in read-only mode.A
HasValue
with a visual component in read-only mode typically looks visually different to signal to the user that the value cannot be edited.Specified by:
setReadOnly
in interfaceHasValue<AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
Specified by:
setReadOnly
in interfaceHasValueAndElement<AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
Parameters:
readOnly
- a boolean value specifying whether the component is put read-only mode or not
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:
HasValue
Returns whether this
HasValue
is in read-only mode or not.Specified by:
isReadOnly
in interfaceHasValue<AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
Specified by:
isReadOnly
in interfaceHasValueAndElement<AbstractField.ComponentValueChangeEvent<RadioButtonGroup<T>,T>,T>
Returns:
false
if the user can modify the value,true
if not.
-
-