Package org.zkoss.zk.ui.impl

## Class SimpleDesktopCache

- java.lang.Object
- - org.zkoss.zk.ui.impl.SimpleDesktopCache

- All Implemented Interfaces:
    `java.io.Serializable`, `DesktopCache`

      public class SimpleDesktopCache
      extends java.lang.Object
      implements DesktopCache, java.io.Serializable

  A simple implementation of `DesktopCache`. It manages all desktop in a `CacheMap` instance.
  Author:
    tomyeh
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SimpleDesktopCache​(Configuration config)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addDesktop​(Desktop desktop)` | Adds a desktop to this session.
    `java.util.List<Desktop>` | `getAllDesktops()` | Returns all the desktops in this cache.
    `Desktop` | `getDesktop​(java.lang.String desktopId)` | Returns the desktop for the specified desktop ID.
    `Desktop` | `getDesktopIfAny​(java.lang.String desktopId)` | Returns the desktop for the specified desktop ID, or null if not found.
    `void` | `removeDesktop​(Desktop desktop)` | Removes a desktop from this session.
    `void` | `sessionDidActivate​(Session sess)` | Invokes `DesktopCtrl.sessionDidActivate(org.zkoss.zk.ui.Session)` for each desktops it cached.
    `void` | `sessionWillPassivate​(Session sess)` | Invokes `DesktopCtrl.sessionWillPassivate(org.zkoss.zk.ui.Session)` for each desktops it cached.
    `void` | `stop()` | Called when to stop and cleanup this cache.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleDesktopCache

          public SimpleDesktopCache​(Configuration config)

  - ### Method Detail

    - #### getDesktopIfAny

          public Desktop getDesktopIfAny​(java.lang.String desktopId)

      Description copied from interface: `DesktopCache`
      Returns the desktop for the specified desktop ID, or null if not found.
      Specified by:
        `getDesktopIfAny` in interface `DesktopCache`

    - #### getDesktop

          public Desktop getDesktop​(java.lang.String desktopId)

      Description copied from interface: `DesktopCache`
      Returns the desktop for the specified desktop ID.
      Specified by:
        `getDesktop` in interface `DesktopCache`

    - #### addDesktop

          public void addDesktop​(Desktop desktop)

      Description copied from interface: `DesktopCache`
      Adds a desktop to this session. It must be called when a desktop is created.

      Application shall never access this method.

      Specified by:
        `addDesktop` in interface `DesktopCache`

    - #### removeDesktop

          public void removeDesktop​(Desktop desktop)

      Description copied from interface: `DesktopCache`
      Removes a desktop from this session. It must be called when a desktop is remove.

      Application shall never access this method.

      Specified by:
        `removeDesktop` in interface `DesktopCache`

    - #### sessionWillPassivate

          public void sessionWillPassivate​(Session sess)

      Invokes `DesktopCtrl.sessionWillPassivate(org.zkoss.zk.ui.Session)` for each desktops it cached.
      Specified by:
        `sessionWillPassivate` in interface `DesktopCache`

    - #### sessionDidActivate

          public void sessionDidActivate​(Session sess)

      Invokes `DesktopCtrl.sessionDidActivate(org.zkoss.zk.ui.Session)` for each desktops it cached.
      Specified by:
        `sessionDidActivate` in interface `DesktopCache`

    - #### stop

          public void stop()

      Description copied from interface: `DesktopCache`
      Called when to stop and cleanup this cache. Once stopped, the caller shall not access it any more. It cannot be called other than the implementation of `DesktopCacheProvider`.
      Specified by:
        `stop` in interface `DesktopCache`

    - #### getAllDesktops

          public java.util.List<Desktop> getAllDesktops()

      Description copied from interface: `DesktopCache`
      Returns all the desktops in this cache. It is used only internally.
      Specified by:
        `getAllDesktops` in interface `DesktopCache`