Class ObservedField

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ObservedField.ObservedFieldElement
      This class gives a nice tag name to ObservedField in the browser.
      • 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<?>>
    • Constructor Summary

      Constructors 
      Constructor Description
      ObservedField()
      Creates a field that will set its value to whether or not it is currently shown on screen.
      ObservedField​(boolean onlyToggleOnce)
      Creates a field that will optionally only toggle value once, on first showing.
      ObservedField​(boolean onlyToggleOnce, com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.HasValue.ValueChangeEvent<Boolean>> listener)
      Creates a field that will optionally only toggle value once, on first showing.
      ObservedField​(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.HasValue.ValueChangeEvent<Boolean>> listener)
      Creates a field that will set its value to whether or not it is currently shown on screen.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.vaadin.flow.shared.Registration addValueChangeListener​(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>> valueChangeListener)  
      protected void fireValueChangeEvent​(boolean currentValue)
      Fires value change to registered listeners.
      Boolean getValue()  
      boolean isReadOnly()  
      boolean isRequiredIndicatorVisible()  
      void setReadOnly​(boolean b)  
      void setRequiredIndicatorVisible​(boolean visible)  
      void setValue​(Boolean aBoolean)  
      • Methods inherited from class com.vaadin.flow.component.Composite

        getChildren, getContent, getElement, initContent
      • Methods inherited from class com.vaadin.flow.component.Component

        addListener, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
      • Methods inherited from interface com.vaadin.flow.component.AttachNotifier

        addAttachListener
      • Methods inherited from interface com.vaadin.flow.component.DetachNotifier

        addDetachListener
      • Methods inherited from interface com.vaadin.flow.component.HasElement

        getElement
      • 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.HasValue

        clear, getEmptyValue, getOptionalValue, isEmpty
    • Constructor Detail

      • ObservedField

        public ObservedField()
        Creates a field that will set its value to whether or not it is currently shown on screen.
      • ObservedField

        public ObservedField​(com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.HasValue.ValueChangeEvent<Boolean>> listener)
        Creates a field that will set its value to whether or not it is currently shown on screen. It will also register given listener using addValueChangeListener(ValueChangeListener).
        Parameters:
        listener - Listener to add.
      • ObservedField

        public ObservedField​(boolean onlyToggleOnce)
        Creates a field that will optionally only toggle value once, on first showing.
        Parameters:
        onlyToggleOnce - Whether or not to trigger value change only once.
      • ObservedField

        public ObservedField​(boolean onlyToggleOnce,
                             com.vaadin.flow.component.HasValue.ValueChangeListener<com.vaadin.flow.component.HasValue.ValueChangeEvent<Boolean>> listener)
        Creates a field that will optionally only toggle value once, on first showing. It will also register given listener using addValueChangeListener(ValueChangeListener).
        Parameters:
        onlyToggleOnce - Whether or not to trigger value change only once.
        listener - Listener to add.
    • Method Detail

      • fireValueChangeEvent

        protected void fireValueChangeEvent​(boolean currentValue)
        Fires value change to registered listeners.
        Parameters:
        currentValue - Current value of the field.
      • setValue

        public void setValue​(Boolean aBoolean)
        Specified by:
        setValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>,​Boolean>
      • getValue

        public Boolean getValue()
        Specified by:
        getValue in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>,​Boolean>
      • addValueChangeListener

        public com.vaadin.flow.shared.Registration addValueChangeListener​(com.vaadin.flow.component.HasValue.ValueChangeListener<? super com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>> valueChangeListener)
        Specified by:
        addValueChangeListener in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>,​Boolean>
      • setReadOnly

        public void setReadOnly​(boolean b)
        Specified by:
        setReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>,​Boolean>
      • isReadOnly

        public boolean isReadOnly()
        Specified by:
        isReadOnly in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>,​Boolean>
      • setRequiredIndicatorVisible

        public void setRequiredIndicatorVisible​(boolean visible)
        Specified by:
        setRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>,​Boolean>
      • isRequiredIndicatorVisible

        public boolean isRequiredIndicatorVisible()
        Specified by:
        isRequiredIndicatorVisible in interface com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<ObservedField,​Boolean>,​Boolean>