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

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.binding.Bindings
All Implemented Interfaces:
Observable
Direct Known Subclasses:
FormBinding

public class Bindings
extends BaseObservable

Aggregates one to many field bindings.

Events:
BeforeBind : BindingEvent(source, model)
Fires before binding.
  • source : this
  • model : the model to bind
Bind : BindingEvent(source, model)
Fires after successful binding.
  • source : this
  • model : the binded model
UnBind : BindingEvent(source, model)
Fires after successful unbinding.
  • source : this
  • model : the unbound model

See Also:
FieldBinding

Field Summary
protected  java.util.Map<java.lang.String,FieldBinding> bindings
           
protected  ModelData model
           
 
Constructor Summary
Bindings()
          Creates a new bindings instance.
 
Method Summary
 void addFieldBinding(FieldBinding binding)
          Adds a field binding.
 void bind(ModelData model)
          Binds the model instance.
 void clear()
          Clears all fields by setting the value for each field to null.
 FieldBinding getBinding(Field<?> field)
          Returns the field binding for the given field.
 java.util.Collection<FieldBinding> getBindings()
          Returns all bindings.
 ModelData getModel()
          Returns the currently bound model;
 void removeFieldBinding(FieldBinding binding)
          Removes a field binding.
 void unbind()
          Unbinds the current model.
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

model

protected ModelData model

bindings

protected java.util.Map<java.lang.String,FieldBinding> bindings
Constructor Detail

Bindings

public Bindings()
Creates a new bindings instance.

Method Detail

addFieldBinding

public void addFieldBinding(FieldBinding binding)
Adds a field binding.

Parameters:
binding - the binding instance to add

bind

public void bind(ModelData model)
Binds the model instance.

Parameters:
model - the model

clear

public void clear()
Clears all fields by setting the value for each field to null.


getBinding

public FieldBinding getBinding(Field<?> field)
Returns the field binding for the given field.

Parameters:
field - the field
Returns:
the field binding or null of no match

getBindings

public java.util.Collection<FieldBinding> getBindings()
Returns all bindings.

Returns:
the collection of bindings

getModel

public ModelData getModel()
Returns the currently bound model;

Returns:
the currently bound model;

removeFieldBinding

public void removeFieldBinding(FieldBinding binding)
Removes a field binding.

Parameters:
binding - the binding instance to remove

unbind

public void unbind()
Unbinds the current model.