Class DefaultFloatPolicy
java.lang.Object
org.flexdock.docking.floating.policy.FloatPolicy.NullFloatPolicy
org.flexdock.docking.floating.policy.DefaultFloatPolicy
- All Implemented Interfaces:
FloatPolicy
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
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.flexdock.docking.floating.policy.FloatPolicy
FloatPolicy.NullFloatPolicy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DefaultFloatPolicy
Returns a singleton instance ofDefaultFloatPolicy
.boolean
Checks the previousDockingPort
for the specifiedDockingEvent
and returnsfalse
if it is in a floating dialog and contains less than twoDockables
.boolean
isFloatingAllowed
(Dockable dockable) Blocks floating support (returns false) ifdockable
isnull
, ifFloatPolicyManager.isGlobalFloatingEnabled()
returnsfalse
, or if there are no entries within theSet
returned bydockable.getFrameDragSources()
.
-
Constructor Details
-
DefaultFloatPolicy
public DefaultFloatPolicy()
-
-
Method Details
-
getInstance
Returns a singleton instance ofDefaultFloatPolicy
.- Returns:
- a singleton instance of
DefaultFloatPolicy
.
-
isFloatDropAllowed
Checks the previousDockingPort
for the specifiedDockingEvent
and returnsfalse
if it is in a floating dialog and contains less than twoDockables
. A floating dialog may contain multipleDockables
, 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 singleDockable
, it makes no sense to remove theDockable
only to float it within another dialog. This situation is caught by this method and the docking operation is blocked.- Specified by:
isFloatDropAllowed
in interfaceFloatPolicy
- Overrides:
isFloatDropAllowed
in classFloatPolicy.NullFloatPolicy
- Parameters:
evt
- theDockingEvent
to be checked for drop-to-float support- Returns:
false
if theDockingEvent
is attempting to float an already floatingDockable
with no otherDockables
in its current dialog;true
otherwise.- See Also:
-
isFloatingAllowed
Blocks floating support (returns false) ifdockable
isnull
, ifFloatPolicyManager.isGlobalFloatingEnabled()
returnsfalse
, or if there are no entries within theSet
returned bydockable.getFrameDragSources()
. Otherwise, this method returnstrue
.- Specified by:
isFloatingAllowed
in interfaceFloatPolicy
- Overrides:
isFloatingAllowed
in classFloatPolicy.NullFloatPolicy
- Parameters:
dockable
- theDockable
to be checked for floating support- Returns:
false
if floating is blocked for the specifiedDockable
;true
otherwise.- See Also:
-