Class AbstractComponentValue<T,C extends JComponent>

java.lang.Object
is.codion.common.value.AbstractValue<T>
is.codion.swing.common.ui.component.value.AbstractComponentValue<T,C>
Type Parameters:
T - the value type
C - the component type
All Implemented Interfaces:
Observer<T>, Value<T>, ValueObserver<T>, ComponentValue<T,C>, Consumer<T>
Direct Known Subclasses:
AbstractTextComponentValue

public abstract class AbstractComponentValue<T,C extends JComponent> extends AbstractValue<T> implements ComponentValue<T,C>
An abstract base implementation of ComponentValue.
  • Constructor Details

    • AbstractComponentValue

      protected AbstractComponentValue(C component)
      Instantiates a new nullable AbstractComponentValue
      Parameters:
      component - the component
      Throws:
      NullPointerException - in case component is null
    • AbstractComponentValue

      protected AbstractComponentValue(C component, T nullValue)
      Instantiates a new AbstractComponentValue
      Parameters:
      component - the component
      nullValue - the value to use instead of null
      Throws:
      NullPointerException - in case component is null
  • Method Details

    • component

      public final C component()
      Specified by:
      component in interface ComponentValue<T,C extends JComponent>
      Returns:
      the input component representing the value
    • getValue

      protected final T getValue()
      Description copied from class: AbstractValue
      Returns the actual internal value.
      Specified by:
      getValue in class AbstractValue<T>
      Returns:
      the value
    • setValue

      protected final void setValue(T value)
      Description copied from class: AbstractValue
      Sets the actual internal value.
      Specified by:
      setValue in class AbstractValue<T>
      Parameters:
      value - the value
    • getComponentValue

      protected abstract T getComponentValue()
      Returns the value from the underlying component
      Returns:
      the value from the underlying component
      See Also:
    • setComponentValue

      protected abstract void setComponentValue(T value)
      Sets the given value in the underlying component. Note that this method is called on the EDT.
      Parameters:
      value - the value to display in the underlying component
      See Also: