Changeset 14031

Show
Ignore:
Timestamp:
03/16/07 16:28:17 (1 year ago)
Author:
atchertchian
Message:

Add possibility to use a method expression as value of standard html jsf components.

Solves:
NXP-783: nxweb jsf components should be able to set a method as value binding
NXP-545: method result tag does not resolve variables properly

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/binding/MetaMethodBinding.java

    r10869 r14031  
    2121import javax.faces.context.FacesContext; 
    2222import javax.faces.el.MethodBinding; 
    23 import javax.faces.webapp.UIComponentTag; 
    2423 
    2524import org.apache.commons.logging.Log; 
    2625import org.apache.commons.logging.LogFactory; 
     26import org.nuxeo.ecm.platform.ui.web.util.ComponentTagUtils; 
    2727 
    2828/** 
     
    7474                MethodBinding newMeth; 
    7575                String expression = (String) res; 
    76                 if (UIComponentTag.isValueReference(expression)) { 
     76                if (ComponentTagUtils.isValueReference(expression)) { 
    7777                    Application app = context.getApplication(); 
    7878                    newMeth = app.createMethodBinding(expression, null); 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/MetaActionSourceRule.java

    r13022 r14031  
    3030 
    3131/** 
    32  * Meta rule set that wires a method binding to a {@link MetaMethodBinding} 
    33  * when invoking the method. 
     32 * Meta rule set that wires a method binding to a {@link MetaMethodBinding} when 
     33 * invoking the method. 
    3434 * 
    3535 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 
     
    5353        public void applyMetadata(FaceletContext ctx, Object instance) { 
    5454            ActionSource as = (ActionSource) instance; 
    55             // XXX AT: cannot use app.createMethodBinding as JBoss wil return a 
    56             // org.jboss.seam.actionparam.ActionParamMethodBinding which is not 
    57             // Serialiazable... 
    58             MethodBinding originalBinding = new LegacyMethodBinding(this.attr 
    59                     .getMethodExpression(ctx, String.class, ACTION_SIG)); 
    60             // Application app = ctx.getFacesContext().getApplication(); 
    61             // MethodBinding originalBinding = app.createMethodBinding(attr 
    62             // .getValue(), null); 
     55            MethodBinding originalBinding = new LegacyMethodBinding( 
     56                    this.attr.getMethodExpression(ctx, String.class, ACTION_SIG)); 
    6357            as.setAction(new MetaMethodBinding(originalBinding)); 
    6458        } 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/MethodResultTagHandler.java

    r13022 r14031  
    2323import javax.faces.component.UIComponent; 
    2424 
     25import org.nuxeo.ecm.platform.ui.web.binding.MethodValueExpression; 
     26 
    2527import com.sun.facelets.FaceletContext; 
    2628import com.sun.facelets.FaceletException; 
     29import com.sun.facelets.el.LegacyValueBinding; 
    2730import com.sun.facelets.tag.MetaTagHandler; 
    2831import com.sun.facelets.tag.TagAttribute; 
     
    6467        MethodExpression meth = value.getMethodExpression(ctx, Object.class, 
    6568                paramTypesClasses); 
    66         // XXX AT: may throw "attempt to redirect during render response 
    67         // phase..." 
    68         Object result = meth.invoke(ctx, paramTypesClasses); 
    69         ValueExpression ve = ctx.getExpressionFactory().createValueExpression( 
    70                 result, Object.class); 
     69        ValueExpression ve = new MethodValueExpression(meth, paramTypesClasses); 
    7170        ctx.getVariableMapper().setVariable(nameStr, ve); 
    7271        this.nextHandler.apply(ctx, parent); 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/jsf/html/HtmlLibrary.java

    r13022 r14031  
    2020package org.nuxeo.ecm.platform.ui.web.tag.jsf.html; 
    2121 
     22import org.nuxeo.ecm.platform.ui.web.tag.handler.GenericHtmlComponentHandler; 
    2223import org.nuxeo.ecm.platform.ui.web.tag.handler.MetaActionSourceTagHandler; 
    2324 
     
    114115    } 
    115116 
     117    @Override 
     118    public void addHtmlComponent(String name, String componentType, 
     119            String rendererType) { 
     120        super.addComponent(name, componentType, rendererType, 
     121                GenericHtmlComponentHandler.class); 
     122    } 
     123 
    116124}