org.kuali.rice.krad.uif.component
Class BindingInfo

java.lang.Object
  extended by org.kuali.rice.krad.datadictionary.DictionaryBeanBase
      extended by org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
          extended by org.kuali.rice.krad.uif.component.BindingInfo
All Implemented Interfaces:
Serializable, DictionaryBean, UifDictionaryBean

public class BindingInfo
extends UifDictionaryBeanBase
implements Serializable

Provides binding configuration for an DataBinding component (attribute or collection)

From the binding configuration the binding path is determined (if not manually set) and used to set the path in the UI or to get the value from the model

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Constructor Summary
BindingInfo()
           
 
Method Summary
 void addToBindByNamePrefix(String bindPrefix)
          Helper method for adding a path to the binding prefix
 String getBindByNamePrefix()
          Prefix that will be used to form the binding path from the component name.
 String getBindingName()
          Gives the name of the property that the component binds to.
 String getBindingObjectPath()
          For attribute fields that do not belong to the default form object (given by the view), this field specifies the path to the object (on the form) the attribute does belong to.
 String getBindingPath()
          Path to the property on the model the component binds to.
 String getBindingPrefixForNested()
          Returns the binding prefix string that can be used to setup the binding on DataBinding components that are children of the component that contains the BindingInfo.
 String getCollectionPath()
          If field is part of a collection field, gives path to collection
 String getPropertyAdjustedBindingPath(String propertyPath)
          Returns the binding path that is formed by taking the binding configuration of this BindingInfo instance with the given property path as the binding name.
 boolean isBindToForm()
          Indicates whether the component binds directly to the form (that is its bindingName gives a property available through the form), or whether is binds through a nested form object.
 boolean isBindToMap()
          Indicates whether the parent object for the property that we are binding to is a Map.
 void setBindByNamePrefix(String bindByNamePrefix)
          Setter for the prefix to use for forming the binding path by name
 void setBindingName(String bindingName)
          Setter for the bind property name
 void setBindingObjectPath(String bindingObjectPath)
          Setter for the object path on the form
 void setBindingPath(String bindingPath)
          Setter for the binding path.
 void setBindToForm(boolean bindToForm)
          Setter for the bind to form indicator
 void setBindToMap(boolean bindToMap)
          Setter for the bind to map indicator
 void setCollectionPath(String collectionPath)
          Setter for the field's collection path (if part of a collection)
 void setDefaults(View view, String propertyName)
          Sets up some default binding properties based on the view configuration and the component's property name
 
Methods inherited from class org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase
getExpressionGraph, getPropertyExpression, getPropertyExpressions, getRefreshExpressionGraph, setExpressionGraph, setPropertyExpressions, setRefreshExpressionGraph
 
Methods inherited from class org.kuali.rice.krad.datadictionary.DictionaryBeanBase
getComponentCode, getNamespaceCode, setComponentCode, setNamespaceCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.kuali.rice.krad.datadictionary.DictionaryBean
getComponentCode, getNamespaceCode
 

Constructor Detail

BindingInfo

public BindingInfo()
Method Detail

setDefaults

public void setDefaults(View view,
                        String propertyName)
Sets up some default binding properties based on the view configuration and the component's property name

Sets the bindingName (if not set) to the given property name, and if the binding object path has not been set uses the default binding object path setup for the view

Parameters:
view - - the view instance the component belongs to
propertyName - - name of the property (relative to the parent object) the component binds to

getBindingPath

public String getBindingPath()
Path to the property on the model the component binds to. Uses standard dot notation for nested properties. If the binding path was manually set it will be returned as it is, otherwise the path will be formed by using the binding object path and the bind prefix

e.g. Property name 'foo' on a model would have binding path "foo", while property name 'name' of the nested model property 'account' would have binding path "account.name"

Returns:
String binding path

getBindingPrefixForNested

public String getBindingPrefixForNested()
Returns the binding prefix string that can be used to setup the binding on DataBinding components that are children of the component that contains the BindingInfo. The binding prefix is formed like the binding path but without including the object path

Returns:
String binding prefix for nested components

getPropertyAdjustedBindingPath

public String getPropertyAdjustedBindingPath(String propertyPath)
Returns the binding path that is formed by taking the binding configuration of this BindingInfo instance with the given property path as the binding name. This can be used to get the binding path when just a property name is given that is assumed to be on the same parent object of the field with the configured binding info

Special check is done for org.kuali.rice.krad.uif.UifConstants#NO_BIND_ADJUST_PREFIX prefix on the property name which indicates the property path is the full path and should not be adjusted. Also, if the property is prefixed with org.kuali.rice.krad.uif.UifConstants#FIELD_PATH_BIND_ADJUST_PREFIX, this indicates we should only append the binding object path

Parameters:
propertyPath - - path for property to return full binding path for
Returns:
String full binding path

addToBindByNamePrefix

public void addToBindByNamePrefix(String bindPrefix)
Helper method for adding a path to the binding prefix

Parameters:
bindPrefix - - path to add

setBindingPath

public void setBindingPath(String bindingPath)
Setter for the binding path. Can be left blank in which the path will be determined from the binding configuration

Parameters:
bindingPath -

isBindToForm

public boolean isBindToForm()
Indicates whether the component binds directly to the form (that is its bindingName gives a property available through the form), or whether is binds through a nested form object. If bindToForm is false, it is assumed the component binds to the object given by the form property whose path is configured by bindingObjectPath.

Returns:
boolean true if component binds directly to form, false if it binds to a nested object

setBindToForm

public void setBindToForm(boolean bindToForm)
Setter for the bind to form indicator

Parameters:
bindToForm -

getBindingName

public String getBindingName()
Gives the name of the property that the component binds to. The name can be nested but not the full path, just from the parent object or in the case of binding directly to the form from the form object

If blank this will be set from the name field of the component

Returns:
String name of the bind property

setBindingName

public void setBindingName(String bindingName)
Setter for the bind property name

Parameters:
bindingName -

getBindByNamePrefix

public String getBindByNamePrefix()
Prefix that will be used to form the binding path from the component name. Typically used for nested collection properties

Returns:
String binding prefix

setBindByNamePrefix

public void setBindByNamePrefix(String bindByNamePrefix)
Setter for the prefix to use for forming the binding path by name

Parameters:
bindByNamePrefix -

getCollectionPath

public String getCollectionPath()
If field is part of a collection field, gives path to collection

This is used for metadata purposes when getting finding the attribute definition from the dictionary and is not used in building the final binding path

Returns:
String path to collection

setCollectionPath

public void setCollectionPath(String collectionPath)
Setter for the field's collection path (if part of a collection)

Parameters:
collectionPath -

getBindingObjectPath

public String getBindingObjectPath()
For attribute fields that do not belong to the default form object (given by the view), this field specifies the path to the object (on the form) the attribute does belong to.

e.g. Say we have an attribute field with property name 'number', that belongs to the object given by the 'account' property on the form. The form object path would therefore be set to 'account'. If the property belonged to the object given by the 'document.header' property of the form, the binding object path would be set to 'document.header'. Note if the binding object path is not set for an attribute field (or any DataBinding component), the binding object path configured on the View will be used (unless bindToForm is set to true, where is assumed the property is directly available from the form).

Returns:
String path to object from form

setBindingObjectPath

public void setBindingObjectPath(String bindingObjectPath)
Setter for the object path on the form

Parameters:
bindingObjectPath -

isBindToMap

public boolean isBindToMap()
Indicates whether the parent object for the property that we are binding to is a Map. If true the binding path will be adjusted to use the map key syntax

Returns:
boolean true if the property binds to a map, false if it does not

setBindToMap

public void setBindToMap(boolean bindToMap)
Setter for the bind to map indicator

Parameters:
bindToMap -


Copyright © 2005-2012 The Kuali Foundation. All Rights Reserved.