net.sf.echobinding.binding
Interface BindingContext

All Superinterfaces:
java.util.EventListener, java.beans.PropertyChangeListener
All Known Implementing Classes:
AbstractBindingContext, OgnlBindingContext

public interface BindingContext
extends java.beans.PropertyChangeListener

The BindingContext interface.


Method Summary
 BindingContext add(java.lang.String adapterId, PropertyAdapter adapter)
          Adds a property adapter to the context.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list for a specific property.
 BindingContext createChild()
          Creates a new BindingContext instance and adds it as a child to this context.
 PropertyAdapter getAdapter(java.lang.String adapterId)
          Returns the property adapter for the given adapter id.
 java.util.Set<BindingContext> getChilds()
          Returns the child binding contexts.
 BoundControl getControl(java.lang.String id)
          Returns the bound control that belongs to the adapter id.
 java.util.Set<BoundControl> getControls()
          Returns all registered controls.
 Decorator getDecorator(java.lang.String id)
          Returns the decorator for the specified binding id.
 Format getFormat(java.lang.String id)
          Returns the format for the specified adapter.
 java.lang.Object getModel()
          Returns the model.
 BindingContext getParent()
          Returns the parent binding context.
 PresentationModel getPresentationModel()
          Returns the pesentation model.
 java.util.List<PropertyAdapter> getPropertyAdapters()
          Returns all property adapters for this context.
 ValidationHandler getValidationHandler()
          Returns the ValidationHandler for this context.
 ValidationHandler getValidationHandler(java.lang.String id)
          Returns the ValidationHandler for a specific binding.
 java.lang.Object getValue(java.lang.String id)
          Returns the value for the specified adapter.
 boolean isDirty()
          Checks if the state of any controls in this context an its sub contexts is different from the state in the model.
 boolean isDirty(java.lang.String id, java.lang.Object value)
          Checks if the given value equals the value in the bean.
 boolean isValid()
          Checks if all controls in this context and the controls in its sub contexts contain valid inputs.
 void registerControl(java.lang.String id, BoundControl control)
          Registers a bound control at the context.
 PropertyAdapter remove(java.lang.String adapterId)
          Removes a binding from the context.
 boolean removeChild(BindingContext context)
          Removes a child context from this context.
 void removeControl(BoundControl control)
          Renoves a bound control from the context.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 BindingContext setModel(java.lang.Object bean)
          Sets the model to be used.
 void setParent(BindingContext context)
          Sets the parent binding context.
 void setPresentationModel(PresentationModel presentationModel)
          Sets the presentation model.
 BindingContext setValidationHandler(ValidationHandler handler)
          Sets the ValidationHandler for this context.
 void setValue(java.lang.String id, java.lang.Object value)
          Sets the value for the specific adapter.
 void synchronize()
          Synchronizes the GUI/screen state with the application state.
 void update()
          Resets the GUI/screen state.
 void validate()
          Validates this context and all its sub contexts.
 ValidationReport validate(java.lang.String id, java.lang.Object value)
          Checks if the value is valid for the specified adapter.
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 

Method Detail

add

BindingContext add(java.lang.String adapterId,
                   PropertyAdapter adapter)
Adds a property adapter to the context.

Parameters:
adapterId - the adapter id
adapter - the adapter
Returns:
this

remove

PropertyAdapter remove(java.lang.String adapterId)
Removes a binding from the context.

Parameters:
adapterId - The adapter id
Returns:
the removed property adapter

getPropertyAdapters

java.util.List<PropertyAdapter> getPropertyAdapters()
Returns all property adapters for this context.

Returns:
List of all adapters

getAdapter

PropertyAdapter getAdapter(java.lang.String adapterId)
Returns the property adapter for the given adapter id.

Parameters:
adapterId - The adapter id
Returns:
the property adapter

getValue

java.lang.Object getValue(java.lang.String id)
                          throws BindingException
Returns the value for the specified adapter.

Parameters:
id - the id
Returns:
the value
Throws:
BindingException - the binding exception

setValue

void setValue(java.lang.String id,
              java.lang.Object value)
              throws BindingException
Sets the value for the specific adapter.

Parameters:
value - the value
id - the id
Throws:
BindingException - the binding exception

validate

ValidationReport validate(java.lang.String id,
                          java.lang.Object value)
Checks if the value is valid for the specified adapter.

Parameters:
value - the value
id - the id
Returns:
the validation report

getFormat

Format getFormat(java.lang.String id)
Returns the format for the specified adapter.

Parameters:
id - the id
Returns:
the format

setValidationHandler

BindingContext setValidationHandler(ValidationHandler handler)
Sets the ValidationHandler for this context.

Parameters:
handler - the handler
Returns:
the binding context

getValidationHandler

ValidationHandler getValidationHandler()
Returns the ValidationHandler for this context.

Returns:
the ValidationHandler

getValidationHandler

ValidationHandler getValidationHandler(java.lang.String id)
Returns the ValidationHandler for a specific binding. If no ValidationHandler exists for the binding, the ValidationHandler of the context should be returned.

Parameters:
id - the id
Returns:
the validation handler

addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties. The same listener object may be added more than once, and will be called as many times as it is added. If listener is null, no exception is thrown and no action is taken.

Parameters:
listener- - The PropertyChangeListener to be added
listener - the listener

addPropertyChangeListener

void addPropertyChangeListener(java.lang.String propertyName,
                               java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list for a specific property. The same listener object may be added more than once, and will be called as many times as it is added. If listener is null, no exception is thrown and no action is taken.

Parameters:
listener- - The PropertyChangeListener to be added
propertyName - the property name
listener - the listener

removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. If listener was added more than once to the same event source, it will be notified one less time after being removed. If listener is null, or was never added, no exception is thrown and no action is taken.

Parameters:
listener - - The PropertyChangeListener to be removed

getModel

java.lang.Object getModel()
Returns the model.

Returns:
Returns the model.

setModel

BindingContext setModel(java.lang.Object bean)
Sets the model to be used.

Parameters:
rootObject - The root object to set.
bean - the bean
Returns:
the binding context

createChild

BindingContext createChild()
Creates a new BindingContext instance and adds it as a child to this context. The child context inherits all bindings of the parent/this context.

Returns:
a new BindingContext instance with all bindings of this instance

removeChild

boolean removeChild(BindingContext context)
Removes a child context from this context.

Parameters:
context - the context
Returns:
true, if remove child

getDecorator

Decorator getDecorator(java.lang.String id)
Returns the decorator for the specified binding id.

Parameters:
id - the id
Returns:
the decorator of the binding

isDirty

boolean isDirty(java.lang.String id,
                java.lang.Object value)
                throws BindingException
Checks if the given value equals the value in the bean.

Parameters:
value - the value
id - the id
Returns:
true, if is dirty
Throws:
BindingException - the binding exception

registerControl

void registerControl(java.lang.String id,
                     BoundControl control)
Registers a bound control at the context. Each bound control registeres itself with the id of its adapter at the binding context.

Parameters:
control - the control
id - the adapter id

removeControl

void removeControl(BoundControl control)
Renoves a bound control from the context.

Parameters:
control - the control
id - the adapter id

getControl

BoundControl getControl(java.lang.String id)
Returns the bound control that belongs to the adapter id.

Parameters:
id - The adapter id
Returns:
The bound control

getControls

java.util.Set<BoundControl> getControls()
Returns all registered controls.

Returns:
the controls

setPresentationModel

void setPresentationModel(PresentationModel presentationModel)
Sets the presentation model.

Parameters:
presentationModel - the presentation model

getPresentationModel

PresentationModel getPresentationModel()
Returns the pesentation model.

Returns:
the presentation model

setParent

void setParent(BindingContext context)
Sets the parent binding context.

Parameters:
context - The parent context

getParent

BindingContext getParent()
Returns the parent binding context.

Returns:
the parent

getChilds

java.util.Set<BindingContext> getChilds()
Returns the child binding contexts.

Returns:
the childs

validate

void validate()
Validates this context and all its sub contexts. Invokes validateInput() on each attached control to show validation errors to the user.


isValid

boolean isValid()
Checks if all controls in this context and the controls in its sub contexts contain valid inputs.

Returns:
true if all controls are valid, otherwise false

isDirty

boolean isDirty()
Checks if the state of any controls in this context an its sub contexts is different from the state in the model.

Returns:
true if any controls is dirty, false otherwise

synchronize

void synchronize()
Synchronizes the GUI/screen state with the application state. Transfers the state of every widget attached to this context to the model.


update

void update()
Resets the GUI/screen state. Overwrites the widget's state with the state in the model.



Copyright © 2007. All Rights Reserved.