net.sf.echobinding.binding
Class OgnlBindingContext

java.lang.Object
  extended by net.sf.echobinding.binding.AbstractBindingContext
      extended by net.sf.echobinding.binding.OgnlBindingContext
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, BindingContext

public class OgnlBindingContext
extends AbstractBindingContext

See Also:
Serialized Form

Field Summary
static java.lang.String OGNL_NAMESPACE_PMOD
          The OGNL namespace/prefix used to access the presentation model.
 
Fields inherited from class net.sf.echobinding.binding.AbstractBindingContext
_adapters, _changes
 
Constructor Summary
OgnlBindingContext()
          Creates a new OgnlBindingContext.
OgnlBindingContext(java.lang.Object bean)
          Creates a new OgnlBindingContext.
 
Method Summary
 BindingContext add(java.lang.String id, PropertyAdapter adapter)
          Adds a property adapter to the context.
 OgnlBindingContext addModel(java.lang.String contextName, java.lang.Object bean)
          Adds a bean to the OgnlContext.
 BindingContext createChild()
          Creates a new BindingContext instance and adds it as a child to this context.
 OgnlPropertyAdapter getAdapter(java.lang.String id)
          Returns the PropertyAdapter for the given id.
 java.util.HashMap<java.lang.String,java.lang.Object> getContextMap()
          Returns the context map.
 java.lang.Object getModel()
          Returns the model.
protected  ognl.OgnlContext getOgnlContext()
           
 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(java.lang.String id, java.lang.Object value)
          Checks if the given value equals the value in the bean.
 void setContextMap(java.util.HashMap<java.lang.String,java.lang.Object> contextMap)
          Sets the context map.
 OgnlBindingContext setModel(java.lang.Object bean)
          Sets the model to be used.
 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.
 ValidationReport validate(java.lang.String id, java.lang.Object value)
          Checks if the value is valid for the specified adapter.
 
Methods inherited from class net.sf.echobinding.binding.AbstractBindingContext
addChild, addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, firePropertyChange, getChilds, getControl, getControls, getDecorator, getFormat, getParent, getPresentationModel, getPropertyAdapters, isDirty, isValid, propertyChange, registerControl, remove, removeChild, removeControl, removePropertyChangeListener, removePropertyChangeListener, setChilds, setParent, synchronize, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OGNL_NAMESPACE_PMOD

public static final java.lang.String OGNL_NAMESPACE_PMOD
The OGNL namespace/prefix used to access the presentation model.

See Also:
Constant Field Values
Constructor Detail

OgnlBindingContext

public OgnlBindingContext(java.lang.Object bean)
Creates a new OgnlBindingContext.

Parameters:
bean - The bean

OgnlBindingContext

public OgnlBindingContext()
Creates a new OgnlBindingContext.

Method Detail

add

public BindingContext add(java.lang.String id,
                          PropertyAdapter adapter)
Description copied from interface: BindingContext
Adds a property adapter to the context.

Specified by:
add in interface BindingContext
Overrides:
add in class AbstractBindingContext
Parameters:
id - the adapter id
adapter - the adapter
Returns:
this

getValue

public java.lang.Object getValue(java.lang.String id)
                          throws BindingException
Description copied from interface: BindingContext
Returns the value for the specified adapter.

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

setValue

public void setValue(java.lang.String id,
                     java.lang.Object value)
              throws BindingException
Description copied from interface: BindingContext
Sets the value for the specific adapter.

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

validate

public ValidationReport validate(java.lang.String id,
                                 java.lang.Object value)
Description copied from interface: BindingContext
Checks if the value is valid for the specified adapter.

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

getModel

public java.lang.Object getModel()
Description copied from interface: BindingContext
Returns the model.

Returns:
Returns the model.

setModel

public OgnlBindingContext setModel(java.lang.Object bean)
Description copied from interface: BindingContext
Sets the model to be used.

Parameters:
bean - the bean
Returns:
the binding context

setPresentationModel

public void setPresentationModel(PresentationModel presentationModel)
Description copied from interface: BindingContext
Sets the presentation model.

Specified by:
setPresentationModel in interface BindingContext
Overrides:
setPresentationModel in class AbstractBindingContext
Parameters:
presentationModel - The presentationModel to set.

addModel

public OgnlBindingContext addModel(java.lang.String contextName,
                                   java.lang.Object bean)
Adds a bean to the OgnlContext. Additional beans can be referenced with "#contextName.property" in an OGNL expression.

Parameters:
contextName -
bean -
Returns:

createChild

public BindingContext createChild()
Description copied from interface: BindingContext
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

getContextMap

public java.util.HashMap<java.lang.String,java.lang.Object> getContextMap()
Returns the context map.

Returns:

getOgnlContext

protected ognl.OgnlContext getOgnlContext()

setContextMap

public void setContextMap(java.util.HashMap<java.lang.String,java.lang.Object> contextMap)
Sets the context map. The context map is a list of additional source objects which are used for binding.

Parameters:
contextMap -

getValidationHandler

public ValidationHandler getValidationHandler(java.lang.String id)
Description copied from interface: BindingContext
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

setValidationHandler

public BindingContext setValidationHandler(ValidationHandler handler)
Description copied from interface: BindingContext
Sets the ValidationHandler for this context.

Parameters:
handler - the handler
Returns:
the binding context

getValidationHandler

public ValidationHandler getValidationHandler()
Description copied from interface: BindingContext
Returns the ValidationHandler for this context.

Returns:
the ValidationHandler

isDirty

public boolean isDirty(java.lang.String id,
                       java.lang.Object value)
                throws BindingException
Description copied from interface: BindingContext
Checks if the given value equals the value in the bean.

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

getAdapter

public OgnlPropertyAdapter getAdapter(java.lang.String id)
Returns the PropertyAdapter for the given id. If no adapter for this id exists, a new adapter will be lazely generated using the id as binding expression. The newly generated adapter will added to he list of adapters.

Parameters:
id -
Returns:


Copyright © 2007. All Rights Reserved.