Logo Search packages:      
Sourcecode: libjgoodies-binding-java version File versions

com::jgoodies::binding::value::AbstractConverter Class Reference

Inheritance diagram for com::jgoodies::binding::value::AbstractConverter:

com::jgoodies::binding::value::AbstractValueModel com::jgoodies::binding::beans::Model com::jgoodies::binding::value::ValueModel com::jgoodies::binding::beans::Observable com::jgoodies::binding::tests::AbstractConverterTest::TestConverter com::jgoodies::binding::value::ConverterFactory::BooleanNegator com::jgoodies::binding::value::ConverterFactory::BooleanToStringConverter com::jgoodies::binding::value::ConverterFactory::DoubleConverter com::jgoodies::binding::value::ConverterFactory::DoubleToIntegerConverter com::jgoodies::binding::value::ConverterFactory::FloatConverter com::jgoodies::binding::value::ConverterFactory::FloatToIntegerConverter com::jgoodies::binding::value::ConverterFactory::IntegerConverter com::jgoodies::binding::value::ConverterFactory::LongConverter com::jgoodies::binding::value::ConverterFactory::LongToIntegerConverter com::jgoodies::binding::value::ConverterFactory::StringConverter

List of all members.


Detailed Description

An abstract class that minimizes the effort required to implement a type converter. A type converter is a ValueModel that converts the type of an object being held as a value in one ValueModel into another type.

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.

The conversion must be performed when reading and writing values, as well as in the change notification. This class specifies abstract methods for the conversion from source to output, which is used to convert in getValue and in the change notification. For the write conversion you must implement setValue.

Most converters can set values converted by convertFromSubject with setValue. However, a converter may reject subject values to be converted and may reject values to be set - as any ValueModel.

Type converters should be used judiciously and only to bridge two ValueModels. Converters often use a generic but weak conversion, and so can be limited w.r.t. to localized formatting conventions.

When binding non-String values to a text UI component, consider using a javax.swing.JFormattedTextField. Formatted text fields provide a powerful means to convert strings to objects and handle many cases that arise around invalid input. Formatted text fields can be bound to ValueModels using the com.jgoodies.binding.beans.PropertyConnector class.

Author:
Karsten Lentzsch
Version:
Revision
1.8

See also:
ValueModel

ConverterFactory

javax.swing.JFormattedTextField

com.jgoodies.binding.beans.PropertyConnector

Definition at line 80 of file AbstractConverter.java.


Public Member Functions

 AbstractConverter (ValueModel subject)
final synchronized void addPropertyChangeListener (String propertyName, PropertyChangeListener listener)
final synchronized void addPropertyChangeListener (PropertyChangeListener listener)
final void addValueChangeListener (PropertyChangeListener l)
final synchronized void addVetoableChangeListener (String propertyName, VetoableChangeListener listener)
final synchronized void addVetoableChangeListener (VetoableChangeListener listener)
final boolean booleanValue ()
abstract Object convertFromSubject (Object subjectValue)
final double doubleValue ()
final void fireValueChange (float oldValue, float newValue)
final void fireValueChange (double oldValue, double newValue)
final void fireValueChange (long oldValue, long newValue)
final void fireValueChange (int oldValue, int newValue)
final void fireValueChange (boolean oldValue, boolean newValue)
final void fireValueChange (Object oldValue, Object newValue, boolean checkIdentity)
final void fireValueChange (Object oldValue, Object newValue)
final float floatValue ()
final synchronized
PropertyChangeListener[] 
getPropertyChangeListeners (String propertyName)
final synchronized
PropertyChangeListener[] 
getPropertyChangeListeners ()
String getString ()
Object getValue ()
final synchronized
VetoableChangeListener[] 
getVetoableChangeListeners (String propertyName)
final synchronized
VetoableChangeListener[] 
getVetoableChangeListeners ()
final int intValue ()
final long longValue ()
final void release ()
final synchronized void removePropertyChangeListener (String propertyName, PropertyChangeListener listener)
final synchronized void removePropertyChangeListener (PropertyChangeListener listener)
final void removeValueChangeListener (PropertyChangeListener l)
final synchronized void removeVetoableChangeListener (String propertyName, VetoableChangeListener listener)
final synchronized void removeVetoableChangeListener (VetoableChangeListener listener)
void setValue (Object newValue)
final void setValue (long l)
final void setValue (int i)
final void setValue (float f)
final void setValue (double d)
final void setValue (boolean b)
String toString ()

Static Public Attributes

static final String PROPERTYNAME_VALUE = "value"

Protected Member Functions

final boolean equals (Object o1, Object o2)
final void fireMultiplePropertiesChanged ()
final void firePropertyChange (String propertyName, long oldValue, long newValue)
final void firePropertyChange (String propertyName, int oldValue, int newValue)
final void firePropertyChange (String propertyName, float oldValue, float newValue)
final void firePropertyChange (String propertyName, double oldValue, double newValue)
final void firePropertyChange (String propertyName, boolean oldValue, boolean newValue)
final void firePropertyChange (String propertyName, Object oldValue, Object newValue, boolean checkIdentity)
final void firePropertyChange (String propertyName, Object oldValue, Object newValue)
final void firePropertyChange (PropertyChangeEvent event)
final void fireVetoableChange (String propertyName, long oldValue, long newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, float oldValue, float newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, int oldValue, int newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, double oldValue, double newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, boolean oldValue, boolean newValue) throws PropertyVetoException
final void fireVetoableChange (String propertyName, Object oldValue, Object newValue) throws PropertyVetoException
final void fireVetoableChange (PropertyChangeEvent event) throws PropertyVetoException

Protected Attributes

final ValueModel subject

Private Attributes

final PropertyChangeListener subjectValueChangeHandler

Classes

class  SubjectValueChangeHandler

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index