org.flexdock.perspective

## Class PerspectiveManager

- java.lang.Object
- - org.flexdock.perspective.PerspectiveManager

- All Implemented Interfaces:
    LayoutManager

      public class PerspectiveManager
      extends java.lang.Object
      implements LayoutManager

  Author:
    Mateusz Szczap

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_PERSISTENCE_KEY_VALUE`
    `static java.lang.String` | `EMPTY_PERSPECTIVE`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Perspective perspective)`
    `void` | `add(Perspective perspective, boolean isDefault)`
    `void` | `addListener(PerspectiveListener perspectiveListener)`
    `LayoutNode` | `createLayout(DockingPort port)`
    `Perspective` | `createPerspective(java.lang.String perspectiveId)`
    `boolean` | `display(Dockable dockable)`
    `Perspective` | `getCurrentPerspective()`
    `java.lang.String` | `getCurrentPerspectiveName()`
    `java.lang.String` | `getDefaultPersistenceKey()`
    `Perspective` | `getDefaultPerspective()`
    `DockingState` | `getDockingState(Dockable dockable)`
    `DockingState` | `getDockingState(Dockable dockable, boolean load)`
    `DockingState` | `getDockingState(java.lang.String dockable)`
    `DockingState` | `getDockingState(java.lang.String dockable, boolean load)`
    `FloatManager` | `getFloatManager()`
    `static PerspectiveManager` | `getInstance()`
    `static RootWindow` | `getMainApplicationWindow()`
    `static DockingPort` | `getMainDockingPort()`
    `static PersistenceHandler` | `getPersistenceHandler()`
    `Perspective` | `getPerspective(java.lang.String perspectiveId)`
    `PerspectiveListener[]` | `getPerspectiveListeners()`
    `Perspective[]` | `getPerspectives()`
    `static boolean` | `isRestoreFloatingOnLoad()`
    `boolean` | `load()`
    `boolean` | `load(java.lang.String persistenceKey)`
    `void` | `loadPerspective()`
    `void` | `loadPerspective(java.lang.String perspectiveId)`
    `void` | `loadPerspective(java.lang.String perspectiveId, boolean reset)`
    `void` | `loadPerspective(java.lang.String perspectiveId, java.awt.Component window)`
    `void` | `loadPerspective(java.lang.String perspectiveId, java.awt.Component window, boolean reset)`
    `void` | `loadPerspective(java.lang.String perspectiveId, DockingPort rootPort)`
    `void` | `loadPerspective(java.lang.String perspectiveId, DockingPort rootPort, boolean reset)`
    `void` | `loadPerspectiveAsDefault(java.lang.String perspectiveId)`
    `void` | `loadPerspectiveAsDefault(java.lang.String perspectiveId, boolean reset)`
    `void` | `reload()`
    `void` | `reload(java.awt.Window w)` PerspectiveManager#getMainApplicationWindow returns the first window where #getOwner == null.
    `void` | `reload(java.awt.Window w, boolean reset)`
    `void` | `remove(java.lang.String perspectiveId)`
    `void` | `removeListener(PerspectiveListener perspectiveListener)`
    `void` | `reset()`
    `void` | `reset(java.awt.Component window)`
    `void` | `reset(DockingPort rootPort)`
    `boolean` | `restore(boolean loadFromStorage)`
    `void` | `restore(java.awt.Window w)`
    `void` | `setCurrentPerspective(java.lang.String perspectiveId)`
    `void` | `setCurrentPerspective(java.lang.String perspectiveId, boolean asDefault)`
    `void` | `setDefaultPersistenceKey(java.lang.String key)`
    `void` | `setDefaultPerspective(java.lang.String perspectiveId)`
    `static void` | `setFactory(PerspectiveFactory factory)`
    `static void` | `setPersistenceHandler(PersistenceHandler handler)`
    `static void` | `setRestoreFloatingOnLoad(boolean restoreFloatingOnLoad)`
    `boolean` | `store()`
    `boolean` | `store(java.lang.String persistenceKey)`

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

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

- - ### Field Detail

    - #### EMPTY_PERSPECTIVE

          public static final java.lang.String EMPTY_PERSPECTIVE

      See Also:
        Constant Field Values

    - #### DEFAULT_PERSISTENCE_KEY_VALUE

          public static final java.lang.String DEFAULT_PERSISTENCE_KEY_VALUE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getInstance

          public static PerspectiveManager getInstance()

    - #### setFactory

          public static void setFactory(PerspectiveFactory factory)

    - #### setPersistenceHandler

          public static void setPersistenceHandler(PersistenceHandler handler)

    - #### getPersistenceHandler

          public static PersistenceHandler getPersistenceHandler()

    - #### add

          public void add(Perspective perspective)

    - #### add

          public void add(Perspective perspective,
                 boolean isDefault)

    - #### remove

          public void remove(java.lang.String perspectiveId)

    - #### getPerspective

          public Perspective getPerspective(java.lang.String perspectiveId)

    - #### createPerspective

          public Perspective createPerspective(java.lang.String perspectiveId)

    - #### getPerspectives

          public Perspective[] getPerspectives()

    - #### addListener

          public void addListener(PerspectiveListener perspectiveListener)

    - #### removeListener

          public void removeListener(PerspectiveListener perspectiveListener)

    - #### getPerspectiveListeners

          public PerspectiveListener[] getPerspectiveListeners()

    - #### setDefaultPerspective

          public void setDefaultPerspective(java.lang.String perspectiveId)

    - #### setCurrentPerspective

          public void setCurrentPerspective(java.lang.String perspectiveId)

    - #### getCurrentPerspectiveName

          public java.lang.String getCurrentPerspectiveName()

    - #### setCurrentPerspective

          public void setCurrentPerspective(java.lang.String perspectiveId,
                                   boolean asDefault)

    - #### getDefaultPerspective

          public Perspective getDefaultPerspective()

    - #### getCurrentPerspective

          public Perspective getCurrentPerspective()

    - #### getDockingState

          public DockingState getDockingState(Dockable dockable)

      Specified by:
        `getDockingState` in interface `LayoutManager`

    - #### getDockingState

          public DockingState getDockingState(java.lang.String dockable)

      Specified by:
        `getDockingState` in interface `LayoutManager`

    - #### getDockingState

          public DockingState getDockingState(Dockable dockable,
                                     boolean load)

    - #### getDockingState

          public DockingState getDockingState(java.lang.String dockable,
                                     boolean load)

    - #### getFloatManager

          public FloatManager getFloatManager()

      Specified by:
        `getFloatManager` in interface `LayoutManager`

    - #### reset

          public void reset()

    - #### reset

          public void reset(java.awt.Component window)

    - #### reset

          public void reset(DockingPort rootPort)

    - #### reload

          public void reload(java.awt.Window w)

      PerspectiveManager#getMainApplicationWindow returns the first window where #getOwner == null. This is especially a problem for apps with multiple frames. To display a perspective for a specified window it is highly recommended to use #reload(Window w) instead of #reload() which is the same as DockingManager#restoreLayout(). You can use #restoreLayout when the application does not need multiple independent docking windows.

    - #### reload

          public void reload(java.awt.Window w,
                    boolean reset)

    - #### restore

          public void restore(java.awt.Window w)
                       throws java.io.IOException,
                              PersistenceException

      Throws:
        `java.io.IOException`
        `PersistenceException`

    - #### reload

          public void reload()

    - #### loadPerspective

          public void loadPerspective()

    - #### loadPerspectiveAsDefault

          public void loadPerspectiveAsDefault(java.lang.String perspectiveId)

    - #### loadPerspectiveAsDefault

          public void loadPerspectiveAsDefault(java.lang.String perspectiveId,
                                      boolean reset)

    - #### loadPerspective

          public void loadPerspective(java.lang.String perspectiveId)

    - #### loadPerspective

          public void loadPerspective(java.lang.String perspectiveId,
                             boolean reset)

    - #### loadPerspective

          public void loadPerspective(java.lang.String perspectiveId,
                             java.awt.Component window)

    - #### loadPerspective

          public void loadPerspective(java.lang.String perspectiveId,
                             java.awt.Component window,
                             boolean reset)

    - #### loadPerspective

          public void loadPerspective(java.lang.String perspectiveId,
                             DockingPort rootPort)

    - #### loadPerspective

          public void loadPerspective(java.lang.String perspectiveId,
                             DockingPort rootPort,
                             boolean reset)

    - #### createLayout

          public LayoutNode createLayout(DockingPort port)

      Specified by:
        `createLayout` in interface `LayoutManager`

    - #### display

          public boolean display(Dockable dockable)

      Specified by:
        `display` in interface `LayoutManager`

    - #### store

          public boolean store()
                        throws java.io.IOException,
                               PersistenceException

      Specified by:
        `store` in interface `LayoutManager`
      Throws:
        `java.io.IOException`
        `PersistenceException`

    - #### store

          public boolean store(java.lang.String persistenceKey)
                        throws java.io.IOException,
                               PersistenceException

      Specified by:
        `store` in interface `LayoutManager`
      Throws:
        `java.io.IOException`
        `PersistenceException`

    - #### load

          public boolean load()
                       throws java.io.IOException,
                              PersistenceException

      Specified by:
        `load` in interface `LayoutManager`
      Throws:
        `java.io.IOException`
        `PersistenceException`

    - #### load

          public boolean load(java.lang.String persistenceKey)
                       throws java.io.IOException,
                              PersistenceException

      Specified by:
        `load` in interface `LayoutManager`
      Throws:
        `java.io.IOException`
        `PersistenceException`

    - #### isRestoreFloatingOnLoad

          public static boolean isRestoreFloatingOnLoad()

    - #### setRestoreFloatingOnLoad

          public static void setRestoreFloatingOnLoad(boolean restoreFloatingOnLoad)

    - #### getMainApplicationWindow

          public static RootWindow getMainApplicationWindow()

    - #### getMainDockingPort

          public static DockingPort getMainDockingPort()

    - #### restore

          public boolean restore(boolean loadFromStorage)
                          throws java.io.IOException,
                                 PersistenceException

      Specified by:
        `restore` in interface `LayoutManager`
      Throws:
        `java.io.IOException`
        `PersistenceException`

    - #### getDefaultPersistenceKey

          public java.lang.String getDefaultPersistenceKey()

      Specified by:
        `getDefaultPersistenceKey` in interface `LayoutManager`

    - #### setDefaultPersistenceKey

          public void setDefaultPersistenceKey(java.lang.String key)

      Specified by:
        `setDefaultPersistenceKey` in interface `LayoutManager`