com.ibm.xsp.complex
Interface ValueBindingObject

All Known Implementing Classes:
AbstractClientSimpleAction, AbstractConfirmAction, AbstractConverter, AbstractDataModel, AbstractDataSource, AbstractDocumentAction, AbstractDocumentConfirmAction, AbstractDocumentDataSource, AbstractIndexAction, AbstractResource, AbstractValidator, AbstractViewDataModel, AbstractViewDataSource, ActionGroup, Attr, BooleanConverter, BundleResource, ChangeDocumentModeAction, ClientEventHandler, ComponentPublishPropertyAction, ComponentPublishViewColumnAction, ConfirmAction, ConstraintValidator, CreateAttachmentAction, CreateResponseAction, DateTimeRangeValidator, DeleteAttachmentsAction, DeleteDocumentAction, DeleteSelectedDocumentsAction, DojoAttribute, DojoModulePathResource, DojoModuleResource, DominoDocumentData, DominoViewData, DoubleRangeValidatorEx2, ExecuteScriptAction, ExecuteScriptClientAction, ExpressionValidator, GenericHeadResource, LengthValidatorEx, LinkResource, LongRangeValidatorEx2, MetaDataResource, MethodBindingEx, ModifyFieldAction, ModulusSelfCheckValidator, NavigationRule, OpenPageAction, Parameter, RequiredValidator, SaveAction, SaveDocumentAction, ScriptGroup, ScriptResource, SendMailAction, SetValueAction, StyleSheetResource, ValidatorMethodBinding, ValueBindingObjectImpl, ViewRootBaseUrl

public interface ValueBindingObject

Please note, the implementation of get methods classes that implement this interface should delegate to the value binding as follows (this is for the "dir" property):

 public String getRowData() {
     if (null != _rowData) {
         return _rowData;
     }
     ValueBinding valueBinding = getValueBinding("rowData");
     if (null != valueBinding) {
         return (String) valueBinding.getValue(getFacesContext());
     }
     return null;
 }
 
The exception is properties that are specifically designed not to have "Compute Dynamically" values (and are configured allow-run-time-bindings>false< in the xsp-config files so that dynamically computed values cause a design-time error). An example is the DataSource.getVar() property, where the var is determined when the XPage is designed.

Initializing the property in the constructor or inline in the Java field declaration is discouraged, as the default value should usually be null, and code using the property value should check for null, both for when the value is not set, and for when the value is computed but the computed expression doesn't return a value.

The template for Java primitive values is different. Since they can't be checked for null, an extra boolean variable is used to track whether the value has been set.

    private int maxlength = Integer.MIN_VALUE;
    private boolean maxlength_set = false;
    public void setMaxlength(int maxlength) {
         this.maxlength = maxlength;
         this.maxlength_set = true;
    }
    public int getMaxlength() {
        if (this.maxlength_set) {
           return this.maxlength;
       }
       ValueBinding _vb = getValueBinding("maxlength"); //$NON-NLS-1$
       if (_vb != null) {
           Object _result = _vb.getValue(getFacesContext());
           if (_result == null) {
               return Integer.MIN_VALUE;
           } else {
               return ((Integer) _result).intValue();
           }
       } else {
           return this.maxlength;
       }
   }
           int maxlength = tcomponent.getMaxlength();
           if(maxlength>=0) {
               writer.writeAttribute("maxlength", maxlength, "maxlength"); // $NON-NLS-1$ $NON-NLS-2$
           }
 


Method Summary
 javax.faces.el.ValueBinding getValueBinding(java.lang.String property)
          Return the ValueBinding instance to used to calculate the value for the specified property.
 void setValueBinding(java.lang.String property, javax.faces.el.ValueBinding binding)
          Set the ValueBinding instance to used to calculate the value for the specified property.
 

Method Detail

getValueBinding

javax.faces.el.ValueBinding getValueBinding(java.lang.String property)
Return the ValueBinding instance to used to calculate the value for the specified property.

Parameters:
property - Name of the property
Returns:
ValueBinding instance to used to calculate the value for the specified property

setValueBinding

void setValueBinding(java.lang.String property,
                     javax.faces.el.ValueBinding binding)
Set the ValueBinding instance to used to calculate the value for the specified property.

Parameters:
property - Name of the property
binding - The ValueBinding to set, or null to remove an existing ValueBinding