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:
is.codion.common.event.EventObserver<T>, is.codion.common.value.Value<T>, is.codion.common.value.ValueObserver<T>, ComponentValue<T,C>, Consumer<T>, Supplier<T>
Direct Known Subclasses:
AbstractTextComponentValue

public abstract class AbstractComponentValue<T,C extends JComponent> extends is.codion.common.value.AbstractValue<T> implements ComponentValue<T,C>
An abstract base implementation of ComponentValue.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface is.codion.common.value.Value

    is.codion.common.value.Value.Builder<T extends Object>, is.codion.common.value.Value.Notify, is.codion.common.value.Value.Validator<T extends Object>
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Instantiates a new nullable AbstractComponentValue
    protected
    AbstractComponentValue(C component, T nullValue)
    Instantiates a new AbstractComponentValue
  • Method Summary

    Modifier and Type
    Method
    Description
    final C
     
    final T
    get()
     
    protected abstract T
    Returns the value from the underlying component
    protected abstract void
    Sets the given value in the underlying component.
    protected final void
    setValue(T value)
     

    Methods inherited from class is.codion.common.value.AbstractValue

    accept, addConsumer, addListener, addValidator, addWeakConsumer, addWeakListener, clear, clearValue, createObserver, isNullable, link, link, map, notifyListeners, observer, removeConsumer, removeListener, removeValidator, removeWeakConsumer, removeWeakListener, set, unlink, unlink, validate

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.util.function.Consumer

    andThen

    Methods inherited from interface is.codion.common.event.EventObserver

    addConsumer, addListener, addWeakConsumer, addWeakListener, removeConsumer, removeListener, removeWeakConsumer, removeWeakListener

    Methods inherited from interface is.codion.common.value.Value

    accept, addValidator, clear, link, link, map, mapNull, observer, removeValidator, set, unlink, unlink, validate

    Methods inherited from interface is.codion.common.value.ValueObserver

    isEqualTo, isNotEqualTo, isNotNull, isNull, isNullable, optional
  • 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

    • get

      public final T get()
      Specified by:
      get in interface Supplier<T>
    • component

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

      protected final void setValue(T value)
      Specified by:
      setValue in class is.codion.common.value.AbstractValue<T>
    • 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: