net.sf.doolin.gui.field
Class AbstractPropertyFieldDescriptor<V>

java.lang.Object
  extended by net.sf.doolin.bus.bean.Bean
      extended by net.sf.doolin.gui.field.AbstractFieldDescriptor<V>
          extended by net.sf.doolin.gui.field.AbstractPropertyFieldDescriptor<V>
Type Parameters:
V - Type of object for the view
All Implemented Interfaces:
Serializable, IBean, FieldDescriptor<V>
Direct Known Subclasses:
AbstractFieldText, AbstractListPropertyFieldDescriptor, FieldCheck, FieldColor, FieldDecimal, FieldFile, FieldFont, FieldInteger, FieldLabelInfo, FieldLong, FieldPassword, FieldRadio, FieldTemplate, FieldToggle, FieldTree

public abstract class AbstractPropertyFieldDescriptor<V>
extends AbstractFieldDescriptor<V>

Abstract field descriptor for fields based on a property.

Author:
Damien Coraboeuf
See Also:
Serialized Form

Constructor Summary
AbstractPropertyFieldDescriptor()
           
 
Method Summary
 Adapter<Object,Object> getAdapter()
          Returns the adapter used between the model and the field
protected  Object getProperty(GUIView<V> view)
          Gets the field property from the view.
 String getPropertyPath()
          Gets the property path.
 void setAdapter(Adapter<Object,Object> adapter)
          Sets the adapter used between the model and the field
protected  void setProperty(GUIView<V> view, Object value)
          Updates the view model according to the property set by this field.
 void setPropertyPath(String propertyPath)
          Path to the property linked to the field
protected  void subscribe(GUIView<V> view, Object target, String targetProperty)
          Updates a target property each time the field property is updated.
protected  void subscribe(GUIView<V> view, Runnable runnable)
          Runs a task each time the field property is updated.
 
Methods inherited from class net.sf.doolin.gui.field.AbstractFieldDescriptor
getActionFactory, getConstraint, getDisplayStateHandler, getIconService, getName, getStyle, getTransferHandler, onInit, onShow, setActionFactory, setConstraint, setDisplayState, setDisplayStateHandler, setIconService, setName, setStyle, setTransferHandler
 
Methods inherited from class net.sf.doolin.bus.bean.Bean
getBeanNotificationSupport, getParentBean, notify, setParentBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.doolin.gui.field.FieldDescriptor
createField
 

Constructor Detail

AbstractPropertyFieldDescriptor

public AbstractPropertyFieldDescriptor()
Method Detail

getPropertyPath

public String getPropertyPath()
Gets the property path.

Returns:
the property path

setPropertyPath

public void setPropertyPath(String propertyPath)
Path to the property linked to the field

Parameters:
propertyPath - the new property path

getAdapter

public Adapter<Object,Object> getAdapter()
Returns the adapter used between the model and the field

Returns:
Adapter

setAdapter

public void setAdapter(Adapter<Object,Object> adapter)
Sets the adapter used between the model and the field

Parameters:
adapter - Adapter

setProperty

protected void setProperty(GUIView<V> view,
                           Object value)
Updates the view model according to the property set by this field. Any defined adapter is used before setting the property.

Parameters:
view - Hosting view
value - New value for the property.
See Also:
GUIView.getViewData()

subscribe

protected void subscribe(GUIView<V> view,
                         Object target,
                         String targetProperty)
Updates a target property each time the field property is updated.

Parameters:
view - Hosting view
target - Target bean
targetProperty - Path to the target property

subscribe

protected void subscribe(GUIView<V> view,
                         Runnable runnable)
Runs a task each time the field property is updated.

Parameters:
view - Hosting view
runnable - Task to run each time the field property is updated

getProperty

protected Object getProperty(GUIView<V> view)
Gets the field property from the view.

Parameters:
view - Hosting view
Returns:
Field property


Copyright © 2011. All Rights Reserved.