org.viewaframework.binding.core
Class AbstractBindingListener<T,TV,SV>

java.lang.Object
  extended by org.viewaframework.binding.core.AbstractBindingListener<T,TV,SV>
Type Parameters:
T - Target type
TV - Target property type
SV - Source property type
All Implemented Interfaces:
PropertyChangeListener, EventListener, SynchronizedListener
Direct Known Subclasses:
BeanAdapterPropertyListener, ComboBoxSelectionBindListener, ListBindingModelListener, TextFieldBindingListener

public abstract class AbstractBindingListener<T,TV,SV>
extends Object
implements PropertyChangeListener, SynchronizedListener

This class helps bindings to keep synchronized.

Author:
Mario Garcia

Constructor Summary
AbstractBindingListener(BeanAdapter<T> target, Property<TV> targetProperty, Property<SV> sourceProperty)
          Constructor
 
Method Summary
 Property<SV> getSourceProperty()
          The source property from data is retrieved
 BeanAdapter<T> getTarget()
          The target object this listener is going to populate
 Property<TV> getTargetProperty()
          The target property where data is going to be copied
 void handleProperty(PropertyChangeEvent evt)
          Once we know that source and target are not synchronized and also that the right property is at hand we make the value transfer within this method
 boolean isPropertyToHandle(PropertyChangeEvent evt)
          Whether the property triggered is the one to handle
 boolean isSynchronized(PropertyChangeEvent evt)
           
 void propertyChange(PropertyChangeEvent evt)
           
 void setSourceProperty(Property<SV> sourceProperty)
          The source property from data is retrieved
 void setTarget(BeanAdapter<T> target)
          The target object this listener is going to populate
 void setTargetProperty(Property<TV> targetProperty)
          The target property where data is going to be copied
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.viewaframework.binding.core.SynchronizedListener
getNewValue
 

Constructor Detail

AbstractBindingListener

public AbstractBindingListener(BeanAdapter<T> target,
                               Property<TV> targetProperty,
                               Property<SV> sourceProperty)
Constructor

Parameters:
target - The target object this listener is going to populate
sourceProperty - The source property from data is retrieved
targetProperty - The target property where data is going to be copied
Method Detail

getSourceProperty

public Property<SV> getSourceProperty()
The source property from data is retrieved

Returns:

getTarget

public BeanAdapter<T> getTarget()
The target object this listener is going to populate

Returns:

getTargetProperty

public Property<TV> getTargetProperty()
The target property where data is going to be copied

Returns:

handleProperty

public void handleProperty(PropertyChangeEvent evt)
Once we know that source and target are not synchronized and also that the right property is at hand we make the value transfer within this method

Parameters:
evt - event

isPropertyToHandle

public boolean isPropertyToHandle(PropertyChangeEvent evt)
Whether the property triggered is the one to handle

Parameters:
evt -
Returns:

isSynchronized

public boolean isSynchronized(PropertyChangeEvent evt)
Specified by:
isSynchronized in interface SynchronizedListener
Returns:

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Specified by:
propertyChange in interface PropertyChangeListener

setSourceProperty

public void setSourceProperty(Property<SV> sourceProperty)
The source property from data is retrieved

Parameters:
sourceProperty -

setTarget

public void setTarget(BeanAdapter<T> target)
The target object this listener is going to populate

Parameters:
target -

setTargetProperty

public void setTargetProperty(Property<TV> targetProperty)
The target property where data is going to be copied

Parameters:
targetProperty -


Copyright © 2010. All Rights Reserved.