Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Execution


    final Session sess = WebManager.getSession(ctx, request);
    final WebApp wapp = sess.getWebApp();
    final WebAppCtrl wappc = (WebAppCtrl)wapp;
    final Object old = I18Ns.setup(sess, request, response,
      wapp.getConfiguration().getResponseCharset());
    Execution exec = null;
    try {
      final Desktop desktop = webman.getDesktop(sess, request, response, path, true);
      if (desktop == null) //forward or redirect
        return;

      final RequestInfo ri = new RequestInfoImpl(
        wapp, sess, desktop, request,
        PageDefinitions.getLocator(wapp, path));
      sess.setAttribute(Attributes.GAE_FIX, new Integer(0));
      ((SessionCtrl)sess).notifyClientRequest(true);

      final UiFactory uf = wappc.getUiFactory();
      final Richlet richlet = new StandaloneRichlet(comp);

      final Page page = WebManager.newPage(uf, ri, richlet, response, path);
      exec = new ExecutionImpl(ctx, request, response, desktop, page);
      exec.setAttribute(Attributes.PAGE_REDRAW_CONTROL, "page");
      exec.setAttribute(Attributes.PAGE_RENDERER, new PageRenderer(exec));

      wappc.getUiEngine().execNewPage(exec, richlet, page, out);
          //no need to set device type here, since UiEngine will do it later
    } finally {
      I18Ns.cleanup(request, old);
      if (exec != null) {
        exec.removeAttribute(Attributes.PAGE_REDRAW_CONTROL);
        exec.removeAttribute(Attributes.PAGE_RENDERER);
      }
    }
  }
View Full Code Here


    public Set getAvailableAtClient() {
      if (!isCropper()) return null;

      final Tree tree = getTree();
      final Component parent = getParent();
      final Execution exe = Executions.getCurrent();
      final String attrnm = VISIBLE_ITEM + tree.getUuid();
      Map map = (Map)exe.getAttribute(attrnm);
      if (map == null) {
        //Test very simple case first since getVisibleItems costly
        if (parent instanceof Treeitem) {
          for (Treeitem ti = (Treeitem)parent;;) {
            if (!ti.isOpen())
View Full Code Here

implements ServletRequestAttributeListener {
  // ServletRequestAttributeListener//
  public void attributeAdded(ServletRequestAttributeEvent evt) {
    final String name = evt.getName();
    if (!shallIgnore(name)) {
      final Execution exec = Executions.getCurrent();
      if (exec instanceof ExecutionImpl
      && evt.getServletRequest().equals(exec.getNativeRequest()))
        ((ExecutionImpl)exec).getScopeListeners()
          .notifyAdded(name, evt.getValue());
    }
  }
View Full Code Here

    }
  }
  public void attributeRemoved(ServletRequestAttributeEvent evt) {
    final String name = evt.getName();
    if (!shallIgnore(name)) {
      final Execution exec = Executions.getCurrent();
      if (exec instanceof ExecutionImpl
      && evt.getServletRequest().equals(exec.getNativeRequest()))
        ((ExecutionImpl)exec).getScopeListeners()
          .notifyRemoved(name);
    }
  }
View Full Code Here

    }
  }
  public void attributeReplaced(ServletRequestAttributeEvent evt) {
    final String name = evt.getName();
    if (!shallIgnore(name)) {
      final Execution exec = Executions.getCurrent();
      if (exec instanceof ExecutionImpl
      && evt.getServletRequest().equals(exec.getNativeRequest()))
        ((ExecutionImpl)exec).getScopeListeners()
          .notifyReplaced(name, evt.getValue());
    }
  }
View Full Code Here

      final boolean refChanged = ((Boolean) data[4]).booleanValue(); //whether bean itself changed
      final List nodes = (List) data[5]; //the complete nodes along the path to the node
      final Component savecomp = (Component) data[6]; //saved comp that trigger this load-on-save event
      final String triggerEventName = (String) data[7]; //event that trigger the save
      if (savecomp != null) {
        final Execution exec = Executions.getCurrent();
        final Object old = exec.getAttribute(LOAD_ON_SAVE_TRIGGER_COMPONENT);
        exec.setAttribute(LOAD_ON_SAVE_TRIGGER_COMPONENT, new Object[] {savecomp, triggerEventName});
        try {
          loadAllNodes(bean, node, savecomp, savebinding, refChanged, nodes, walkedNodes, loadedComps);
        } finally {
          exec.setAttribute(LOAD_ON_SAVE_TRIGGER_COMPONENT, old);
        }
      }
    }
View Full Code Here

      response.sendError(response.SC_NOT_FOUND, path);
      return;
    }

    final StringWriter sw = new StringWriter();
    final Execution exec = new ExecutionImpl(
        getServletContext(), request, response, null, null),
      olde = Executions.getCurrent();
    ExecutionsCtrl.setCurrent(exec);
     ((ExecutionCtrl)exec).onActivate();
    try {
View Full Code Here

   * immediately. This method can only be called when processing an event.
   * It is OK to send event to component from another page as long as
   * they are in the same desktop.
   */
  public static void sendEvent(Component comp, Event event) {
    final Execution exec = Executions.getCurrent();
    final Desktop desktop = exec.getDesktop();
      //note: we don't use comp.getDesktop because 1) it may be null
      //2) it may be different from the current desktop

    event = ((DesktopCtrl)desktop).beforeSendEvent(event);
    if (event == null)
View Full Code Here

          return _areacomp;

        desktop = target.getDesktop();
      }
      if (desktop == null) {
        final Execution exec = Executions.getCurrent();
        if (exec != null)
          desktop = exec.getDesktop();
      }
      if (desktop != null)
        return _areacomp = desktop.getComponentByUuidIfAny(_area);
    }
    return _areacomp;
View Full Code Here

* @author tomyeh
* @since 5.0.0
*/
public class PageRenderer implements org.zkoss.zk.ui.sys.PageRenderer {
  public void render(Page page, Writer out) throws IOException {
    final Execution exec = Executions.getCurrent();
    final String ctl = ExecutionsCtrl.getPageRedrawControl(exec);
    boolean au = exec.isAsyncUpdate(null);
    if (!au && (page.isComplete() || "complete".equals(ctl))) {
      renderComplete(exec, page, out);
      return;
    }

    boolean pageOnly = au;
    if (!pageOnly)
      pageOnly = (exec.isIncluded() || "page".equals(ctl))
        && !"desktop".equals(ctl);

    if (pageOnly)
      renderPage(exec, page, out, au);
    else
View Full Code Here

TOP

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

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.