Package org.zkoss.xel

Examples of org.zkoss.xel.FunctionMapper


        _eval.parseExpression(expression, expectedType));
    if (_v102)
      return new ELXelExpression102(
        _eval.parseExpression(expression, expectedType));

    FunctionMapper mapper = xelc != null ? xelc.getFunctionMapper(): null;
    return new ELXelExpression100(
      _eval.parseExpression(expression, expectedType, mapper),
      expression, mapper, expectedType);
  }
View Full Code Here


  }
  public Object evaluate(XelContext ctx) {
    //Test case: B30-1957661.zul where a function mapper is created
    //by zscript so it is different from one page to page
    //In this case, we cannot reuse parsed expression.
    final FunctionMapper nfm = ctx.getFunctionMapper();
    if (!Objects.equals(_mapper, nfm))
      return new ELFactory().evaluate(ctx, _rawexpr, _expected);
    return _expr.evaluate(ctx.getVariableResolver());
  }
View Full Code Here

    if (_mapperdefs != null)
      for (Iterator it = _mapperdefs.iterator(); it.hasNext();) {
        final FunctionMapperInfo def = (FunctionMapperInfo)it.next();
        try {
          FunctionMapper mapper =
            def.newFunctionMapper(this, page);
          if (mapper != null)
            page.addFunctionMapper(mapper);
        } catch (Throwable ex) {
          throw UiException.Aide.wrap(ex);
View Full Code Here

  /** Instantiate a XEL context.
   * Don't reuse it since it has attributes (that shall not be kept
   * after evaluation).
   */
  private XelContext newXelContext(Object ref) {
    final FunctionMapper mapper = getFunctionMapper(ref);
    final VariableResolver resolver = getVariableResolver(ref);
    return new SimpleXelContext(resolver, mapper);
      //Bug 1814838: don't cache the instance
  }
View Full Code Here

 
  private XelContext getXelContext() {
    Taglib taglib = new Taglib("", "/web/WEB-INF/tld/zss/function.tld");
    List taglibs = new ArrayList(1);
    taglibs.add(taglib);
    FunctionMapper mapper = Taglibs.getFunctionMapper(taglibs, new ClassLocator());
    return new SimpleXelContext(null, mapper);
  }
View Full Code Here

        return x != null ? x : resolveVariable(resolver, (String)_value, ctx);
*/
        return resolveVariable(resolver, (String)_value, ctx);
      }
    } else if (_type == TokenType.FUNCTION) {
      final FunctionMapper mapper = ctx.getFunctionMapper();
      final Function fn = mapper.resolveFunction("", (String)_value);
      if (fn == null) { //cannot find the specified function
        throw new SSErrorXelException(SSError.NAME);
      }
      Object[] args = new Object[getOperands().size()];
      int j = 0;
View Full Code Here

        sb.append(getRangePrintString((Range) _value, ctx));
      } else if (_subtype == TokenSubtype.VAR) { //refer to a variable
        sb.append(_value);
      }
    } else if (_type == TokenType.FUNCTION) {
      final FunctionMapper mapper = ctx.getFunctionMapper();
      final Function fn = mapper.resolveFunction("", (String)_value);
      if (fn == null) { //cannot find the specified function
        sb.append(SSError.NAME);
      } else {
        sb.append(_value).append("(");
        Collection opns = getOperands();
View Full Code Here

    Map map = new HashMap();
    SimpleResolver resolver = new SimpleResolver(map);
    map.put("DEF", "Hello ZK");
    book.addVariableResolver(resolver);

    FunctionMapper mapper = new MyMapper();
    book.addFunctionMapper(mapper);
    Cell cellA1 = sheet1.getCell(0,0);
System.out.println(cellA1.getValue());
   
Cell cellA2 = sheet1.getCell(1,0);
View Full Code Here

    _mappers = new LinkedHashSet(4);
   
    //prepare the default Spread Sheet function mapper.
    final List taglibs = new ArrayList(1);
    taglibs.add(SSTAGLIB);
    FunctionMapper mapper = Taglibs.getFunctionMapper(taglibs, new ClassLocator());
    addFunctionMapper(mapper);
  }
View Full Code Here

   * @see org.zkoss.xel.FunctionMapper#resolveFunction(java.lang.String, java.lang.String)
   */
  public Function resolveFunction(String arg0, String arg1)
      throws XelException {
    for(final Iterator it=_mappers.iterator(); it.hasNext();) {
      final FunctionMapper mapper = (FunctionMapper) it.next();
      final Function fun = mapper.resolveFunction(arg0, arg1);
      if (fun != null) return fun;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.zkoss.xel.FunctionMapper

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.