Package javax.el

Examples of javax.el.VariableMapper


                    i++;
                }

                String v = this.getVarName(ctx);
                String vs = this.getVarStatusName(ctx);
                VariableMapper vars = ctx.getVariableMapper();
                ValueExpression ve = null;
                ValueExpression vO = this.capture(v, vars);
                ValueExpression vsO = this.capture(vs, vars);
                int mi = 0;
                Object value = null;
                try
                {
                    boolean first = true;
                    while (i <= e && itr.hasNext())
                    {
                        value = itr.next();

                        // set the var
                        if (v != null)
                        {
                            if (t || srcVE == null)
                            {
                                ctx.setAttribute(v, value);
                            }
                            else
                            {
                                ve = this.getVarExpr(srcVE, src, value, i);
                                vars.setVariable(v, ve);
                            }
                        }

                        // set the varStatus
                        if (vs != null)
                        {
                            IterationStatus itrS = new IterationStatus(first, !itr.hasNext(), i, sO, eO, mO, value);
                            if (t || srcVE == null)
                            {
                                ctx.setAttribute(vs, itrS);
                            }
                            else
                            {
                                ve = new IterationStatusExpression(itrS);
                                vars.setVariable(vs, ve);
                            }
                        }

                        // execute body
                        this.nextHandler.apply(ctx, parent);

                        // increment steps
                        mi = 1;
                        while (mi < m && itr.hasNext())
                        {
                            itr.next();
                            mi++;
                            i++;
                        }
                        i++;

                        first = false;
                    }
                }
                finally
                {
                    if (v != null)
                    {
                        vars.setVariable(v, vO);
                    }
                    if (vs != null)
                    {
                        vars.setVariable(vs, vsO);
                    }
                }
            }
        }
View Full Code Here


                mctx.addAttachedObjectHandler(
                        compositeComponentBase, it.next());
            }
        }   
       
        VariableMapper orig = faceletContext.getVariableMapper();
        try
        {
            faceletContext.setVariableMapper(new VariableMapperWrapper(orig));
            actx.pushCompositeComponentClient(this);
            actx.applyCompositeComponent(compositeFacetPanel, _resource);
View Full Code Here

        String path = this.src.getValue(ctx);
        if (path == null || path.length() == 0)
        {
            return;
        }
        VariableMapper orig = ctx.getVariableMapper();
        ctx.setVariableMapper(new VariableMapperWrapper(orig));
        try
        {
            //Only ui:param could be inside ui:include.
            //this.nextHandler.apply(ctx, null);
View Full Code Here

                mctx.addAttachedObjectHandler(
                        compositeComponentBase, it.next());
            }
        }   
       
        VariableMapper orig = faceletContext.getVariableMapper();
        try
        {
            faceletContext.setVariableMapper(new VariableMapperWrapper(orig));
            actx.pushCompositeComponentClient(this);
            Resource resourceForCurrentView = faceletContext.getFacesContext().getApplication().
View Full Code Here

            // According to UserTagHandler, in this point we need to wrap the facelet
            // VariableMapper, so local changes are applied on "page context", but
            // data is retrieved from full context
            FaceletContext faceletContext = (FaceletContext) context.
                    getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
            VariableMapper orig = faceletContext.getVariableMapper();
            try
            {
                faceletContext.setVariableMapper(new VariableMapperWrapper(orig));

                compositeComponentBase.pushComponentToEL(context, compositeComponentBase);
View Full Code Here

        return cont.getFunctionMapper();
      }

      @Override
      public VariableMapper getVariableMapper() {
        return new VariableMapper() {

          @Override
          public ValueExpression resolveVariable(String variable) {
            if (variable.equals(itemId)) {
              return new IndexedValueExpression(__value, index);
View Full Code Here

    // Set up var variable
    if (itemId != null) {
      if (index == null)
        pageContext.removeAttribute(itemId, PageContext.PAGE_SCOPE);
      else if (__value != null) {
        VariableMapper vm = pageContext.getELContext()
            .getVariableMapper();
        if (vm != null) {
          ValueExpression ve = getVarExpression(__value);
          vm.setVariable(itemId, ve);
        }
      } else
        pageContext.setAttribute(itemId, index);
    }

    // Set up index variable

    if (indexId != null) {
      if (index == null)
        pageContext.removeAttribute(indexId, PageContext.PAGE_SCOPE);
      else {
        IteratedIndexExpression indexExpression = new IteratedIndexExpression(
            index);
        VariableMapper vm = pageContext.getELContext()
            .getVariableMapper();
        if (vm != null) {
          vm.setVariable(indexId, indexExpression);
        }
      }
    }

  }
View Full Code Here

   *
   * @throws JspTagException
   */
  private void exposeVariables(FaceletContext ctx) {
    IterationContext itContext = getIterationContext();
    VariableMapper vm = ctx.getVariableMapper();
    int k = itContext._index;

    if (itContext._itemId != null) {
      if (vm != null) {
        if (value != null) {
          ValueExpression srcVE = value.getValueExpression(ctx,
              Object.class);
          ValueExpression ve = getVarExpression(ctx, srcVE);
          vm.setVariable(itContext._itemId, ve);
        }
      }

    }

    // Set up index variable

    if (itContext._indexId != null) {
      if (vm != null) {
        ValueExpression ve = new IteratedIndexExpression(k);
        vm.setVariable(itContext._indexId, ve);
      }

    }

    int componentsCount = itContext._index - itContext._begin;
    if (componentsCount != 0) {
      ValueExpression ve = ctx.getExpressionFactory().createValueExpression(UIViewRoot.UNIQUE_ID_PREFIX + componentsCount, String.class);
      vm.setVariable(ITERATION_INDEX_VARIABLE, ve);
    }
  }
View Full Code Here

   * Removes page attributes that we have exposed and, if applicable, restores
   * them to their prior values (and scopes).
   */
  private void unExposeVariables(FaceletContext ctx) {
    IterationContext itContext = getIterationContext();
    VariableMapper vm = ctx.getVariableMapper();
    // "nested" variables are now simply removed
    if (itContext._itemId != null) {
      if (vm != null)
        vm.setVariable(itContext._itemId, null);
    }
    if (itContext._indexId != null) {
      if (vm != null)
        vm.setVariable(itContext._indexId, null);
    }
   
    vm.setVariable(ITERATION_INDEX_VARIABLE, null);
  }
View Full Code Here

                mctx.addAttachedObjectHandler(
                        compositeComponentBase, it.next());
            }
        }   
       
        VariableMapper orig = faceletContext.getVariableMapper();
        try
        {
            faceletContext.setVariableMapper(new VariableMapperWrapper(orig));
            actx.pushCompositeComponentClient(this);
            Resource resourceForCurrentView = faceletContext.getFacesContext().getApplication().
View Full Code Here

TOP

Related Classes of javax.el.VariableMapper

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.