Module is.codion.swing.common.ui
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 typeC
- 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
.-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.common.value.Value
Value.Builder<T,
B extends Value.Builder<T, B>>, Value.BuilderFactory, Value.Notify, Value.Validator<T> -
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractComponentValue
(C component) Instantiates a new nullableAbstractComponentValue
protected
AbstractComponentValue
(C component, T nullValue) Instantiates a newAbstractComponentValue
-
Method Summary
Modifier and TypeMethodDescriptionfinal C
protected abstract T
Returns the value from the underlying componentprotected final T
getValue()
Returns the actual internal value.protected abstract void
setComponentValue
(T value) Sets the given value in the underlying component.protected final void
Sets the actual internal value.Methods inherited from class is.codion.common.value.AbstractValue
accept, addConsumer, addListener, addValidator, addWeakConsumer, addWeakListener, clear, createObserver, get, link, link, map, notifyListeners, nullable, 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 is.codion.common.observer.Observer
addConsumer, addListener, addWeakConsumer, addWeakListener, removeConsumer, removeListener, removeWeakConsumer, removeWeakListener
Methods inherited from interface is.codion.common.value.Value
accept, addValidator, clear, link, link, map, observer, removeValidator, set, unlink, unlink, validate
Methods inherited from interface is.codion.common.value.ValueObserver
get, isEqualTo, isNotEqualTo, isNotNull, isNull, nullable, optional
-
Constructor Details
-
AbstractComponentValue
Instantiates a new nullableAbstractComponentValue
- Parameters:
component
- the component- Throws:
NullPointerException
- in case component is null
-
AbstractComponentValue
Instantiates a newAbstractComponentValue
- Parameters:
component
- the componentnullValue
- the value to use instead of null- Throws:
NullPointerException
- in case component is null
-
-
Method Details
-
component
- Specified by:
component
in interfaceComponentValue<T,
C extends JComponent> - Returns:
- the input component representing the value
-
getValue
Description copied from class:AbstractValue
Returns the actual internal value.- Specified by:
getValue
in classAbstractValue<T>
- Returns:
- the value
-
setValue
Description copied from class:AbstractValue
Sets the actual internal value.- Specified by:
setValue
in classAbstractValue<T>
- Parameters:
value
- the value
-
getComponentValue
Returns the value from the underlying component- Returns:
- the value from the underlying component
- See Also:
-
setComponentValue
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:
-