com.extjs.gxt.ui.client.binding
Class FieldBinding

java.lang.Object
  extended by com.extjs.gxt.ui.client.binding.FieldBinding
Direct Known Subclasses:
SimpleComboBoxFieldBinding, TimeFieldBinding

public class FieldBinding
extends java.lang.Object

A two-way binding between a ModelData and Field instance. The binding will be 1-way when the bound model does not support change events.

See Also:
ModelData, Field

Constructor Summary
FieldBinding(Field field, java.lang.String property)
          Creates a new binding instance.
 
Method Summary
 void bind(ModelData model)
          Binds the model and field.
 Converter getConvertor()
          Returns the bindings converter.
 Field<java.lang.Object> getField()
          Returns the bound field.
 ModelData getModel()
          Returns the bound model instance.
 java.lang.String getProperty()
          Returns the model's bound property name.
 Store getStore()
          Returns the binding's store.
 void setConvertor(Converter convertor)
          Sets the converter which is used to translate data types when updating either the field or model.
 void setStore(Store<? extends ModelData> store)
          Sets the store for the binding.
 void unbind()
          Unbinds the model and field by removing all listeners.
 void updateField()
          Updates the field's value with the model value.
 void updateModel()
          Updates the model's value with the field value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldBinding

public FieldBinding(Field field,
                    java.lang.String property)
Creates a new binding instance.

Parameters:
field - the bound field for the binding
Method Detail

bind

public void bind(ModelData model)
Binds the model and field.

Parameters:
model - the model to be bound

getConvertor

public Converter getConvertor()
Returns the bindings converter.

Returns:
the converter

getField

public Field<java.lang.Object> getField()
Returns the bound field.

Returns:
the field

getModel

public ModelData getModel()
Returns the bound model instance.

Returns:
the model

getProperty

public java.lang.String getProperty()
Returns the model's bound property name.

Returns:
the property name

getStore

public Store getStore()
Returns the binding's store.

Returns:
the store or null

setConvertor

public void setConvertor(Converter convertor)
Sets the converter which is used to translate data types when updating either the field or model.

Parameters:
convertor - the converter

setStore

public void setStore(Store<? extends ModelData> store)
Sets the store for the binding. When a store is specified edits are done via Records instances obtained from the Store.

Parameters:
store - the store

unbind

public void unbind()
Unbinds the model and field by removing all listeners.


updateField

public void updateField()
Updates the field's value with the model value.


updateModel

public void updateModel()
Updates the model's value with the field value.