Package org.zkoss.zk.ui.ext

Examples of org.zkoss.zk.ui.ext.Scope


  public boolean isActive() {
    return getZKScope() != null;
  }
 
  private Map getScopeAttributes() {
    final Scope scope = getZKScope();
    return scope != null ? scope.getAttributes() : null;
  }
View Full Code Here


   * See also {@link org.zkoss.zk.ui.util.Configuration#isEventThreadEnabled}.
   */
  public void process() throws Exception {
    //Bug 1506712: event listeners might be zscript, so we have to
    //keep built-in variables as long as possible
    final Scope scope = Scopes.beforeInterpret(_comp);
      //we have to push since process0 might invoke methods from zscript class
    try {
      Scopes.setImplicit("event", _event);

      _event = ((DesktopCtrl)_desktop).beforeProcessEvent(_event);
View Full Code Here

  public ZScriptInitiator(ZScript script) {
    if (script == null) throw new IllegalArgumentException("null");
    _zscript = script;
  }
  public void doInit(Page page, Map args) throws Exception {
    final Scope scope = Scopes.beforeInterpret(page);
    try {
      page.interpret(
        _zscript.getLanguage(), _zscript.getContent(page, null), scope);
    } finally {
      Scopes.afterInterpret();
View Full Code Here

  }
  /** @deprecated
   */
  private static Scope getScope(Namespace ns) {
    if (ns == null) return null;
    Scope s = ns.getOwner();
    return s != null ? s: ns.getOwnerPage();
  }
View Full Code Here

          it.remove(); //done

          final Component parent = (Component)zsInfo[0];
          if ((parent == null || parent.getPage() == this)
          && isEffective(zscript, parent)) {
            final Scope scope =
              Scopes.beforeInterpret(parent != null ? (Scope)parent: this);
            try {
              ip.interpret(zscript.getContent(this, parent), scope);
            } finally {
              Scopes.afterInterpret();
View Full Code Here

    _done = true;
    restoreStatus();
    return false;
  }
  private void setupStatus() {
    final Scope scope = getScope();
    _oldEach = scope.getAttribute("each", true);
    _status = new Status(scope.getAttribute("forEachStatus", true));
    scope.setAttribute("forEachStatus", _status);
  }
View Full Code Here

    _oldEach = scope.getAttribute("each", true);
    _status = new Status(scope.getAttribute("forEachStatus", true));
    scope.setAttribute("forEachStatus", _status);
  }
  private void restoreStatus() {
    final Scope scope = getScope();
    if (_status.previous != null)
      scope.setAttribute("forEachStatus", _status.previous);
    else
      scope.removeAttribute("forEachStatus");
    if (_oldEach != null)
      scope.setAttribute("each", _oldEach);
    else
      scope.removeAttribute("each");
    _it = null; _status = null; //recycle (just in case)
  }
View Full Code Here

      final ZScript zscript = (ZScript)meta;
      if (zscript.isDeferred()) {
        ((PageCtrl)page).addDeferredZScript(comp, zscript);
          //isEffective is handled later
      } else if (isEffective(zscript, page, comp)) {
        final Scope scope =
          Scopes.beforeInterpret(comp != null ? (Scope)comp: page);
        try {
          page.interpret(zscript.getLanguage(),
            zscript.getContent(page, comp), scope);
        } finally {
View Full Code Here

   *
   * <p>Note: We use {@link #UNDEFINED} to denote undefined since 2.4.0,
   * while null is a valid value.
   */
  protected Object getFromNamespace(String name) {
    final Scope scope = getCurrent();
    if (scope != null) { //null means no scope allowed!
      final Execution exec = Executions.getCurrent();
      if (exec != null && exec != scope) {
        Object val = exec.getAttribute(name);
        if (val != null /*|| exec.hasAttribute(name)*/) //request's hasAttribute same as getAttribute
          return val;
      }

      if (scope instanceof Component) {
        Component comp = (Component)scope;
        Object val = comp.getAttributeOrFellow(name, true);
        if (val != null || comp.hasAttributeOrFellow(name, true))
          return val;

        Page page = comp.getPage();
        if (page != null) {
          val = page.getXelVariable(null, null, name, true);
          if (val != null)
            return val;
        }
      } else if (scope instanceof Page) {
        Page page = (Page)scope;
        Object val = page.getAttributeOrFellow(name, true);
        if (val != null || page.hasAttributeOrFellow(name, true))
          return val;

        val = page.getXelVariable(null, null, name, true);
        if (val != null)
          return val;
      } else {
        Object val = scope.getAttribute(name, true);
        if (val != null || scope.hasAttribute(name, true))
          return val;
      }
    }
    return getImplicit(name);
  }
View Full Code Here

  }

  /** @deprecated As of release 5.0.0, replaced with {@link #interpret(String, Scope)}
   */
  public void interpret(String script, org.zkoss.zk.scripting.Namespace ns) {
    Scope scope = null;
    if (ns != null) {
      scope = ns.getOwner();
      if (scope == null) scope = ns.getOwnerPage();
    }
    interpret(script, scope);
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.ext.Scope

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.