Class Switch
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<C,T>
com.vaadin.flow.component.AbstractSinglePropertyField<JmixSwitch,Boolean>
io.jmix.flowui.kit.component.checkbox.JmixSwitch
io.jmix.flowui.component.checkbox.Switch
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<JmixSwitch>,com.vaadin.flow.component.ClickNotifier<JmixSwitch>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<JmixSwitch>,com.vaadin.flow.component.FocusNotifier<JmixSwitch>,com.vaadin.flow.component.HasAriaLabel,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasHelper,com.vaadin.flow.component.HasLabel,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.component.HasValidation,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixSwitch,,Boolean>, Boolean> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixSwitch,,Boolean>, Boolean> com.vaadin.flow.component.shared.HasTooltip,com.vaadin.flow.component.shared.HasValidationProperties,com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixSwitch,,Boolean>, Boolean> com.vaadin.flow.data.binder.HasValidator<Boolean>,HasRequired,SupportsValidation<Boolean>,SupportsValueSource<Boolean>,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware
public class Switch
extends JmixSwitch
implements SupportsValueSource<Boolean>, SupportsValidation<Boolean>, HasRequired, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
Switch is an input field representing a binary choice, similar to
JmixCheckbox.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,V extends Object> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V extends Object>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected CheckboxDelegate<Switch,Boolean, Boolean> Fields inherited from class io.jmix.flowui.kit.component.checkbox.JmixSwitch
labelElement, validationControllerFields inherited from interface io.jmix.flowui.component.HasRequired
PROPERTY_REQUIREDFields inherited from interface io.jmix.flowui.component.SupportsValidation
PROPERTY_ERROR_MESSAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddValidator(Validator<? super Boolean> validator) voidprotected CheckboxDelegate<Switch,Boolean, Boolean> voidprotected voidbooleanvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetInvalid(boolean invalid) Sets invalid state to the field considering result of field validation.voidsetRequired(boolean required) voidsetRequiredIndicatorVisible(boolean requiredIndicatorVisible) Sets whether the user is required to select the switch.voidsetRequiredMessage(String requiredMessage) voidvoidsetValueSource(ValueSource<Boolean> valueSource) protected voidvalidate()Methods inherited from class io.jmix.flowui.kit.component.checkbox.JmixSwitch
getAriaLabel, getAriaLabelledBy, getDefaultValidator, getLabel, isAutofocus, isRequiredIndicatorVisible, onAttach, setAriaLabel, setAriaLabelledBy, setAutofocus, setLabel, setLabelComponent, setManualValidationMethods inherited from class com.vaadin.flow.component.AbstractSinglePropertyField
getSynchronizationRegistration, hasValidValue, setPresentationValue, setSynchronizedEventMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, valueEqualsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface io.jmix.flowui.component.HasRequired
isRequiredMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.data.binder.HasValidator
addValidationStatusChangeListenerMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, setReadOnlyMethods inherited from interface io.jmix.flowui.component.SupportsValidation
getErrorMessage, setErrorMessage
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
fieldDelegate
-
-
Constructor Details
-
Switch
public Switch()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
initComponent
protected void initComponent() -
createFieldDelegate
-
addValidator
- Specified by:
addValidatorin interfaceSupportsValidation<Boolean>
-
executeValidators
- Specified by:
executeValidatorsin interfaceSupportsValidation<Boolean>- Throws:
ValidationException
-
validate
protected void validate()- Overrides:
validatein classJmixSwitch
-
isInvalid
public boolean isInvalid()- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
isInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties
-
setInvalid
public void setInvalid(boolean invalid) Description copied from interface:SupportsValidationSets invalid state to the field considering result of field validation.- Invalid - false and validation passed - false = field is invalid
- Invalid - false and validation passed - true = field is valid
- Invalid - true and validation passed - false = field is invalid
- Invalid - true and validation passed - true = field is invalid
- Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation- Specified by:
setInvalidin interfacecom.vaadin.flow.component.shared.HasValidationProperties- Specified by:
setInvalidin interfaceSupportsValidation<Boolean>- Parameters:
invalid- whether field should be invalid
-
getRequiredMessage
- Specified by:
getRequiredMessagein interfaceHasRequired
-
setRequiredMessage
- Specified by:
setRequiredMessagein interfaceHasRequired
-
getValueSource
- Specified by:
getValueSourcein interfaceSupportsValueSource<Boolean>
-
setValueSource
- Specified by:
setValueSourcein interfaceSupportsValueSource<Boolean>
-
setValue
- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixSwitch,Boolean>, Boolean> - Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<JmixSwitch,Boolean>
-
setRequired
public void setRequired(boolean required) - Specified by:
setRequiredin interfaceHasRequired
-
setRequiredIndicatorVisible
public void setRequiredIndicatorVisible(boolean requiredIndicatorVisible) Description copied from class:JmixSwitchSets whether the user is required to select the switch. When required, an indicator appears next to the label and the field invalidates if the switch is first selected and then deselected.NOTE: The required indicator is only visible when the field has a label, see
JmixSwitch.setLabel(String).- Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixSwitch,Boolean>, Boolean> - Specified by:
setRequiredIndicatorVisiblein interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<JmixSwitch,Boolean>, Boolean> - Overrides:
setRequiredIndicatorVisiblein classJmixSwitch- Parameters:
requiredIndicatorVisible-trueto make the field required,falseotherwise
-