Package org.zkoss.zk.ui

Examples of org.zkoss.zk.ui.Desktop


    final Execution exec = Executions.getCurrent();
    if (exec == null)
      throw new IllegalStateException("execution required");

    final Desktop desktop = exec.getDesktop();
    synchronized (_dts) {
      DesktopThread dtthd = (DesktopThread)_dts.get(desktop);
      return dtthd != null && dtthd.isSubscribed(listener);
    }
  }
View Full Code Here


    final Execution exec = Executions.getCurrent();
    if (exec == null)
      throw new IllegalStateException("execution required");

    final Desktop desktop = exec.getDesktop();
    synchronized (_dts) {
      final DesktopThread dtthd = (DesktopThread)_dts.get(desktop);
      if (dtthd != null && dtthd.unsubscribe(listener)) {
        if (dtthd.isIdle()) {
          dtthd.cease();
View Full Code Here

    final boolean bAppScope = EventQueues.APPLICATION.equals(scope);
    if (bAppScope || EventQueues.SESSION.equals(scope)) {
      return lookup0(name, bAppScope ?
        (Scope)exec.getDesktop().getWebApp(): exec.getSession(), autoCreate);
    } else  if (EventQueues.DESKTOP.equals(scope)) {
      final Desktop desktop = exec.getDesktop();
      Map eqs = (Map)desktop.getAttribute(ATTR_EVENT_QUEUES);
      if (eqs == null)
        desktop.setAttribute(ATTR_EVENT_QUEUES, eqs = new HashMap(4));

      EventQueue eq = (EventQueue)eqs.get(name);
      if (autoCreate && eq == null)
        eqs.put(name, eq = new DesktopEventQueue());
      return eq;
View Full Code Here

  private static final String DESKTOP_SCOPE = "ZK_SPRING_DESKTOP_SCOPE";

  public Object get(String name, ObjectFactory<?> objectFactory) {
    final Execution exec = Executions.getCurrent();
    if (exec != null) {
      final Desktop desktop = exec.getDesktop();
      Map desktopScope = (Map) desktop.getAttribute(DESKTOP_SCOPE);
      if (desktopScope == null) {
        desktop.setAttribute(DESKTOP_SCOPE, desktopScope = new HashMap());
      }
      Object scopedObject = desktopScope.get(name);
      if (scopedObject == null) {
        scopedObject = objectFactory.getObject();
        desktopScope.put(name, scopedObject);
View Full Code Here

  }

  public String getConversationId() {
    final Execution exec = Executions.getCurrent();
    if (exec != null) {
      final Desktop desktop = exec.getDesktop();
      if (desktop != null) {
        return desktop.getId();
      }
    }
    return null;
  }
View Full Code Here

  }

  public Object remove(String name) {
    final Execution exec = Executions.getCurrent();
    if (exec != null) {
      final Desktop desktop = exec.getDesktop();
      final Map desktopScope = (Map) desktop.getAttribute(DESKTOP_SCOPE);
      return (desktopScope != null) ? desktopScope.remove(name) : null;
    }
    throw new IllegalStateException("Unable to get desktop scope bean: "+name+". Do you access it in ZK event listener?");
  }
View Full Code Here

  }
 
  //return a Map of (fragment id, associated component) on desktop
  private Map prepareDesktopFragmentMap() {
    final Map fragmentMap = new HashMap();
    final Desktop desktop = Executions.getCurrent().getDesktop();
    final Collection pages = desktop.getPages();
    for (final Iterator it=pages.iterator(); it.hasNext();) {
      final Page page = (Page) it.next();
      prepareFragmentMap(fragmentMap, page.getRoots());
    }
    return fragmentMap;
View Full Code Here

    if (_webApp == null) {
      final WebManager webman = WebManager.getWebManager(((HttpServletRequest) request).getSession(false).getServletContext());
      _webApp = webman.getWebApp();
    }
   
        final Desktop desktop = (Desktop) request.getAttribute(ATTR_DESKTOP);
        if (desktop == null) {
          final String dtid = request.getParameter("dt");
          if (dtid != null) {
            final HttpSession hsess = ((HttpServletRequest)request).getSession(false);
            if (hsess != null) {
              if (hsess.getAttribute(dtid) != null) { //with the preset token
                hsess.removeAttribute(dtid);
                final Session sess = ((WebAppCtrl)_webApp).getSessionCache().get(hsess);
                if (sess != null) {
                  final DesktopCache cache = ((WebAppCtrl)_webApp).getDesktopCache(sess);
                  if (cache != null) {
                    final Desktop olddesktop = cache.getDesktopIfAny(dtid);
                    if (olddesktop != null) {
                      //set ATTR_DESKTOP, so will reuse the old desktop
                      request.setAttribute(ATTR_DESKTOP, olddesktop);
                      //cleanup the "au" channel to avoid get the
                      //    residue of the previous desktop operation
View Full Code Here

  }
 
  public Desktop newDesktop(RequestInfo ri, String updateURI, String path) {
    final ServletRequest request = (ServletRequest)ri.getNativeRequest();
    final String url = Https.getOriginFullRequest(request);
    final Desktop desktop = super.newDesktop(ri, updateURI, path);
    desktop.setAttribute(DESKTOP_URL, url);
    return desktop;
  }
View Full Code Here

    win.setAttribute(RequestContextELResolver.REQUEST_CONTEXT_VARIABLE_NAME,
        exec.getAttributes().get(RequestContextELResolver.REQUEST_CONTEXT_VARIABLE_NAME), false);
  }
 
  private static void storeFlowContextInPages(Execution exec) {
    final Desktop desktop = exec.getDesktop();
    final Collection pages= desktop.getPages();
    for (final Iterator it = pages.iterator(); it.hasNext();) {
      final Page page = (Page) it.next();
      page.setAttribute(FLOW_ID, exec.getAttribute(FLOW_ID));
      page.setAttribute(FLOW_EXECUTION_KEY, exec.getAttribute(FLOW_EXECUTION_KEY));
      page.setAttribute(FLOW_REQUEST_URI, exec.getAttribute(FLOW_REQUEST_URI));
View Full Code Here

TOP

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

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.