Package org.zkoss.zk.ui.ext

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


    if ("application".equals(name))
      return comp != null ? getWebApp(comp): page.getDesktop().getWebApp();
    if ("componentScope".equals(name))
      return comp != null ? comp.getAttributes(): Collections.EMPTY_MAP;
    if ("spaceScope".equals(name)) {
      final Scope scope = comp != null ? (Scope)comp.getSpaceOwner(): (Scope)page;
      return scope != null ? scope.getAttributes(): Collections.EMPTY_MAP;
    }
    if ("pageScope".equals(name))
      return page != null ? page.getAttributes(): Collections.EMPTY_MAP;
    if ("desktopScope".equals(name)) {
      final Desktop dt = comp != null ? getDesktop(comp): page.getDesktop();
View Full Code Here


  }

  //GenericInterpreter//
  protected void exec(String script) {
    try {
      final Scope scope = getCurrent();
      if (scope != null) _ip.eval(script, prepareNS(scope));
      else _ip.eval(script); //unlikely (but just in case)
    } catch (EvalError ex) {
      throw UiException.Aide.wrap(ex);
    }
View Full Code Here

    scope.setAttribute(VAR_NSW, NSWrap.getInstance(bshns));
    return bshns;
  }
  /*package*/ NS newNS(Scope scope) {
    scope = getIdSpace(scope);
    Scope p = getParentIdSpace(scope);
    return new NS(p != null ? prepareNS(p): _bshns, _ip.getClassManager(), scope);
      //Bug 1831534: we have to pass class manager
      //Bug 1899353: we have to use _bshns instead of null (Reason: unknown)
  }
View Full Code Here

    NSWrap nsw = (NSWrap)scope.getAttribute(VAR_NSW);
    if (nsw != null)
      return nsw.unwrap(scope);

    //bind bshns and scope
    Scope p = getParentIdSpace(scope);
    NameSpace bshns = new NS(p != null ? prepareDetachedNS(p): null, null, scope);
    scope.setAttribute(VAR_NSW, NSWrap.getInstance(bshns));
    return bshns;
  }
View Full Code Here

    //super//
    /** Search _scope instead. */
    protected Object getFromScope(String name) {
      final BSHInterpreter ip = getInterpreter(_scope);
      final Scope curr = ip != null ? ip.getCurrent(): null;
      if (curr== null)
        return getImplicit(name); //ignore scope

      if (_firstGet) {
        _firstGet = false;
View Full Code Here

        session.removeAttribute(name);
      }

      public Component getSelf(ExecutionCtrl exec) {
                final Page page = exec.getCurrentPage();
                final Scope scope = Scopes.getCurrent(page);
                if (scope != null) {
                        Object o = scope.getAttribute("self", false);
                        if(o instanceof Component) {
                                Component self = (Component) o;
                                if (self == null) {
                                        self = (Component) Scopes.getImplicit("self", null);
                                }
View Full Code Here

        //can't access setAttribute directly, since signature of ZK 5 changed
      }

      public Component getSelf(ExecutionCtrl exec) {
        final Page page = exec.getCurrentPage();
        final Scope scope = Scopes.getCurrent(page);
        if (scope != null) {
          Component self = (Component) scope.getAttribute("self", true);
          //since ZK 3.6.1, event handling, use getImplicit()
          if (self == null) {
            self = (Component) Scopes.getImplicit("self", null);
          }
          return self;
View Full Code Here

              return Path.getComponent(self.getSpaceOwner(), path);
            } else {
              return self.getAttribute(path, false);
            }
          } else { //handling event
            final Scope scope = Scopes.getCurrent(page);
            if (scope != null) {
              final Component xself = (Component) scope.getAttribute("self", true);
              if (Components.isImplicit(getBeanName())) {
                return Components.getImplicit(xself, getBeanName());
              }
              if (path == null) {
                //sometimes, Spring can instantiate partially, the bean name might be null
                if (getBeanName() != null) {
                  return scope.getAttribute(getBeanName(), true);
                }
              } else if (path.startsWith(".")) { //relative path
                return Path.getComponent(xself.getSpaceOwner(), path);
              } else {
                return scope.getAttribute(path, true);
              }
            }
          }
        }
      }
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.