JGoodies Binding :: Guide :: Value Models
Author: Karsten Lentzsch
Description: The JGoodies Binding provides an elegant means to present object properties in a user interface.
Keywords: JGoodies Data Binding Java Swing UI Design Usability Lentzsch Kiel
Date: 2006-01-01

# :: Guide :: Value Models :: ## ValueModel Interface The ValueModel interface describes a read-write value that is observable. You can read its value using `#getValue()`, you can write its value using `#setValue(Object)`. And you can register a `PropertyChangeListener` that will be notified if the value changes. ## Predefined ValueModel Implementations `ValueHolder` is the minimal ValueModel implementation. It holds a single value that one can get and set from outside. And it keeps a list of PropertyChangeListeners. The most frequently used ValueModel implementation is the `PropertyAdapter` and its variations. It converts a single (bound) Bean property into a ValueModel. Actually most PropertyAdapters are returned by `PresentationModel#getModel`, `#getBufferedModel`, and the `BeanAdapter` class. The `BufferedValueModel` provides a means to buffer values, so changes are deferred until OK or Apply is pressed. For details see the Buffering task. The `ConverterFactory` vends ValueModel implementations that convert types, for example `Date` to `String`. ## Custom ValueModel Implementations To minimize the effort required to implement the ValueModel interface, you can extend the `AbstractValueModel`. Custom converters will likely extend the `AbstractConverter`. See also the Type Conversion task. ## Combining ValueModels Since ValueModel describes a uniform interface to get and set values, they can be easily combined. They can be wrapped, connected, composed, etc. For example, the `BufferedValueModel` wraps any ValueModel to buffer the value until a trigger indicates that the value shall be committed or flushed.
(c) 2010 JGoodies |  |