public final class ConverterValueModel extends AbstractWrappedValueModel
More formally, a converting ValueModel VM1 converts the type T2 of an object being held as a value in one ValueModel VM2 into another type T1. When reading a value from VM1, instances of T2 are read from VM2 and are converted to T1. When storing a new value to VM1, the type converter will perform the inverse conversion and will convert an instance of T1 to T2.
ValueModel,
Serialized FormPROPERTY_VALUEPROPERTY_EDITABLE, PROPERTY_ENABLED, PROPERTY_VISIBLE| Constructor and Description |
|---|
ConverterValueModel(ValueModel source,
BindingConverter converter)
Constructs a ConverterValueModel on the given source ValueModel and
BindingConverter.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
convertFromSubject(Object sourceValue)
Converts a value from the subject to the type or format used
by this converter.
|
protected PropertyChangeListener |
createValueChangeHandler() |
Object |
getValue()
Converts the subject's value and returns the converted value.
|
void |
setValue(Object targetValue)
Sets a new value and notifies any registered value listeners
if the value has changed.
|
getWrappee, isEditable, isEnabled, isVisible, release, setEditable, setEnabled, setVisibleaddValueChangeListener, booleanValue, doubleValue, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, floatValue, getString, intValue, longValue, paramString, removeValueChangeListener, setValue, setValue, setValue, setValue, setValue, toString, valueStringcreatePropertyChangeSupport, firePropertyChangeaddPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddValueChangeListener, removeValueChangeListenerpublic ConverterValueModel(ValueModel source, BindingConverter converter)
source - the ValueModel that holds the source valueconverter - converts source values to target values and vice versaNullPointerException - if source is nullpublic Object convertFromSubject(Object sourceValue)
sourceValue - the source's valuepublic void setValue(Object targetValue)
ValueModeltargetValue - the value to be setpublic Object getValue()
protected PropertyChangeListener createValueChangeHandler()
createValueChangeHandler in class AbstractWrappedValueModelCopyright © 2002-2015 JGoodies Software GmbH. All Rights Reserved.