JTextArea. BoundPropertyTextArea is implemented to work with the property binding framework, particularly {@link DisplayProject.binding.adapter.DocumentAdapter}. DocumentAdapter is a wrapper around a {@link javax.swing.text.Document} which listensfor {@link java.beans.PropertyChangeEvent}s fired by an associated {@link com.jgoodies.binding.value.ValueModel}and updates the underlying document to reflect the changes. DocumentAdapter detects changes by the user by intercepting {@link javax.swing.event.DocumentEvent}s and updates the ValueModel accordingly. The Forte behaviour is realised by associating an instance of ValueModel with an instance of BoundPropertyTextArea. BoundPropertyTextArea makes use of two internal {@link java.beans.PropertyChangeListener}s and a {@link javax.swing.event.DocumentListener}. These determine whether a change to the associated bean model property was caused by the user typing in the text area or by a change in the backend. One PropertyChangeListener intercepts PropertyChangeEvents before the DocumentAdapter. The second PropertyChangeListener intercepts PropertyChangeEvents after the DocumentAdapter. It is the responsibility of the client to ensure that these listeners are registered in the correct sequence.
Refer to {@link DisplayProject.binding.TextComponentBinder} for an example ofusage.
The other advantage of this class is that it fires the same events as the Forte event model at the same time. @see DisplayProject.binding.TextComponentBinder @author Tim Faulkes
| |
| |
| |