Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Page


    return comp;
  }
  public boolean isInstance(Component comp) {
    Class cls;
    if (_implcls instanceof String) {
      final Page page = comp.getPage();
      if (page != null) {
        try {
          cls = resolveImplementationClass(page, null);
        } catch (ClassNotFoundException ex) {
          return true; //consider as true if not resolvable
View Full Code Here


  public Object getValue(Component comp) {
    if (_value != null)
      return _value.getValue(_evalr, comp);

    Desktop desktop = comp.getDesktop();
    Page page;
    if (desktop == null) {
      Execution exec = Executions.getCurrent();
      if (exec == null)
        throw new IllegalStateException("Not attached, nor execution");
      desktop = exec.getDesktop();
View Full Code Here

  }

  private String getUuid(AuRequest request) {
    final Component comp = request.getComponent();
    if (comp != null) return comp.getUuid();
    final Page page = request.getPage();
    if (page != null) return page.getUuid();
    return null;
  }
View Full Code Here

  private Comparator toComparator(String clsnm)
  throws ClassNotFoundException, InstantiationException,
  IllegalAccessException {
    if (clsnm == null || clsnm.length() == 0) return null;

    final Page page = getPage();
    final Class cls = page != null ?
      page.getZScriptClass(clsnm): Classes.forNameByThread(clsnm);
    if (cls == null)
      throw new ClassNotFoundException(clsnm);
    if (!Comparator.class.isAssignableFrom(cls))
      throw new UiException("Comparator must be implemented: "+clsnm);
    return (Comparator)cls.newInstance();
View Full Code Here

    if (TimeZones.getThreadLocal() == null)
      TimeZones.setThreadLocal(_timeZone);
    else
      _timeZone = null;

    final Page page = _exec.getDesktop().getFirstPage();
    if (page != null)
      execCtrl.setCurrentPage(page);
  }
View Full Code Here

    final DesktopRecycle dtrc = wapp.getConfiguration().getDesktopRecycle();
    Desktop desktop = dtrc != null ? Utils.beforeService(dtrc, svlctx, sess, httpreq, httpres, path): null;

    try {
      if (desktop != null) { //recycle
        final Page page = Utils.getMainPage(desktop);
        if (page != null) {
          final Execution exec =
            new ExecutionImpl(svlctx, httpreq, httpres, desktop, page);
          fixContentType(response);
          wappc.getUiEngine()
            .recycleDesktop(exec, page, response.getWriter());
        } else
          desktop = null; //something wrong (not possible; just in case)
      }

      if (desktop == null) {
        desktop = webman.getDesktop(sess, httpreq, httpres, path, true);
        if (desktop == null) //forward or redirect
          return true;

        final RequestInfo ri = new RequestInfoImpl(
          wapp, sess, desktop, httpreq,
          PageDefinitions.getLocator(wapp, path));
        ((SessionCtrl)sess).notifyClientRequest(true);

        final Page page;
        final PageRenderPatch patch = getRenderPatch();
        final Writer out = patch.beforeRender(ri);
        final UiFactory uf = wappc.getUiFactory();
        if (uf.isRichlet(ri, bRichlet)) {
          final Richlet richlet = uf.getRichlet(ri, path);
View Full Code Here

  //-- super --//
  public void redraw(java.io.Writer out) throws java.io.IOException {
    final Execution exec = Executions.getCurrent();
    final StringWriter bufout = new StringWriter();
    final Page page = getPage();
    final Object ret = PageRenderer.beforeRenderHtml(exec, page, bufout);
    super.redraw(bufout);
    PageRenderer.afterRenderHtml(exec, page, bufout, ret);

    final StringBuffer buf = bufout.getBuffer();
View Full Code Here

    return resolveVariable(null, null, name);
  }
  //-- VariableResolverX --//
  public Object resolveVariable(XelContext ctx, Object base, Object onm) {
    if (base != null) {
      final Page page = ((ExecutionCtrl)_exec).getCurrentPage();
      return page != null ? page.getXelVariable(ctx, base, onm, true): null;
    }

    if (onm == null)
      return null;

    final String name = onm.toString();
    if (name == null || name.length() == 0) //just in case
      return null;

    //Note: we have to access keyword frist (rather than component's ns)
    //since 1) BeanShell interpreter will store back variables
    //and page.getZScriptVariable will return the old value
    //2) ZK 5, getAttributeOrFellow doesn't look for variable resolvers and implicit objects
    if ("arg".equals(name))
      return _exec.getArg();
    if ("componentScope".equals(name)) {
      if (_self instanceof Component)
        return ((Component)_self).getAttributes(Component.COMPONENT_SCOPE);
      return Collections.EMPTY_MAP;
    }
    if ("desktopScope".equals(name))
      return _exec.getDesktop().getAttributes();
    if ("desktop".equals(name))
      return _exec.getDesktop();
    if ("execution".equals(name))
      return _exec;
    if ("pageScope".equals(name)) {
      if (_self instanceof Component)
        return ((Component)_self).getAttributes(Component.PAGE_SCOPE);
      if (_self instanceof Page)
        return ((Page)_self).getAttributes();
      final Page page = ((ExecutionCtrl)_exec).getCurrentPage();
      return page != null ? page.getAttributes(): Collections.EMPTY_MAP;
    }
    if ("page".equals(name)) {
      if (_self instanceof Component)
        return getPage((Component)_self);
      if (_self instanceof Page)
        return (Page)_self;
      return ((ExecutionCtrl)_exec).getCurrentPage();
    }
    if ("requestScope".equals(name))
      return _exec.getAttributes();
    if ("self".equals(name))
      return _self;
    if ("sessionScope".equals(name))
      return _exec.getDesktop().getSession().getAttributes();
    if ("session".equals(name))
      return _exec.getDesktop().getSession();
    if ("spaceOwner".equals(name)) {
      if (_self instanceof Component)
        return ((Component)_self).getSpaceOwner();
      if (_self instanceof Page)
        return (Page)_self;
      return null;
    }
    if ("spaceScope".equals(name)) {
      if (_self instanceof Component)
        return ((Component)_self).getAttributes(Component.SPACE_SCOPE);
      if (_self instanceof Page)
        return ((Page)_self).getAttributes();
      return Collections.EMPTY_MAP;
    }

    if (_self instanceof Component) {
      final Component comp = (Component)_self;

      //We have to look getZScriptVariable first and then namespace
      //so it is in the same order of interpreter
      final Page page = getPage(comp);
      if (page != null) {
        final Object o =
          page.getZScriptVariable(comp, name);
        if (o != null)
          return o;
      }

      Object o = _exec.getAttribute(name);
      if (o != null || _exec.hasAttribute(name))
        return o;

      o = comp.getAttributeOrFellow(name, true);
      if (o != null)
        return o;

      if (page != null) {
        o = page.getXelVariable(ctx, null, name, true);
        if (o != null)
          return o;
      }
    } else {
      Page page;
      if (_self instanceof Page) {
        page = (Page)_self;
      } else {
        page = ((ExecutionCtrl)_exec).getCurrentPage();
      }

      if (page != null) {
        Object o = page.getZScriptVariable(name);
        if (o != null)
          return o;

        o = _exec.getAttribute(name);
        if (o != null || _exec.hasAttribute(name))
          return o;

        o = page.getAttributeOrFellow(name, true);
        if (o != null)
          return o;

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

    }

    return Evaluators.resolveVariable(_parent, name);
  }
  private static Page getPage(Component comp) {
    Page page = comp.getPage();
    if (page != null) return page;

    final Execution exec = Executions.getCurrent();
    return exec != null ? ((ExecutionCtrl)exec).getCurrentPage(): null;
  }
View Full Code Here

        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))
View Full Code Here

TOP

Related Classes of org.zkoss.zk.ui.Page

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.