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_VALUE
PROPERTY_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, setVisible
addValueChangeListener, booleanValue, doubleValue, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, floatValue, getString, intValue, longValue, paramString, removeValueChangeListener, setValue, setValue, setValue, setValue, setValue, toString, valueString
createPropertyChangeSupport, firePropertyChange
addPropertyChangeListener, 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, removeVetoableChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addValueChangeListener, removeValueChangeListener
public 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 null
public Object convertFromSubject(Object sourceValue)
sourceValue
- the source's valuepublic void setValue(Object targetValue)
ValueModel
targetValue
- the value to be setpublic Object getValue()
protected PropertyChangeListener createValueChangeHandler()
createValueChangeHandler
in class AbstractWrappedValueModel
Copyright © 2002-2015 JGoodies Software GmbH. All Rights Reserved.