Examples of FunctionMapper


Examples of org.zkoss.xel.FunctionMapper

  }
  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

Examples of org.zkoss.xel.FunctionMapper

    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

Examples of org.zkoss.xel.FunctionMapper

  /** 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

Examples of org.zkoss.xel.FunctionMapper

 
  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

Examples of org.zkoss.xel.FunctionMapper

        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

Examples of org.zkoss.xel.FunctionMapper

        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

Examples of org.zkoss.xel.FunctionMapper

    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

Examples of org.zkoss.xel.FunctionMapper

    _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

Examples of org.zkoss.xel.FunctionMapper

   * @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

Examples of org.zkoss.xel.FunctionMapper

    private static final long serialVersionUID = 1L;

    public Collection getClassNames() {
      final Page page = getPage();
      if (page != null) {
        final FunctionMapper mapper = page.getFunctionMapper();
        if (mapper != null) {
          return new ArrayList<String>(0);
        }
      }
      return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.