Package com.sun.faces.facelets

Examples of com.sun.faces.facelets.FaceletContextImplBase


     * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
     *      javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
            throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
        VariableMapper orig = ctx.getVariableMapper();
        if (this.params != null) {
            VariableMapper vm = new VariableMapperWrapper(orig);
            ctx.setVariableMapper(vm);
            for (int i = 0; i < this.params.length; i++) {
                this.params[i].apply(ctx, parent);
            }
        }

        ctx.pushClient(this);
        String path = null;
        try {
            path = this.template.getValue(ctx);
            if (path.trim().length() == 0) {
                throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
            }
            ctx.includeFacelet(parent, path);
        } catch (IOException e) {
            if (log.isLoggable(Level.FINE)) {
                log.log(Level.FINE, e.toString(), e);
            }
            throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
        } finally {
            ctx.setVariableMapper(orig);
            ctx.popClient(this);
        }
    }
View Full Code Here


     * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
     *      javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
            throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;

        if (this.template != null) {

            FacesContext facesContext = ctx.getFacesContext();
            Integer compositionCount = (Integer) facesContext.getAttributes().get("com.sun.faces.uiCompositionCount");
            if (compositionCount == null) {
                compositionCount = 1;
            } else {
                compositionCount++;
            }
            facesContext.getAttributes().put("com.sun.faces.uiCompositionCount", compositionCount);
           
            VariableMapper orig = ctx.getVariableMapper();
            if (this.params != null) {
                VariableMapper vm = new VariableMapperWrapper(orig);
                ctx.setVariableMapper(vm);
                for (int i = 0; i < this.params.length; i++) {
                    this.params[i].apply(ctx, parent);
                }
            }

            ctx.extendClient(this);
            String path = null;
            try {
                path = this.template.getValue(ctx);
                if (path.trim().length() == 0) {
                    throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
                }
                ctx.includeFacelet(parent, path);
            } catch (IOException e) {
                if (log.isLoggable(Level.FINE)) {
                    log.log(Level.FINE, e.toString(), e);
                }
                throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
            } finally {
                ctx.popClient(this);
                ctx.setVariableMapper(orig);
               
                compositionCount = (Integer) facesContext.getAttributes().get("com.sun.faces.uiCompositionCount");
                compositionCount--;
               
                if (compositionCount == 0) {
View Full Code Here

     * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
     *      javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
            throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
       
        ctx.extendClient(this);
        boolean found = false;
        try {
            found = ctx.includeDefinition(parent, this.name);
        } finally {
            ctx.popClient(this);
        }
        if (!found) {
            this.nextHandler.apply(ctx, parent);
        }
    }
View Full Code Here

   */
  @Override
  public void apply(FaceletContext faceletCtx, UIComponent parent) throws IOException, FacesException, ELException {
    hookAboutToApply(faceletCtx, parent);

    FaceletContextImplBase ctx = (FaceletContextImplBase) faceletCtx;
    VariableMapper orig = ctx.getVariableMapper();
    if (this.params != null || this.vars.length > 0) {
      VariableMapper varMapper = new VariableMapperWrapper(orig);
      ctx.setVariableMapper(varMapper);
      if (this.params != null) {
        for (ParamHandler param : this.params) {
          param.apply(ctx, parent);
        }
      }
      // setup a variable map
      if (this.vars.length > 0) {
        for (TagAttribute var : this.vars) {
          varMapper.setVariable(var.getLocalName(),
            var.getValueExpression(ctx, Object.class));
        }
      }
    }

    ctx.pushClient(this);
    try {
      // hook
      InputStream is = hookInputStreamToApply();

      initialize();

      // this unfortunately does not work
      // DefaultFaceletCache cache = new DefaultFaceletCache(afCacheTime);
      LiteFaceletFactory factory = new LiteFaceletFactory(originalCompiler, new DefaultResourceResolver(), afCacheTime, originalCache);
      // force the originalIdMappers
      setIdMappers(factory, originalIdMappers);

      Facelet facelet = factory.getFacelet(is, getAlias());
      // this unfortunately does not work
      Method m = getIncludeMethod(facelet);
      m.invoke(facelet, ctx, parent);

      hookApplyOver(faceletCtx, parent);
    } catch (Exception e) {
      throw new FaceletException(e);
    } finally {
      ctx.setVariableMapper(orig);
      ctx.popClient(this);
    }
  }
View Full Code Here

     * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
     *      javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
            throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
       
        ctx.extendClient(this);
        boolean found = false;
        try {
            found = ctx.includeDefinition(parent, this.name);
        } finally {
            ctx.popClient(this);
        }
        if (!found) {
            this.nextHandler.apply(ctx, parent);
        }
    }
View Full Code Here

     * @see VariableMapper
     * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
    throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
        VariableMapper orig = ctx.getVariableMapper();
       
        // setup a variable map
        if (this.vars.length > 0) {
            VariableMapper varMapper = new VariableMapperWrapper(orig);
            for (int i = 0; i < this.vars.length; i++) {
                varMapper.setVariable(this.vars[i].getLocalName(), this.vars[i]
                        .getValueExpression(ctx, Object.class));
            }
            ctx.setVariableMapper(varMapper);
        }
       
        // eval include
        try {
            ctx.pushClient(this);
            ctx.includeFacelet(parent, this.location);
        } catch (FileNotFoundException e) {
            throw new TagException(this.tag, e.getMessage());
        } finally {
           
            // make sure we undo our changes
            ctx.popClient(this);
            ctx.setVariableMapper(orig);
        }
    }
View Full Code Here

     * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
     *      javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
            throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
        VariableMapper orig = ctx.getVariableMapper();
        if (this.params != null) {
            VariableMapper vm = new VariableMapperWrapper(orig);
            ctx.setVariableMapper(vm);
            for (int i = 0; i < this.params.length; i++) {
                this.params[i].apply(ctx, parent);
            }
        }

        ctx.pushClient(this);
        String path = null;
        try {
            path = this.template.getValue(ctx);
            ctx.includeFacelet(parent, path);
        } catch (IOException e) {
            if (log.isLoggable(Level.FINE)) {
                log.log(Level.FINE, e.toString(), e);
            }
            throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
        } finally {
            ctx.setVariableMapper(orig);
            ctx.popClient(this);
        }
    }
View Full Code Here

     * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
     *      javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
            throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;

        if (this.template != null) {
            VariableMapper orig = ctx.getVariableMapper();
            if (this.params != null) {
                VariableMapper vm = new VariableMapperWrapper(orig);
                ctx.setVariableMapper(vm);
                for (int i = 0; i < this.params.length; i++) {
                    this.params[i].apply(ctx, parent);
                }
            }

            ctx.extendClient(this);
            String path = null;
            try {
                path = this.template.getValue(ctx);               
                ctx.includeFacelet(parent, path);
            } catch (IOException e) {
                if (log.isLoggable(Level.FINE)) {
                    log.log(Level.FINE, e.toString(), e);
                }
                throw new TagAttributeException(this.tag, this.template, "Invalid path : " + path);
            } finally {
                ctx.popClient(this);
                ctx.setVariableMapper(orig);
            }
        } else {
            this.nextHandler.apply(ctx, parent);
        }
    }
View Full Code Here

     * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
     *      javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
            throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
       
        ctx.extendClient(this);
        boolean found = false;
        try {
            found = ctx.includeDefinition(parent, this.name);
        } finally {
            ctx.popClient(this);
        }
        if (!found) {
            this.nextHandler.apply(ctx, parent);
        }
    }
View Full Code Here

     * @see VariableMapper
     * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctxObj, UIComponent parent)
    throws IOException {
        FaceletContextImplBase ctx = (FaceletContextImplBase) ctxObj;
        VariableMapper orig = ctx.getVariableMapper();
       
        // setup a variable map
        if (this.vars.length > 0) {
            VariableMapper varMapper = new VariableMapperWrapper(orig);
            for (int i = 0; i < this.vars.length; i++) {
                varMapper.setVariable(this.vars[i].getLocalName(), this.vars[i]
                        .getValueExpression(ctx, Object.class));
            }
            ctx.setVariableMapper(varMapper);
        }
       
        // eval include
        try {
            ctx.pushClient(this);
            ctx.includeFacelet(parent, this.location);
        } catch (FileNotFoundException e) {
            throw new TagException(this.tag, e.getMessage());
        } finally {
           
            // make sure we undo our changes
            ctx.popClient(this);
            ctx.setVariableMapper(orig);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.faces.facelets.FaceletContextImplBase

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.