org.flexdock.docking.floating.policy
Class DefaultFloatPolicy
java.lang.Object
org.flexdock.docking.floating.policy.FloatPolicy.NullFloatPolicy
org.flexdock.docking.floating.policy.DefaultFloatPolicy
- All Implemented Interfaces:
- FloatPolicy
public class DefaultFloatPolicy
- extends FloatPolicy.NullFloatPolicy
This class provides an implementation of the FloatPolicy
interface to
provide default behavior for the framework. It blocks floating operations for
Dockables
without any frame drag sources, for already floating
Dockables
that cannot be reparented within a new dialog, or if global
floating support has been disabled.
- Author:
- Christopher Butler
Method Summary |
static DefaultFloatPolicy |
getInstance()
Returns a singleton instance of DefaultFloatPolicy . |
boolean |
isFloatDropAllowed(DockingEvent evt)
Checks the previous DockingPort for the specified
DockingEvent and returns false if it is in a floating
dialog and contains less than two Dockables . |
boolean |
isFloatingAllowed(Dockable dockable)
Blocks floating support (returns false) if dockable is
null , if FloatPolicyManager.isGlobalFloatingEnabled()
returns false , or if there are no entries within the Set
returned by dockable.getFrameDragSources() . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultFloatPolicy
public DefaultFloatPolicy()
getInstance
public static DefaultFloatPolicy getInstance()
- Returns a singleton instance of
DefaultFloatPolicy
.
- Returns:
- a singleton instance of
DefaultFloatPolicy
.
isFloatDropAllowed
public boolean isFloatDropAllowed(DockingEvent evt)
- Checks the previous
DockingPort
for the specified
DockingEvent
and returns false
if it is in a floating
dialog and contains less than two Dockables
. A floating dialog
may contain multiple Dockables
, each of which may be dragged out
of the current dialog to float in their own dialog. However, if a
floating dialog only contains a single Dockable
, it makes no
sense to remove the Dockable
only to float it within another
dialog. This situation is caught by this method and the docking operation
is blocked.
- Specified by:
isFloatDropAllowed
in interface FloatPolicy
- Overrides:
isFloatDropAllowed
in class FloatPolicy.NullFloatPolicy
- Parameters:
evt
- the DockingEvent
to be checked for drop-to-float
support
- Returns:
false
if the DockingEvent
is attempting to float
an already floating Dockable
with no other
Dockables
in its current dialog; true
otherwise.- See Also:
FloatPolicy.isFloatDropAllowed(DockingEvent)
,
DockingEvent.getOldDockingPort()
,
FloatingDockingPort.getDockableCount()
,
DockingEvent.consume()
isFloatingAllowed
public boolean isFloatingAllowed(Dockable dockable)
- Blocks floating support (returns false) if
dockable
is
null
, if FloatPolicyManager.isGlobalFloatingEnabled()
returns false
, or if there are no entries within the Set
returned by dockable.getFrameDragSources()
. Otherwise, this
method returns true
.
- Specified by:
isFloatingAllowed
in interface FloatPolicy
- Overrides:
isFloatingAllowed
in class FloatPolicy.NullFloatPolicy
- Parameters:
dockable
- the Dockable
to be checked for floating support
- Returns:
false
if floating is blocked for the specified
Dockable
; true
otherwise.- See Also:
Dockable.getFrameDragSources()
,
FloatPolicyManager.isGlobalFloatingEnabled()