Class DockingManager

java.lang.Object
org.flexdock.docking.DockingManager
All Implemented Interfaces:
DockingConstants

public class DockingManager extends Object implements DockingConstants
This class is used as a public facade into the framework docking system. It provides a straightforward public API for managing and manipulating the various different subcomponents that make up the docking framework through a single class. DockingManager cannot be instantiated. Rather, its methods are accessed statically from within application code and it generally defers processing to a set of abstract handlers hidden from the application layer. Among DockingManager's responsibilities are as follows:
Maintaining a component repository.
All Dockables and DockingPorts are cached within an and accessible through and internal registry.
Maintaining framework state.
DockingManager provides APIs for managing various different global framework settings, including application-key, floating support, auto-persistence, LayoutManagers, and MinimizationManagers.
Behavioral auto-configuration.
DockingManager automatically adds and removes necessary event listeners to enable/disable drag-to-dock behavior as components are registered and unregistered.
Programmatic access to docking operations.
DockingManager provides public APIs for programmatically dock, undock, minimize, persist, and load Dockables from storage.
Author:
Christopher Butler
  • Field Details

  • Method Details

    • addDragSource

      public static void addDragSource(Dockable dockable, Component dragSrc)
    • close

      public static void close(Dockable dockable)
      Convenience method that removes the specified Dockable from the layout. If the Dockableis embedded within the main application frame or a floating dialog, it is removed from the container hierarchy. If the Dockable is presently minimized, it is removed from the current minimization manager. If the Dockable is already "closed" or is null, no operation is performed. "Closing" a Dockable only removes it from the visual layout. It does not remove it from the internal Dockable registry and all underlying DockingState information remains consistent so that the Dockable may later be restored to its original location within the application.
      Parameters:
      dockable - the Dockable to be closed.
    • dock

      public static boolean dock(Component dockable, DockingPort port)
      Docks the specified Component into the CENTER region of the specified DockingPort. If the DockingManager finds a valid Dockable instance mapped to the specified Component, the Dockable will be docked into the DockingPort. If the Component or DockingPort is null, or a valid Dockable cannot be found for the specified Component, this method returns false. Otherwise, this method returns true if the docking operation was successful and false if the docking operation cannot be completed. This method defers processing to dock(Component dockable , DockingPort port, String region).
      Parameters:
      dockable - the Component to be docked.
      port - the DockingPort into which the specified Component will be docked.
      Returns:
      true if the docking operation was successful, false otherwise.
      See Also:
    • dock

      public static boolean dock(Component dockable, DockingPort port, String region)
      Docks the specified Component into the supplied region of the specified DockingPort. If the DockingManager finds a valid Dockable instance mapped to the specified Component, the Dockable will be docked into the DockingPort. If the Component or DockingPort is null, or a valid Dockable cannot be found for the specified Component, this method returns false. Otherwise, this method returns true if the docking operation was successful and false if the docking operation cannot be completed. This method defers processing to dock(Dockable dockable, DockingPort port, String region).
      Parameters:
      dockable - the Component to be docked.
      port - the DockingPort into which the specified Component will be docked.
      region - the region into which to dock the specified Component
      Returns:
      true if the docking operation was successful, false if the docking operation cannot be completed.
      See Also:
    • dock

      public static boolean dock(Dockable dockable, DockingPort port, String region)
      Docks the specified Dockable into the supplied region of the specified DockingPort. If the Dockable or DockingPort is null, this method returns false. Otherwise, this method returns true if the docking operation was successful and false if the docking operation cannot be completed. This method determines the DockingStrategy to be used for the specified DockingPort and defers processing to the DockingStrategy. This method's return value will be based upon the DockingStrategy implementation and is subject to conditions such as whether the supplied region is deemed valid, whether the DockingStrategy allows this particular Dockable to be docked into the supplied region of the specified DockingPort, and so on. The DockingStrategy used is obtained by a call to getDockingStrategy(Object obj) and may be controlled via setDockingStrategy(Class c, DockingStrategy strategy), supplying a DockingPort implementation class and a customized DockingStrategy.
      Parameters:
      dockable - the Dockable to be docked.
      port - the DockingPort into which the specified Component will be docked.
      region - the region into which to dock the specified Dockable
      Returns:
      true if the docking operation was successful, false otherwise.
      See Also:
    • dock

      public static boolean dock(Component dockable, Component parent)
      Docks the specified Component relative to another already-docked Component in the CENTER region. Valid Dockable instances are looked up for both Component parameters and processing is deferred to dock(Dockable dockable, Dockable parent). If a valid Dockable cannot be resolved for either Component, then this method returns false. The "parent" Dockable must currently be docked. If not, this method will return false. Otherwise, its parent DockingPort will be resolved and the new Dockable will be docked into the DockingPort relative to the "parent" Dockable.
      Parameters:
      dockable - the Component to be docked
      parent - the Component used as a reference point for docking
      Returns:
      true if the docking operation was successful; false otherwise.
      See Also:
    • dock

      public static boolean dock(Dockable dockable, Dockable parent)
      Docks the specified Dockable relative to another already-docked Dockable in the CENTER region. The "parent" Dockable must currently be docked. If not, this method will return false. Otherwise, its parent DockingPort will be resolved and the new Dockable will be docked into the DockingPort relative to the "parent" Dockable. This method defers processing to dock(Dockable dockable, Dockable parent, String region) and returns false if any of the input parameters are null.
      Parameters:
      dockable - the Dockable to be docked
      parent - the Dockable used as a reference point for docking
      Returns:
      true if the docking operation was successful; false otherwise.
      See Also:
    • dock

      public static boolean dock(Component dockable, Component parent, String region)
      Docks the specified Component relative to another already-docked Component in the specified region. Valid Dockable instances will be looked up for each of the Component parameters. If a valid Dockable is not found for either Component, then this method returns false. The "parent" Dockable must currently be docked. If not, this method will return false. Otherwise, its parent DockingPort will be resolved and the new Dockable will be docked into the DockingPort relative to the "parent" Dockable. This method defers processing to dock(Component dockable, Component parent, String region, float proportion) and returns false if any of the input parameters are null. If the specified region is other than CENTER, then a split layout should result. This method supplies a split proportion of 0.5F, resulting in equal distribution of space between the dockable and parent parameters if docking is successful.
      Parameters:
      dockable - the Component to be docked
      parent - the Component used as a reference point for docking
      region - the relative docking region into which dockable will be docked
      Returns:
      true if the docking operation was successful; false otherwise.
      See Also:
    • dock

      public static boolean dock(Dockable dockable, Dockable parent, String region)
      Docks the specified Dockable relative to another already-docked Dockable in the specified region. The "parent" Dockable must currently be docked. If not, this method will return false. Otherwise, its parent DockingPort will be resolved and the new Dockable will be docked into the DockingPort relative to the "parent" Dockable. This method defers processing to dock(Dockable dockable, Dockable parent, String region, float proportion) and returns false if any of the input parameters are null. If the specified region is other than CENTER, then a split layout should result. This method supplies a split proportion of 0.5F, resulting in equal distribution of space between the dockable and parent parameters if docking is successful.
      Parameters:
      dockable - the Dockable to be docked
      parent - the Dockable used as a reference point for docking
      region - the docking region into which dockable will be docked
      Returns:
      true if the docking operation was successful; false otherwise.
      See Also:
    • dock

      public static boolean dock(Component dockable, Component parent, String region, float proportion)
      Docks the specified Component relative to another already-docked Component in the specified region with the specified split proportion. Valid Dockable instances will be looked up for each of the Component parameters. If a valid Dockable is not found for either Component, then this method returns false. The "parent" Dockable must currently be docked. If not, this method will return false. Otherwise, its parent DockingPort will be resolved and the new Dockable will be docked into the DockingPort relative to the "parent" Dockable. If the specified region is CENTER, then the proportion parameter is ignored. Otherwise, a split layout should result with the proportional space specified in the proportion parameter allotted to the dockable argument. This method defers processing to dock(Dockable dockable, Dockable parent, String region, float proportion).
      Parameters:
      dockable - the Component to be docked
      parent - the Component used as a reference point for docking
      region - the relative docking region into which dockable will be docked
      proportion - the proportional space to allot the dockable argument if the docking operation results in a split layout.
      Returns:
      true if the docking operation was successful; false otherwise.
    • dock

      public static boolean dock(Dockable dockable, Dockable parent, String region, float proportion)
      Docks the specified Dockable relative to another already-docked Dockable in the specified region with the specified split proportion. The "parent" Dockable must currently be docked. If not, this method will return false. Otherwise, its parent DockingPort will be resolved and the new Dockable will be docked into the DockingPort relative to the "parent" Dockable. If the specified region is CENTER, then the proportion parameter is ignored. Otherwise, a split layout should result with the proportional space specified in the proportion parameter allotted to the dockable argument.
      Parameters:
      dockable - the Dockable to be docked
      parent - the Dockable used as a reference point for docking
      region - the docking region into which dockable will be docked
      proportion - the proportional space to allot the dockable argument if the docking operation results in a split layout.
      Returns:
      true if the docking operation was successful; false otherwise.
    • isDocked

      public static boolean isDocked(Component component)
      Indicates whether the specified Component is currently docked. This method looks up a parent DockingPort for the specified Component via a call to getDockingPort(Component dockable). This method returns true if a parent DockingPort is found and false if no parent DockingPort is present. This method returns false if the Component parameter is null.
      Parameters:
      component - the Component whose docking status is to be examined
      Returns:
      true if the Component is currently docked; otherwise false.
    • isDocked

      public static boolean isDocked(Dockable dockable)
      Indicates whether the specified Dockable is currently docked. This method looks up a parent DockingPort for the specified Dockable via a call to getDockingPort(Dockable dockable). This method returns true if a parent DockingPort is found and false if no parent DockingPort is present. This method returns false if the Dockable parameter is null.
      Parameters:
      dockable - the Dockable whose docking status is to be examined
      Returns:
      true if the Dockable is currently docked; otherwise false.
    • isDocked

      public static boolean isDocked(DockingPort dockingPort, Dockable dockable)
      Checks whether a supplied Dockable is docked within a supplied DockingPort instance. Returns true if the DockingPort contains the specified Dockable; false otherwise. This method returns false if either of the input parameters are null.
      Parameters:
      dockingPort - the DockingPort to be tested
      dockable - the Dockable instance to be examined
      Returns:
      true if the supplied DockingPort contains the specified Dockable; false otherwise.
    • isFloatingEnabled

      public static boolean isFloatingEnabled()
      Indicates whether global floating support is currently enabled. Defers processing to FloatPolicyManager.isGlobalFloatingEnabled().
      Returns:
      true if global floating support is enabled, false otherwise.
      See Also:
    • isSingleTabsAllowed

      public static boolean isSingleTabsAllowed()
      Indicates whether tabbed layouts are supported by default for DockingPorts with a single Dockable in the CENTER region. This is a global default setting and applies to any DockingPort} that does not have a specific contradictory local setting.

      This method defers processing to org.flexdock.docking.props.PropertyManager.getDockingPortRoot(). As such, there are multiple "scopes" at which this property may be overridden.

      Returns:
      true if the default setting for DockingPorts allows a tabbed layout for a single Dockable in the CENTER region; false otherwise.
      See Also:
    • isValidDockingRegion

      public static boolean isValidDockingRegion(String region)
      Indicates whether the supplied parameter is considered a valid docking region. Valid values are those defined in DockingConstants and include NORTH_REGION, SOUTH_REGION, EAST_REGION, WEST_REGION, and CENTER_REGION. This method returns true if the supplied parameter is equal to one of these values.
      Parameters:
      region - the region value to be tested
      Returns:
      true if the supplied parameter is a valid docking region; false otherwise.
    • registerDockable

      public static Dockable registerDockable(Component comp)
      Creates, registers, and returns a Dockable for the specified Component. If the specified Component implements the Dockable interface, then this method dispatches to registerDockable(Dockable dockable). Otherwise, this method dispatches to registerDockable(Component comp, String tabText).

      This method attempts to resolve an appropriate value for tabText by calling getName() on the specified Component. If the resolved value is null or empty, then the value "null" is used.

      If comp is null, no exception is thrown and no action is performed.

      Parameters:
      comp - the target component for the Dockable.
      Returns:
      the Dockable that has been registered for the supplied Component
      See Also:
    • registerDockable

      public static Dockable registerDockable(Component comp, String tabText)
      Creates a Dockable for the specified Component and dispatches to registerDockable(Dockable init). If comp is null, no exception is thrown and no action is performed.
      Parameters:
      comp - the target component for the Dockable, both drag-starter and docking source
      tabText - the description of the docking source. Used as the tab-title of docked in a tabbed pane
      Returns:
      the Dockable that has been registered for the supplied Component
      See Also:
    • registerDockable

      public static Dockable registerDockable(Dockable dockable)
      Registers and initializes the specified Dockable. All Dockables managed by the framework must, at some point, be registered via this method. This method adds the Dockable to the internal registry, allowing querying by ID and Component. Drag listeners are added to the Dockable to enable drag-n-drop docking support. Docking properties are also initialized for the Dockable. This method fires a RegistrationEvent once the Dockable has been registered. If the Dockable is null, no Exception is thrown and no action is taken. The Dockable returned by this method will be the same object passed in as an argument.
      Parameters:
      dockable - the Dockable that is being registered.
      Returns:
      the Dockable that has been registered.
      See Also:
    • unregisterDockable

      public static void unregisterDockable(Component comp)
    • unregisterDockable

      public static void unregisterDockable(String dockingId)
    • unregisterDockable

      public static void unregisterDockable(Dockable dockable)
    • removeDragListeners

      public static void removeDragListeners(Component comp)
      Removes the event listeners that manage drag-n-drop docking operations from the specified Component. If the specific listeners are not present, then no action is taken. Drag listeners used by the docking system are of type org.flexdock.docking.drag.DragManager.
      Parameters:
      comp - the Component from which to remove drag listeners.
      See Also:
    • display

      public static boolean display(Dockable dockable)
      Displays the specified Dockable in the application's docking layout. If the Dockable has not previously been docked, a suitable location is determined within the layout and the Dockable is docked to that location. If the Dockable has previously been docked within the layout and subsequently removed, as with a call to DockingManager.close(), the Dockable will be restored to its prior state within the layout. This method defers processing to the display(Dockable dockable) method for the currently installed org.flexdock.docking.state.LayoutManager. The LayoutManager implementation is responsible for handling the semantics of determining an initial docking location or restoring a Dockable to its previous layout state. If the Dockable parameter is null, no Exception is thrown and no action is taken.
      Parameters:
      dockable - the Dockable to be displayed.
      Returns:
      true if the Dockable was successfully displayed; false otherwise.
      See Also:
    • display

      public static boolean display(String dockable)
      Displays the Dockable with the specified ID within the application's docking layout. A valid Dockable is looked up for the supplied ID. If none is found, this method returns false. Otherwise, processing is dispatched to display(Dockable dockable). If the Dockable has not previously been docked, a suitable location is determined within the layout and the Dockable is docked to that location. If the Dockable has previously been docked within the layout and subsequently removed, as with a call to DockingManager.close(), the Dockable will be restored to its prior state within the layout. This method defers processing to the display(Dockable dockable) method for the currently installed org.flexdock.docking.state.LayoutManager. The LayoutManager implementation is responsible for handling the semantics of determining an initial docking location or restoring a Dockable to its previous layout state. If the Dockable parameter is null, no Exception is thrown and no action is taken.
      Parameters:
      dockable - the ID of the Dockable to be displayed.
      Returns:
      true if the Dockable was successfully displayed; false otherwise.
      See Also:
    • getDockingStrategy

      public static DockingStrategy getDockingStrategy(Object obj)
      Returns the DockingStrategy associated with the Class of the Object parameter. This method returns null if the parameter is null. Otherwise, the method retrieves the Object's Class and dispatches to getDockingStrategy(Class classKey).

      DockingStrategy association follows a strict inheritance chain using org.flexdock.util.ClassMapping. If a mapping for obj.getClass() is not found, then the superclass is tested, and so on until java.lang.Object is reached. Thus, if a DockingStrategy mapping of Foo exists for class Bar, and class Baz extends Bar, then calling this method for an instance of Baz will return an instance of Foo. The inheritance chain is strict in the sense that only superclasses are checked. Implemented interfaces are ignored.

      If a class association is never found, then an instance of DefaultDockingStrategy is returned.

      Parameters:
      obj - the object whose DockingStrategy association we wish to test
      Returns:
      the DockingStrategy associated with the Class type of the Object parameter.
      See Also:
    • getDockingStrategy

      public static DockingStrategy getDockingStrategy(Class classKey)
      Returns the DockingStrategy associated with specified Class. This method returns null if the parameter is null.

      DockingStrategy association follows a strict inheritance chain using org.flexdock.util.ClassMapping. If a mapping for classKey is not found, then the superclass is tested, and so on until java.lang.Object is reached. Thus, if a DockingStrategy mapping of Foo exists for class Bar, and class Baz extends Bar, then calling this method for class Baz will return an instance of Foo. The inheritance chain is strict in the sense that only superclasses are checked. Implemented interfaces are ignored.

      If a class association is never found, then an instance of DefaultDockingStrategy is returned.

      Parameters:
      classKey - the Class whose DockingStrategy association we wish to test
      Returns:
      the DockingStrategy associated with the specified Class.
      See Also:
    • getDockingWindows

      public static RootWindow[] getDockingWindows()
      Returns an array of RootWindows known to the docking framework that contain DockingPorts. Any Frame, Applet, Dialog, or Window that has a DockingPort added as a descendent Component will automatically have an org.flexdock.util.RootWindow wrapper instance associated with it. This method will return an array of all known RootWindows that contain DockingPorts. Ordering of the array may be based off of a java.util.Set and is not guaranteed.
      Returns:
      an array of all known RootWindows that contain DockingPorts
      See Also:
    • getDockingPort

      public static DockingPort getDockingPort(String portId)
      Returns the DockingPort with the specified ID. If the portId parameter is null, or a DockingPort with the specified ID is not found, a null reference is returned. This method internally dispatches to org.flexdock.docking.event.hierarchy.DockingPortTracker.findById(String portId). portId should match the value returned by a DockingPort's getPersistentId() method.
      Parameters:
      portId - the ID of the DockingPort to be looked up
      Returns:
      the DockingPort with the specified ID
      See Also:
    • getMainDockingPort

      public static DockingPort getMainDockingPort(Component comp)
      Returns the "main" DockingPort within the application window containing the specified Component. Just as desktop applications will tend to have a "main" application window, perhaps surrounded with satellite windows or dialogs, the "main" DockingPort within a given window will be considered by the application developer to contain the primary docking layout used by the enclosing window.

      The Component parameter may or may not be a root window container. If not, the ancestor window of comp is determined and a set of docking ports encapsulated by a RootDockingPortInfo instance is returned by a call to getRootDockingPortInfo(Component comp). The resolved RootDockingPortInfo instance's main DockingPort is returned via its method getMainPort().

      By default, the "main" DockingPort assigned to any RootDockingPortInfo instance associated with a window will happen to be the first root DockingPort detected for that window. In essence, the default settings make this method identical to getRootDockingPort(Component comp). This, however, may be altered by RootDockingPortInfo's setMainPort(String portId) method based upon the needs of the application developer. In contrast, getMainDockingPort(Component comp) will always return the first root DockingPort found within a window.

      If comp is null or the root window cannot be resolved, then this method returns a null reference. A null reference is also returned if the root window does not contain any DockingPorts.

      Parameters:
      comp - the Component whose root window will be checked for a main DockingPort
      Returns:
      the main DockingPort within the root window that contains comp
      See Also:
    • getRootDockingPort

      public static DockingPort getRootDockingPort(Component comp)
      Returns the first root DockingPort found within the application window containing the specified Component. A "root" DockingPort is a DockingPort embedded within a window/frame/applet/dialog that is not nested within any other parent DockingPorts. The Component parameter may or may not be a root window container itself. If not, the root window containing comp is resolved and the first root DockingPort found within it is returned. This method defers actual processing to org.flexdock.docking.event.hierarchy.DockingPortTracker.findByWindow(Component comp).

      If comp is null or the root window cannot be resolved, then this method returns a null reference. A null reference is also returned if the root window does not contain any DockingPorts.

      This method differs from getMainDockingPort(Component comp) in that the "main" DockingPort for a given window is configurable by the application developer, whereas this method will always return the "first" DockingPort found within the window. However, if the "main" DockingPort has not been manually configured by the application developer, then this method and getMainDockingPort(Component comp) will exhibit identical behavior.

      Parameters:
      comp - the Component whose root window will be checked for a root DockingPort
      Returns:
      the first root DockingPort found within the root window that contains comp
      See Also:
    • getRootDockingPortInfo

      public static RootDockingPortInfo getRootDockingPortInfo(Component comp)
      Returns the RootDockingPortInfo instance associated with the root window containing the specified Component. The Component parameter may or may not be a root window container itself. If not, the root window containing comp is resolved and the RootDockingPortInfo instance associated with the window is returned. RootDockingPortInfo will contain information regarding all of the "root" DockingPorts embedded within a root window where a "root" DockingPort is any DockingPort embedded within the window that does not have any other DockingPort ancestors in it's container hierarchy.

      If comp is null or the root window cannot be resolved, then this method returns a null reference. A null reference is also returned if the root window does not contain any DockingPorts.

      This method dispatches internally to org.flexdock.docking.event.hierarchy.DockingPortTracker.getRootDockingPortInfo(Component comp).

      Parameters:
      comp - the Component whose root window will be checked for an associated RootDockingPortInfo.
      Returns:
      the RootDockingPortInfo instance associated with the root window containing comp.
      See Also:
    • storeLayoutModel

      public static boolean storeLayoutModel() throws IOException, PersistenceException
      Sends the application's current layout model to external storage. This method defers processing to the currently installed org.flexdock.docking.state.LayoutManager by invoking its store() method. If there is no LayoutManager installed, then this method returns false.

      The layout model itself, along with storage mechanism, is abstract and dependent upon the particular LayoutManager implementation. As such, it may be possible that the LayoutManager is unable to persist the current layout state for non-Exceptional reasons. This method returns true if the layout model was successfully stored and false if the layout model could not be stored under circumstances that do not generate an Exception (for instance, if there is no persistence implementation currently installed). If a problem occurs during the persistence process, an IOException is thrown.

      Returns:
      true if the current layout model was succesfully stored, false otherwise.
      See Also:
    • loadLayoutModel

      public static boolean loadLayoutModel() throws IOException, PersistenceException
      Loads a previously stored layout model into the currently installed LayoutManager. This method defers processing to loadLayoutModel(boolean restore) with an argument of false to indicate that the stored data model should merely be loaded into memory and the LayoutManager should not attempt to subsequently restore the application view by synchronizing it against the newly loaded data model.

      The layout model itself, along with storage mechanism, is abstract and dependent upon the particular LayoutManager implementation. As such, it may be possible that the LayoutManager is unable to load the previous layout state for non-Exceptional reasons. This method returns true if the layout model was successfully loaded and false if the layout model could not be loaded under circumstances that do not generate an Exception (for instance, if there was no previous layout model found in storage). If a problem occurs during the loading process, an IOException is thrown.

      Returns:
      true if the current layout model was succesfully loaded, false otherwise.
      See Also:
    • loadLayoutModel

      public static boolean loadLayoutModel(boolean restore) throws IOException, PersistenceException
      Loads a previously stored layout model into the currently installed LayoutManager and attempts to synchronize the application view with the newly loaded layout model if the restore parameter is true. If there is no currently installed LayoutManager, then this method returns false. If the restore parameter is true, then this method defers processing to restoreLayout(boolean loadFromStorage) with an argument of true. Otherwise, this method defers processing to the currently installed org.flexdock.docking.state.LayoutManager by invoking its load() method.

      The layout model itself, along with storage mechanism, is abstract and dependent upon the particular LayoutManager implementation. As such, it may be possible that the LayoutManager is unable to load the previous layout state for non-Exceptional reasons. This method returns true if the layout model was successfully loaded and false if the layout model could not be loaded under circumstances that do not generate an Exception (for instance, if there was no previous layout model found in storage). If a problem occurs during the loading process, an IOException is thrown.

      Returns:
      true if the current layout model was succesfully loaded, false otherwise.
      See Also:
    • restoreLayout

      public static boolean restoreLayout()
      Synchronizes the application view with the current in-memory layout model. This method defers processing to restoreLayout(boolean loadFromStorage) with an argument of false. This instructs the currently installed LayoutManager to restore the application view to match the current in-memory layout model without reloading from storage prior to restoration. This method is useful for developers who choose to construct a layout model programmatically and wish to "commit" it to the application view, restoring their own in-memory layout model rather than a model persisted in external storage.

      If there is no LayoutManager currently installed, then this method returns false.

      Returns:
      true if the in-memory layout model was properly restored to the application view, false otherwise.
      See Also:
    • restoreLayout

      public static boolean restoreLayout(boolean loadFromStorage) throws IOException, PersistenceException
      Synchronizes the application view with the current in-memory layout model. This method defers processing to the currently installed org.flexdock.docking.state.LayoutManager by invoking its restore(boolean loadFromStorage) method. If there is no LayoutManager currently installed, then this method returns false.

      If the loadFromStorage parameter is true, then the LayoutManager is instructed to load any persisted layout model from external storage into memory before synchronizing the application view. If a problem occurs while loading from exernal storage, this method throws an IOException.

      Parameters:
      loadFromStorage - instructs whether to load any layout model from external storage into memory before synchronizing the application view.
      Returns:
      true if the in-memory layout model was properly restored to the application view, false otherwise.
      See Also:
    • getDockingPort

      public static DockingPort getDockingPort(Component dockable)
      Returns the DockingPort that contains the specified Component. If the Component is null, then a null reference is returned.

      This method will only return the immediate parent DockingPort of the specified Component This means that the DockingPort returned by this method will not only be an ancestor Container of the specified Component, but invoking its isParentDockingPort(Component comp) with the specified Component will also return true. If both of these conditions cannot be satisfied, then this method returns a null reference.

      Parameters:
      dockable - the Component whose parent DockingPort is to be returned.
      Returns:
      the imediate parent DockingPort that contains the specified Component.
    • getDockingPort

      public static DockingPort getDockingPort(Dockable dockable)
      Returns the DockingPort that contains the specified Dockable. If the Dockable is null, then a null reference is returned.

      This method will only return the immediate parent DockingPort of the specified Dockable This means that a check is performed for the Component returned by the Dockable's getComponent() method. The DockingPort returned by this method will not only be an ancestor Container of this Component, but invoking the DockingPort's isParentDockingPort(Component comp) with the this Component will also return true. If both of these conditions cannot be satisfied, then this method returns a null reference.

      Parameters:
      dockable - the Dockable whose parent DockingPort is to be returned.
      Returns:
      the imediate parent DockingPort that contains the specified Dockable.
    • getDockable

      public static Dockable getDockable(Component comp)
      Returns the Dockable instance that models the specified Component. The Dockable returned by this method will return a reference to comp when its getComponent() method is called. If comp is null, then this method will return a null reference.

      The association between Dockable and Component is established internally during registerDockable(Dockable dockable). Thus, registerDockable(Dockable dockable) must have been called previously for a mapping to be found and a Dockable to be returned by this method. If no mapping is found for the specified Component, then this method returns a null reference.

      Parameters:
      comp - the Component whose Dockable instance is to be returned.
      Returns:
      the Dockable that models the specified Component
      See Also:
    • getDockable

      public static Dockable getDockable(String id)
      Returns the Dockable instance with the specified ID. The Dockable returned by this method will return a String equal id when its getPersistentId() method is called. If id is null, then this method will return a null reference.

      The association between Dockable and id is established internally during registerDockable(Dockable dockable). Thus, registerDockable(Dockable dockable) must have been called previously for a mapping to be found and a Dockable to be returned by this method. If no mapping is found for the specified id, then this method returns a null reference.

      Parameters:
      id - the persistent ID of the Dockable instance is to be returned.
      Returns:
      the Dockable that has the specified perstent ID.
      See Also:
    • getDockableIds

      public static Set getDockableIds()
      Returns a Set of String IDs for all Dockables registered with the framework. The IDs returned by this method will correspond to the values returned for the getPersistentId() method for each Dockable registered with the framework. Dockable IDs are cached during registerDockable(Dockable dockable). Thus, for an ID to appear within the Set returned by this method, the corresponding Dockable must have first been registered via registerDockable(Dockable dockable). If no Dockables have been registered with the framework, then an empty Set is returned. This method will never return a null reference.
      Returns:
      a Set of String IDs for all Dockables registered with the framework.
      See Also:
    • getDragListener

      public static DragManager getDragListener(Dockable dockable)
      Returns the listener object responsible for managing drag-to-dock mouse events for the specified Dockable. During registration, the listener is added to each of the Components within the Dockable's getDragSources() List. Thus, for this method to return a valid DragManager instance, the Dockable must first have been registered via registerDockable(Dockable dockable). If the specified Dockable is null or its getDragSources() method returns a null, or if the Dockable has not previously been registered, this method will return a null reference.
      Parameters:
      dockable - the Dockable whose drag listener is to be returned.
      Returns:
      the DragManager responsible for listening to an managing drag-related mouse events for the specified Dockable.
      See Also:
    • getLayoutManager

      public static LayoutManager getLayoutManager()
      Returns the currently installed LayoutManager. The LayoutManager is responsible for managing docking layout state. This includes tracking the state for all Dockables as they are embedded, minimized, floated, or hidden. If a Dockable is embedded, the LayoutManager is responsible for tracking its position and size relative to other embedded Dockables. If floating, the LayoutManager is responsible for supplying a FloatManager to maintain Dockable groupings within dialogs as well as dialog size and positioning.

      The LayoutManager is responsible for providing a persistence mechanism to save and restore layout states. Depending on the LayoutManager implementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.

      Because the LayoutManager is a critical piece of the docking infrastructure, it is not possible to install a null LayoutManager. Therefore, this method will always return a valid LayoutManager and never a null reference.

      Returns:
      the currently installed LayoutManager
      See Also:
    • getMinimizeManager

      public static MinimizationManager getMinimizeManager()
      Returns the currently installed MinimizationManager. The MinimizationManager is responsible for minimizing and unminimizing Dockables, removing from and restoring to the embedded docking layout through the currently installed LayoutManager.

      The visual representation of a "minimized" Dockable is somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of the Dockable from the layout and the addition of a tab or label on one or more edges of the application window. The MinimizationManager implementation itself is responsible for interpreting the visual characteristics and behavior of a minimized Dockable, but it must provide a "preview" feature to allow viewing of minimized Dockables, on demand without actually restoring them to the embedded docking layout. Dockables may or may not have limited docking functionality while in minimized and/or preview state, depending upon the MinimizationManager implementation.

      Because the MinimizationManager is a critical piece of the docking infrastructure, it cannot be set to null. Therefore, this method will always return a valid MinimizationManager and never a null reference.

      Returns:
      the currently installed MinimizationManager.
      See Also:
    • getFloatManager

      public static FloatManager getFloatManager()
      Returns the currently installed FloatManager. The FloatManager is actually provided by the currently installed LayoutManager. As such, this method is merely for convenience. It internally obtains the installed LayoutManager via getLayoutManager() and invokes its getFloatManager() method.

      The FloatManager maintains information relevant to floating Dockables including grouping them together within dialogs and tracking dialog size and position. The FloatManager is responsible for generating new dialogs, parenting on the proper application window(s), and sending Dockables to the proper dialogs. It may be used by the LayoutManager to restore hidden Dockables to proper floating state as needed.

      Since the FloatManager is provided by the currently installed LayoutManager, it cannot be set from within the DockingManager. To change the installed FloatManager, one must work directly with the installed LayoutManager implementation per its particular custom API.

      Since the FloatManager is a critical piece of the docking insfrastructure, this method will never return a null reference.

      Returns:
      the FloatManager provided by the currently installed LayoutManager
      See Also:
    • getDockingState

      public static DockingState getDockingState(String dockableId)
      Returns the DockingState for the Dockable with the specified ID. The DockingState is used by the currently installed LayoutManager to track information regarding a Dockable's current state in the docking layout. This includes relative size and positioning to other Dockables, minimization status, floating status, and any other information used to track and potentially restore a the Dockable to the layout if it is currently hidden.

      The Dockable whose current DockingState is resolved will map to the specified dockableId via its getPersistentId() method. The semantics of this mapping relationship are the same as DockingManager.getDockable(String id). If a valid Dockable cannot be found for the specified ID, then this method returns a null reference.

      The DockingState for any given Dockable is ultimately managed by the currently installed LayoutManager. Therefore, this method resolves the LayoutManager via getLayoutManager() and defers processing to its getDockingState(String dockableId) method.

      The underlying LayoutManager does not provide any guarantees that the same DockingState reference always will be returned for a given Dockable; only that the returned DockingState will accurately reflect the current state maintained by the LayoutManager for that Dockable. For instance, if the LayoutManager is capable of maintaining multiple layouts for an application (as Eclipse does between perspectives), then the LayoutManager may or may not maintain multiple DockingState instances for a single Dockable, one within each layout context. Therefore, it is not a good idea to cache references to the DockingState instance returned by this method for future use as the reference itself may possibly become stale over time depending on the LayoutManager implementation.

      Parameters:
      dockableId - the persistent ID of the Dockable whose current DockingState is to be returned
      Returns:
      the current DockingState maintained by the LayoutManager for the specified Dockable
      See Also:
    • getDockingState

      public static DockingState getDockingState(Dockable dockable)
      Returns the DockingState for the specified Dockable. The DockingState is used by the currently installed LayoutManager to track information regarding a Dockable's current state in the docking layout. This includes relative size and positioning to other Dockables, minimization status, floating status, and any other information used to track and potentially restore a the Dockable to the layout if it is currently hidden.

      If the dockable parameter is null, then this method returns a null reference.

      The DockingState for any given Dockable is ultimately managed by the currently installed LayoutManager. Therefore, this method resolves the LayoutManager via getLayoutManager() and defers processing to its getDockingState(String dockableId) method.

      The underlying LayoutManager does not provide any guarantees that the same DockingState reference always will be returned for a given Dockable; only that the returned DockingState will accurately reflect the current state maintained by the LayoutManager for that Dockable. For instance, if the LayoutManager is capable of maintaining multiple layouts for an application (as Eclipse does between perspectives), then the LayoutManager may or may not maintain multiple DockingState instances for a single Dockable, one within each layout context. Therefore, it is not a good idea to cache references to the DockingState instance returned by this method for future use as the reference itself may possibly become stale over time depending on the LayoutManager implementation.

      Parameters:
      dockable - the Dockable whose current DockingState is to be returned
      Returns:
      the current DockingState maintained by the LayoutManager for the specified Dockable
      See Also:
    • getDockableFactory

      public static DockableFactory getDockableFactory()
      Returns the currently installed DockableFactory. The DockableFactory installed by default is null. Therefore, this method will return a null reference until the application developer explicitly provides a DockableFactory implementation via setDockableFactory(DockableFactory factory).

      Installing a DockableFactory allows FlexDock to seamlessly create and register Dockables within getDockable(String id). Generally, getDockable(String id) will lookup the requested Dockable within the internal registry. If not found, and there is no DockableFactory installed, getDockable(String id) returns a null reference. When a DockableFactory is installed, however, failure to lookup a valid Dockable will cause getDockable(String id) to invoke the installed DockableFactory's getDockable(String dockableId) method, transparently registering and returning the newly created Dockable from getDockable(String id).

      Returns:
      the currently installed DockableFactory
      See Also:
    • setAutoPersist

      public static void setAutoPersist(boolean enabled)
      Enables and disables auto-persistence of the current docking layout model when the application exits. Auto-persistence is disabled by default.

      The storeLayoutModel() provides a means of manually sending the docking layout model to some type of external storage. When the DockingManager class loads, a shutdown hook is added to the Runtime. If auto-persist is enabled when the JVM exits, the shutdown hook automatically calls storeLayoutModel(), catching and reporting any IOExceptions that may occur.

      Parameters:
      enabled - true if automatic persistence is desired; false otherwise.
      See Also:
    • setSplitProportion

      public static void setSplitProportion(Component dockable, float proportion)
      Sets the divider location of the split layout containing the specified dockable Component. The Dockable instance associated with the specified Component is resolved via getDockable(Component comp) and processing is dispatched to setSplitProportion(Dockable dockable, float proportion).

      The resulting divider location will be a percentage of the split layout size based upon the proportion parameter. Valid values for proportion range from 0.0F{@code to {@code 1.0F}. For example, a {@code proportion} of {@code 0.3F} will move the divider to 30% of the "size" (<i>width</i> for horizontal split, <i>height</i> for vertical split) of the split container that contains the specified {@code Component}. If a {@code proportion} of less than {@code 0.0F} is supplied, the value }0.0F is used. If a proportion greater than 1.0F is supplied, the value }1.0F} is used.

      It is important to note that the split divider location is only a percentage of the container size from left to right or top to bottom. A proportion of 0.3F does not imply that dockable itself will be allotted 30% of the available space. The split divider will be moved to the 30% position of the split container regardless of the region in which the specified Component resides (which may possibly result in dockable being allotted 70% of the available space).

      This method should be effective regardless of whether the split layout in question has been fully realized and is currently visible on the screen. This should alleviate common problems associated with setting percentages of unrealized Component dimensions, which are initially 0x0 before the Component has been rendered to the screen.

      If the specified Component is null, then no Exception is thrown and no action is taken. Identical behavior occurs if a valid Dockable cannot be resolved for the specified Component, or the Dockable does not reside within a split layout.

      If the Dockable resides within a tabbed layout, a check is done to see if the tabbed layout resides within a parent split layout. If so, the resolved split layout is resized. Otherwise no action is taken.

      Parameters:
      dockable - the Component whose containing split layout is to be resized.
      proportion - the percentage of containing split layout size to which the split divider should be set.
      See Also:
    • setSplitProportion

      public static void setSplitProportion(Dockable dockable, float proportion)
      Sets the divider location of the split layout containing the specified dockable Component.

      The resulting divider location will be a percentage of the split layout size based upon the proportion parameter. Valid values for proportion range from 0.0F{@code to {@code 1.0F}. For example, a {@code proportion} of {@code 0.3F} will move the divider to 30% of the "size" (<i>width</i> for horizontal split, <i>height</i> for vertical split) of the split container that contains the specified {@code Dockable}. If a {@code proportion} of less than {@code 0.0F} is supplied, the value }0.0F is used. If a proportion greater than 1.0F is supplied, the value }1.0F} is used.

      It is important to note that the split divider location is only a percentage of the container size from left to right or top to bottom. A proportion of 0.3F does not imply that dockable itself will be allotted 30% of the available space. The split divider will be moved to the 30% position of the split container regardless of the region in which the specified Dockable resides (which may possibly result in dockable being allotted 70% of the available space).

      This method should be effective regardless of whether the split layout in question has been fully realized and is currently visible on the screen. This should alleviate common problems associated with setting percentages of unrealized Component dimensions, which are initially 0x0 before the Component has been rendered to the screen.

      If the specified Dockable is null, then no Exception is thrown and no action is taken. Identical behavior occurs if the Dockable does not reside within a split layout.

      If the Dockable resides within a tabbed layout, a check is done to see if the tabbed layout resides within a parent split layout. If so, the resolved split layout is resized. Otherwise no action is taken.

      Parameters:
      dockable - the Dockable whose containing split layout is to be resized.
      proportion - the percentage of containing split layout size to which the split divider should be set.
      See Also:
    • setSplitProportion

      public static void setSplitProportion(DockingPort port, float proportion)
      Sets the divider location of the split layout embedded within the specified DockingPort. This method differs from both setSplitProportion(Component dockable, float proportion) and setSplitProportion(Dockable dockable, float proportion) in that this method resolves the split layout embedded within the specified DockingPort, whereas the other methods modify the split layout containing their respective Dockable parameters.

      The resulting divider location will be a percentage of the split layout size based upon the proportion parameter. Valid values for proportion range from 0.0F{@code to {@code 1.0F}. For example, a {@code proportion} of {@code 0.3F} will move the divider to 30% of the "size" (<i>width</i> for horizontal split, <i>height</i> for vertical split) of the split container embedded within the specified {@code DockingPort}. If a {@code proportion} of less than {@code 0.0F} is supplied, the value }0.0F is used. If a proportion greater than 1.0F is supplied, the value }1.0F} is used.

      This method should be effective regardless of whether the split layout in question has been fully realized and is currently visible on the screen. This should alleviate common problems associated with setting percentages of unrealized Component dimensions, which are initially 0x0 before the Component has been rendered to the screen.

      If the specified DockingPort is null, then no Exception is thrown and no action is taken. Identical behavior occurs if the DockingPort does not contain split layout.

      Parameters:
      port - the DockingPort containing the split layout is to be resized.
      proportion - the percentage of split layout size to which the split divider should be set.
    • setDockableFactory

      public static void setDockableFactory(DockableFactory factory)
      Sets the currently installed DockableFactory. null values for the factory parameter are acceptable.

      Installing a DockableFactory allows FlexDock to seamlessly create and register Dockables within getDockable(String id). Generally, getDockable(String id) will lookup the requested Dockable within the internal registry. If not found, and there is no DockableFactory installed, getDockable(String id) returns a null reference. When a DockableFactory is installed, however, failure to lookup a valid Dockable will cause getDockable(String id) to invoke the installed DockableFactory's getDockable(String dockableId) method, transparently registering and returning the newly created Dockable from getDockable(String id).

      Parameters:
      factory - the DockableFactory to install
      See Also:
    • setMinimized

      public static void setMinimized(Dockable dockable, boolean minimized)
      Sets the minimized state for the specified Dockable. This method defers processing to setMinimized(Dockable dockable, boolean minimized, Component window), passing the current Window ancestor of the specified Dockable as the window parameter. Minimization processessing is ultimately deferred to the currently installed MinimizationManager with a constraint of MinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINT.

      The current MinimizationManager is responsible for updating the underlying DockingState model for the specified Dockable as well as rendering its own interpretation of the corresponding visual state on the screen. If the supplied minimized parameter matches the current DockingState, the MinimizationManager is responsible for providing the appropriate visual indications, or lack thereof. If the specified Dockable is null, no Exception is thrown and no action is taken.

      Parameters:
      dockable - the Dockable whose minimzed state is to be modified
      minimized - true if the specified Dockable should be minimized, false otherwise.
      See Also:
    • setMinimized

      public static void setMinimized(Dockable dockable, boolean minimized, Component window)
      Sets the minimized state for the specified Dockable. This method defers processing to setMinimized(Dockable dockable, boolean minimizing, Component window, int constraint), passing MinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINT for the constraint parameter. Minimization processessing is ultimately deferred to the currently installed MinimizationManager.

      The window parameter is passed to the MinimizationManager to indicate that minimization should be handled with respect to the specified root window, or the root window containing the specified Component. null values are acceptable for this parameter.

      The current MinimizationManager is responsible for updating the underlying DockingState model for the specified Dockable as well as rendering its own interpretation of the corresponding visual state on the screen. If the supplied minimized parameter matches the current DockingState, the MinimizationManager is responsible for providing the appropriate visual indications, or lack thereof. If the specified Dockable is null, no Exception is thrown and no action is taken.

      Parameters:
      dockable - the Dockable whose minimzed state is to be modified
      minimized - true if the specified Dockable should be minimized, false otherwise.
      window - the Component whose root window will be used by the underlying MinimizationManager for rendering the Dockable in its new minimized state.
      See Also:
    • setMinimized

      public static void setMinimized(Dockable dockable, boolean minimizing, int constraint)
      Sets the minimized state for the specified Dockable. This method defers processing to setMinimized(Dockable dockable, boolean minimizing, Component window, int constraint), passing null for the window parameter. Minimization processessing is ultimately deferred to the currently installed MinimizationManager.

      Valid values for the constraint parameter may be found on the MinimizationManager interface and include UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER. However, constraint values must ultimately be interpreted by the current MinimizationManager implementation and, thus any integer value may theoretically be valid for constraint.

      The current MinimizationManager is responsible for updating the underlying DockingState model for the specified Dockable as well as rendering its own interpretation of the corresponding visual state on the screen. If the supplied minimized parameter matches the current DockingState, the MinimizationManager is responsible for providing the appropriate visual indications, or lack thereof. If the specified Dockable is null, no Exception is thrown and no action is taken.

      Parameters:
      dockable - the Dockable whose minimzed state is to be modified
      minimizing - true if the specified Dockable should be minimized, false otherwise.
      constraint - a value to indicate to the MinimizationManager desired rendering of the minimized Dockable
      See Also:
    • setMinimized

      public static void setMinimized(Dockable dockable, boolean minimizing, Component window, int constraint)
      Sets the minimized state for the specified Dockable. This method defers processing to the currently installed MinimizationManager.

      The window parameter is passed to the MinimizationManager to indicate that minimization should be handled with respect to the specified root window, or the root window containing the specified Component. If a null values is supplied for this parameter, the currently active window is used. If no currently active window can be determined, then this method exits with no action taken.

      The current MinimizationManager is responsible for updating the underlying DockingState model for the specified Dockable as well as rendering its own interpretation of the corresponding visual state on the screen. If the supplied minimized parameter matches the current DockingState, the MinimizationManager is responsible for providing the appropriate visual indications, or lack thereof. If the specified Dockable is null, no Exception is thrown and no action is taken.

      Valid values for the constraint parameter may be found on the MinimizationManager interface and include UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER. However, constraint values must ultimately be interpreted by the current MinimizationManager implementation and, thus any integer value may theoretically be valid for constraint.

      Parameters:
      dockable - the Dockable whose minimzed state is to be modified
      minimizing - true if the specified Dockable should be minimized, false otherwise.
      window - the Component whose root window will be used by the underlying MinimizationManager for rendering the Dockable in its new minimized state.
      constraint - a value to indicate to the MinimizationManager desired rendering of the minimized Dockable
      See Also:
    • setMainDockingPort

      public static void setMainDockingPort(Component window, String portId)
      Sets the "main" DockingPort within the application window containing the specified Component. Just as desktop applications will tend to have a "main" application window, perhaps surrounded with satellite windows or dialogs, the "main" DockingPort within a given window will be considered by the application developer to contain the primary docking layout used by the enclosing window.

      The Component parameter may or may not be a root window container. If not, the ancestor window of comp is determined and a set of docking ports encapsulated by a RootDockingPortInfo instance is returned by a call to getRootDockingPortInfo(Component comp). The resolved RootDockingPortInfo instance's main DockingPort is set via its method setMainPort(String portId).

      By default, the "main" DockingPort assigned to any RootDockingPortInfo instance associated with a window will happen to be the first root DockingPort detected for that window. This method is used to alter that setting.

      If comp is null or the root window cannot be resolved, then this method returns with no action taken.

      Parameters:
      window - the Component whose root window will be checked for a main DockingPort
      portId - the persistent ID of the DockingPort to use as the main DockingPort for the specified window.
      See Also:
    • setMinimizeManager

      public static void setMinimizeManager(MinimizationManager mgr)
      Sets the currently installed MinimizationManager. The MinimizationManager is responsible for minimizing and unminimizing Dockables, removing from and restoring to the embedded docking layout through the currently installed LayoutManager.

      The visual representation of a "minimized" Dockable is somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of the Dockable from the layout and the addition of a tab or label on one or more edges of the application window. The MinimizationManager implementation itself is responsible for interpreting the visual characteristics and behavior of a minimized Dockable, but it must provide a "preview" feature to allow viewing of minimized Dockables, on demand without actually restoring them to the embedded docking layout. Dockables may or may not have limited docking functionality while in minimized and/or preview state, depending upon the MinimizationManager implementation.

      Because the MinimizationManager is a critical piece of the docking infrastructure, it cannot be set to null. If a null value is passed into this method, the default MinimizationManager provided by the framework is used instead.

      Parameters:
      mgr - the MinimizationManager to be installed
      See Also:
    • setMinimizeManager

      public static void setMinimizeManager(String mgrClass)
      Sets the currently installed MinimizationManager using the specfied class name. An attempt is make to instantiate a MinimizationManager based upon the supplied class name String. If the class cannot be instaniated, a stacktrace is reported to the System.err and the default MinimizationManager supplied by the framework is used. If the String parameter is null, no error occurs and the default MinimizationManager is used. If the instantiated class is not a valid instance of MinimizationManager, then a ClassCastException is thrown.

      The MinimizationManager is responsible for minimizing and unminimizing Dockables, removing from and restoring to the embedded docking layout through the currently installed LayoutManager.

      The visual representation of a "minimized" Dockable is somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of the Dockable from the layout and the addition of a tab or label on one or more edges of the application window. The MinimizationManager implementation itself is responsible for interpreting the visual characteristics and behavior of a minimized Dockable, but it must provide a "preview" feature to allow viewing of minimized Dockables, on demand without actually restoring them to the embedded docking layout. Dockables may or may not have limited docking functionality while in minimized and/or preview state, depending upon the MinimizationManager implementation.

      Because the MinimizationManager is a critical piece of the docking infrastructure, it cannot be set to null. If a null value is passed into this method, the default MinimizationManager provided by the framework is used instead.

      Parameters:
      mgrClass - the class name of the MinimizationManager to be installed
      See Also:
    • setFloatingEnabled

      public static void setFloatingEnabled(boolean enabled)
      Sets whether global floating support should be enabled. Defers processing to FloatPolicyManager.setGlobalFloatingEnabled(boolean globalFloatingEnabled).
      Parameters:
      enabled - true if global floating support should be enabled, false otherwise.
      See Also:
    • setDefaultPersistenceKey

      public static void setDefaultPersistenceKey(String key)
    • getDefaultPersistenceKey

      public static String getDefaultPersistenceKey()
    • setSingleTabsAllowed

      public static void setSingleTabsAllowed(boolean allowed)
      Sets whether tabbed layouts are supported by default for DockingPorts with a single Dockable in the CENTER region. This is a global default setting and applies to any DockingPort that does not have a specific contradictory local setting.

      This method defers processing to org.flexdock.docking.props.PropertyManager.getDockingPortRoot(). As such, there are multiple "scopes" at which this property may be overridden.

      Parameters:
      allowed - true if the default setting for DockingPorts should allow a tabbed layout for a single Dockable in the CENTER region; false otherwise.
      See Also:
    • setLayoutManager

      public static void setLayoutManager(LayoutManager mgr)
      Sets the currently installed LayoutManager. The LayoutManager is responsible for managing docking layout state. This includes tracking the state for all Dockables as they are embedded, minimized, floated, or hidden. If a Dockable is embedded, the LayoutManager is responsible for tracking its position and size relative to other embedded Dockables. If floating, the LayoutManager is responsible for supplying a FloatManager to maintain Dockable groupings within dialogs as well as dialog size and positioning.

      The LayoutManager is responsible for providing a persistence mechanism to save and restore layout states. Depending on the LayoutManager implementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.

      Because the LayoutManager is a critical piece of the docking infrastructure, it is not possible to install a null LayoutManager. FlexDock provides a default LayoutManager implementation. If this method is passed a null argument, the default LayoutManager is used instead.

      Parameters:
      mgr - the LayoutManager to install.
      See Also:
    • setLayoutManager

      public static void setLayoutManager(String mgrClass)
      Sets the currently installed LayoutManager using the specified class name. An attempt is make to instantiate a LayoutManager based upon the supplied class name String. If the class cannot be instaniated, a stacktrace is reported to the System.err and the default LayoutManager supplied by the framework is used. If the String parameter is null, no error occurs and the default LayoutManager is used. If the instantiated class is not a valid instance of LayoutManager, then a ClassCastException is thrown.

      The LayoutManager is responsible for managing docking layout state. This includes tracking the state for all Dockables as they are embedded, minimized, floated, or hidden. If a Dockable is embedded, the LayoutManager is responsible for tracking its position and size relative to other embedded Dockables. If floating, the LayoutManager is responsible for supplying a FloatManager to maintain Dockable groupings within dialogs as well as dialog size and positioning.

      The LayoutManager is responsible for providing a persistence mechanism to save and restore layout states. Depending on the LayoutManager implementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.

      Because the LayoutManager is a critical piece of the docking infrastructure, it is not possible to install a null LayoutManager. FlexDock provides a default LayoutManager implementation. If this method is passed a null argument, the default LayoutManager is used instead.

      Parameters:
      mgrClass - the class name of the LayoutManager to install.
      See Also:
    • setDockingStrategy

      public static void setDockingStrategy(Class classKey, DockingStrategy strategy)
      Sets the DockingStrategy associated with specified Class. This method returns with no action taken if the specified Class paramter is null. If the strategy parameter is null then any existing DockingStrategy association with the specified }Class} is removed. Otherwise, a new DockingStrategy association is added for the specified Class.

      DockingStrategy association follows a strict inheritance chain using org.flexdock.util.ClassMapping. This means that the association created by this method applies for the specified Class and all direct subclasses, but associations for interfaces are ignored. Associations also do not apply for subclasses that have their own specific DockingStrategy mapping.

      Parameters:
      classKey - the Class whose DockingStrategy association we wish to set
      strategy - the DockingStrategy to be associated with the specified Class.
      See Also:
    • undock

      public static boolean undock(Dockable dockable)
      Undocks the specified Dockable from its parent DockingPort. If the Dockable is null, or it does not currently reside within a DockingPort, then this method returns false with no action taken. Otherwise, this method returns true if the undocking operation was successful and false if the undocking operation could not be completed. This method determines the DockingStrategy to be used for DockingPort containing the specified Dockable and defers processing to the undock(Dockable dockable) method on the DockingStrategy. This method's return value will be based upon the DockingStrategy implementation returned by a call to getDockingStrategy(Object obj). The DockingStrategy used may be controlled via setDockingStrategy(Class c, DockingStrategy strategy), supplying a DockingPort implementation class and a customized DockingStrategy.
      Parameters:
      dockable - the Dockable to be undocked.
      Returns:
      true if the undocking operation was successful, false otherwise.
      See Also:
    • undock

      public static boolean undock(Component dockable)
    • updateDragListeners

      public static void updateDragListeners(Dockable dockable)
      Ensures that a valid DragManager has been installed as a listener for all of the specified Dockable's drag source Components. This method invokes the getDragSources() method on the specified Dockable and iterates over each Component in the returned List. If any Component does not have a valid DragManager listener installed, an appropriate listener is added to enable drag-to-dock functionality.

      This method is useful to application developers who manually attempt to add new Components to a Dockable's drag source List. However, it is not necessary to call this method unless the drag source list has been updated after calling registerDockable(Dockable dockable), since registerDockable(Dockable dockable) will automatically initialize each drag source for the specified Dockable.

      If the specified Dockable is null, then no Exception is thrown and no action is taken.

      Parameters:
      dockable - the Dockable whose drag sources are to be checked for DragManagers and updated accordingly.
      See Also:
    • getDefaultSiblingSize

      public static float getDefaultSiblingSize()
    • setDefaultSiblingSize

      public static void setDefaultSiblingSize(float size)
    • setRubberBand

      public static void setRubberBand(RubberBand rubberBand)
    • setDragPreview

      public static void setDragPreview(DragPreview dragPreview)
    • toggleMaximized

      public static void toggleMaximized(Component comp)
      Maximizes the Dockable associated with the specified component or restores the Dockable if it is currently maximized. This method forwards the request to toggleMaximized(Dockable) after obtaining the Dockable associated to the component via getDockable(Component).
      Parameters:
      comp -
      See Also:
    • toggleMaximized

      public static void toggleMaximized(Dockable dockable)
      Maximizes the specified Dockable or restores the specified Dockable if it is already maximized.

      The scope of maximization is the root DockingPort. The specified Dockable's current DockingPort is asked to temporarily lend the Dockable for maximization and the root DockingPort is asked to temorarily host the Dockable and display it such that it occupies all (or the majority) of its screen resources. If the Dockable is already maximized, the root DockingPort is asked to return to its original state and the Dockable is returned to its original DockingPort.

      Parameters:
      dockable -
    • isMaximized

      public static boolean isMaximized(Dockable dockable)