Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Execution


    try {
      synchronized (_suspmutex) {
        _suspended = true;

        //Bug 1814298: need to call Execution.onDeactivate
        Execution exec = getExecution();
        if (exec != null) {
          _acted = false;
          try {
            ((ExecutionCtrl)exec).onDeactivate();
          } catch (Throwable ex) {
            log.warningBriefly("Ignored deactivate failure", ex);
          }
        }

        //let the main thread continue
        synchronized (_evtmutex) {
          _evtmutex.notify();
        }

        if (_ceased == null) _suspmutex.wait();
      }
    } finally {
      _suspmutex = null;
      _suspended = false; //just in case (such as _ceased)
    }

    if (_ceased != null)
      throw new InterruptedException(_ceased);

    //being resumed
    setup();
    Execution exec = getExecution();
    if (exec != null) {
      ((ExecutionCtrl)exec).onActivate();
      _acted = true;
    }
View Full Code Here


          resumes, getComponent(), getEvent());
        //FUTURE: how to propogate errors to the client
    }
  }
  private Execution getExecution() {
    Execution exec = _proc.getDesktop().getExecution();
    return exec != null ? exec: Executions.getCurrent();
      //just in case that the execution is dead first
  }
View Full Code Here

        if (!isIdle()) {
          final Configuration config =
            _proc.getDesktop().getWebApp().getConfiguration();
          boolean cleaned = false;
          ++_nBusyThd;
          Execution exec = null;
          try {
//            if (log.finerable()) log.finer("Processing event: "+_proc);

            Locales.setThreadLocal(_locale);
            TimeZones.setThreadLocal(_timeZone);
View Full Code Here

    if (_desktop == null) {
      log.warning("Ignored: Sever-push not started");
      return;
    }

    final Execution exec = Executions.getCurrent();
    final boolean inexec = exec != null && exec.getDesktop() == _desktop;
      //it might be caused by DesktopCache expunge (when creating another desktop)
    try {
      if (inexec && _desktop.isAlive()) //Bug 1815480: don't send if timeout
        stopClientPush();
    } finally {
View Full Code Here

  public void redraw(java.io.Writer out) throws java.io.IOException {
    final StringWriter bufout = new StringWriter();
    super.redraw(bufout);
    final StringBuffer buf = bufout.getBuffer();

    final Execution exec = Executions.getCurrent();
    if (exec != null)
      Utils.addHeaderZkTags(exec, getPage(), buf, "head");

    out.write(buf.toString());
    out.write('\n');
View Full Code Here

      wapp, sess, desktop, request, PageDefinitions.getLocator(wapp, path));

    final boolean compress = _webctx.shallCompress(request, "zul");
    final Page page = WebManager.newPage(
      wappc.getUiFactory(), ri, pagedef, response, path);
    final Execution exec = new ExecutionImpl(
      getServletContext(), request, response, desktop, page);
    final Writer out = compress ? (Writer)new StringWriter(): response.getWriter();
    wappc.getUiEngine().execNewPage(exec, pagedef, page, out);

    if (compress) {
View Full Code Here

  /*
   * Get the EntityManagers Map from Execution scope
   */
  private static Map getEmMap() {
    Execution current = Executions.getCurrent();
    Map map = (Map) current.getAttribute(JPA_EM_MAP);
    if (map == null) {
      map = new HashMap();
      Executions.getCurrent().setAttribute(JPA_EM_MAP, map);
    }
    return map;
View Full Code Here

    return em;
  }

  private static WebApp getWebApp() {
    WebApp app = null;
    final Execution exec = Executions.getCurrent();
    if (exec != null) {
      final Desktop desktop = exec.getDesktop();
      if (desktop != null) {
        app = desktop.getWebApp();
      }
    }
    return app;
View Full Code Here

    if (updateURI == null || wapp == null)
      throw new IllegalArgumentException("null");

    //Feature 1811241: we create a temporary exec (in WebManager.newDesktop),
    //so DesktopInit can access Executions.getCurrent
    final Execution exec = Executions.getCurrent();
    if (exec != null)
      ((ExecutionCtrl)exec).setDesktop(this);

    _wapp = wapp;
    _updateURI = updateURI;
    init();
    _sess = Sessions.getCurrent(); //must be the current session

    String dir = null;
    if (path != null) {
      _path = path;
      final int j = path.lastIndexOf('/');
      if (j >= 0) dir = path.substring(0, j + 1);
    } else {
      _path = "";
    }
    setCurrentDirectory(dir);
    _qs = getQueryString(request);

    if (deviceType != null && deviceType.length() != 0)
      setDeviceType(deviceType);

    final Configuration config = _wapp.getConfiguration();
    _exec = exec; //fake
    try {
      final WebAppCtrl wappc = (WebAppCtrl)_wapp;
      final DesktopCache dc = _sess != null ? wappc.getDesktopCache(_sess): null;
        //_sess is null if in a working thread
      final IdGenerator idgen = wappc.getIdGenerator();
      if (idgen != null)
        _id = idgen.nextDesktopId(this);
      if (_id == null)
        _id = nextDesktopId(dc);
      else if (idgen != null)
        ComponentsCtrl.checkUuid(_id);
      updateUuidPrefix();

      config.invokeDesktopInits(this, request); //it might throw exception
      if (exec != null && exec.isVoided()) return; //sendredirect or forward

      if (dc != null)
        dc.addDesktop(this); //add to cache after invokeDesktopInits

      final Monitor monitor = config.getMonitor();
View Full Code Here

      (TagRenderContext)exec.getAttribute(ATTR_RENDER_CONTEXT): null;
  }

  //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 {
      exec.setAttribute(Attributes.PAGE_REDRAW_CONTROL, "complete");
      renderComplete(exec, page, out);
    }
  }
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.