Package org.zkoss.xel.util

Examples of org.zkoss.xel.util.SimpleXelContext


    this.resolver = new InterpretResolver(dc.getVariableResolver());
  }
  void init(FunctionMapper mapper) {
    if (this.xelc != null)
      throw new IllegalArgumentException();
    this.xelc = new SimpleXelContext(this.resolver, mapper);
  }
View Full Code Here


   * 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

   * @since 3.0.0
   */
  public VariableResolver setVariableResolver(VariableResolver resolv) {
    final VariableResolver old =
      _xelc != null ? _xelc.getVariableResolver(): null;
    _xelc = resolv != null ? new SimpleXelContext(resolv, null): null;
    return old;
  }
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

    final Reference ref = addRef(); //add it back whenever there is new formula
    ((Ref2d)ref).setUpdatable(true); //and of course a cell is an updatable reference
    ((Ref2d)ref).setLonglive(true); //cannot be cascade removed (ref to cell)
    resolver.set("zkoss.ss.Ref", ref);
   
    return new SimpleXelContext(resolver, ((XelContext)book).getFunctionMapper());
  }
View Full Code Here

   
    //VariableResolver
    final SSMapResolver resolver = new SSMapResolver(((XelContext)book).getVariableResolver());
    final Reference ref = getRef();
    resolver.set("zkoss.ss.Ref", ref);
    return new SimpleXelContext(resolver, null);
  }
View Full Code Here

  public static CellValue evaluate(Book book, Cell cell) {
    final XelContext old = XelContextHolder.getXelContext();
    try {
      final VariableResolver resolver = BookHelper.getVariableResolver(book);
      final FunctionMapper mapper = BookHelper.getFunctionMapper(book);
      final XelContext ctx = new SimpleXelContext(resolver, mapper);
      ctx.setAttribute("zkoss.zss.CellType", Object.class);
      XelContextHolder.setXelContext(ctx);
      final CellValue cv = book.getFormulaEvaluator().evaluate(cell);
      //set back into Cell formula record(update value and cachedFormulaResultType)
      setCellValue(cell, cv);
      return cv;
View Full Code Here

  private static CellValue evaluateFormula(Book book, int sheetIndex, String formula) {
    final XelContext old = XelContextHolder.getXelContext();
    try {
      final VariableResolver resolver = BookHelper.getVariableResolver(book);
      final FunctionMapper mapper = BookHelper.getFunctionMapper(book);
      final XelContext ctx = new SimpleXelContext(resolver, mapper);
      ctx.setAttribute("zkoss.zss.CellType", Object.class);
      XelContextHolder.setXelContext(ctx);
      final CellValue cv = book.getFormulaEvaluator().evaluateFormula(sheetIndex, formula);
      return cv;
    } finally {
      XelContextHolder.setXelContext(old);
View Full Code Here

  private static ValueEval evaluateFormulaValueEval(Book book, int sheetIndex, String formula, boolean ignoreDereference) {
    final XelContext old = XelContextHolder.getXelContext();
    try {
      final VariableResolver resolver = BookHelper.getVariableResolver(book);
      final FunctionMapper mapper = BookHelper.getFunctionMapper(book);
      final XelContext ctx = new SimpleXelContext(resolver, mapper);
      ctx.setAttribute("zkoss.zss.CellType", Object.class);
      XelContextHolder.setXelContext(ctx);
      return book.getFormulaEvaluator().evaluateFormulaValueEval(sheetIndex, formula, ignoreDereference);
    } finally {
      XelContextHolder.setXelContext(old);
    }
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() {
    return new SimpleXelContext(getVariableResolver(), getFunctionMapper());
  }
View Full Code Here

TOP

Related Classes of org.zkoss.xel.util.SimpleXelContext

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.