com.jgoodies.binding.beans

Class BeanAdapter.SimplePropertyAdapter

Enclosing Class:
BeanAdapter<B>
Implemented Interfaces:
Observable, Serializable, ValueModel

public class BeanAdapter.SimplePropertyAdapter
extends AbstractValueModel

Implements the access to the individual bean properties. All SimplePropertyAdapters created by this BeanAdapter share a single PropertyChangeListener that is used to fire value changes in this SimplePropertyAdapter.

This class is public to enable reflection access.

Field Summary

Fields inherited from class com.jgoodies.binding.value.AbstractValueModel

PROPERTYNAME_VALUE

Constructor Summary

SimplePropertyAdapter(String propertyName, String getterName, String setterName)
Constructs a SimplePropertyAdapter for the given property name, getter and setter name.

Method Summary

protected void
fireChange(B currentBean)
Object
getValue()
Returns the value of the adapted bean property, or null if the bean is null.
protected void
setBean0(B oldBean, B newBean)
void
setValue(Object newValue)
Sets the given object as new value of the adapted bean property.
void
setVetoableValue(Object newValue)
Sets the given object as new value of the adapted bean property.

Methods inherited from class com.jgoodies.binding.value.AbstractValueModel

String toString, addValueChangeListener, booleanValue, doubleValue, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, fireValueChange, floatValue, getString, intValue, longValue, removeValueChangeListener, setValue, setValue, setValue, setValue, setValue

Methods inherited from class com.jgoodies.binding.beans.Model

addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, equals, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener

Constructor Details

SimplePropertyAdapter

protected SimplePropertyAdapter(String propertyName,
                                String getterName,
                                String setterName)
Constructs a SimplePropertyAdapter for the given property name, getter and setter name.
Parameters:
propertyName - the name of the property to adapt
getterName - the name of the method that reads the value
setterName - the name of the method that sets the value

Method Details

fireChange

protected void fireChange(B currentBean)

getValue

public Object getValue()
Returns the value of the adapted bean property, or null if the bean is null.
Specified by:
getValue in interface ValueModel
Returns:
the value of the adapted bean property, null if the bean is null

setBean0

protected void setBean0(B oldBean,
                        B newBean)

setValue

public void setValue(Object newValue)
Sets the given object as new value of the adapted bean property. Does nothing if the bean is null. If the bean setter throws a PropertyVetoException, it is silently ignored. This write operation is supported only for writable bean properties.

Notifies any registered value listener if the bean reports a property change. Note that a bean may suppress PropertyChangeEvents if the old and new value are the same, or if the old and new value are equal.

Specified by:
setValue in interface ValueModel
Parameters:
newValue - the value to set

setVetoableValue

public void setVetoableValue(Object newValue)
            throws PropertyVetoException
Sets the given object as new value of the adapted bean property. Does nothing if the bean is null. If the bean setter throws a PropertyVetoExeption, this method throws the same exception. This write operation is supported only for writable bean properties.

Notifies any registered value listener if the bean reports a property change. Note that a bean may suppress PropertyChangeEvents if the old and new value are the same, or if the old and new value are equal.

Parameters:
newValue - the value to set
Since:
1.1

Copyright © 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.