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 theFloatPolicyinterface to provide default behavior for the framework. It blocks floating operations forDockableswithout any frame drag sources, for already floatingDockablesthat 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 Constructor Description DefaultFloatPolicy()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DefaultFloatPolicygetInstance()Returns a singleton instance ofDefaultFloatPolicy.booleanisFloatDropAllowed(DockingEvent evt)Checks the previousDockingPortfor the specifiedDockingEventand returnsfalseif it is in a floating dialog and contains less than twoDockables.booleanisFloatingAllowed(Dockable dockable)Blocks floating support (returns false) ifdockableisnull, ifFloatPolicyManager.isGlobalFloatingEnabled()returnsfalse, or if there are no entries within theSetreturned bydockable.getFrameDragSources().
-
-
-
Method Detail
-
getInstance
public static DefaultFloatPolicy getInstance()
Returns a singleton instance ofDefaultFloatPolicy.- Returns:
- a singleton instance of
DefaultFloatPolicy.
-
isFloatDropAllowed
public boolean isFloatDropAllowed(DockingEvent evt)
Checks the previousDockingPortfor the specifiedDockingEventand returnsfalseif 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 theDockableonly to float it within another dialog. This situation is caught by this method and the docking operation is blocked.- Specified by:
isFloatDropAllowedin interfaceFloatPolicy- Overrides:
isFloatDropAllowedin classFloatPolicy.NullFloatPolicy- Parameters:
evt- theDockingEventto be checked for drop-to-float support- Returns:
falseif theDockingEventis attempting to float an already floatingDockablewith no otherDockablesin its current dialog;trueotherwise.- See Also:
FloatPolicy.isFloatDropAllowed(DockingEvent),DockingEvent.getOldDockingPort(),FloatingDockingPort.getDockableCount(),DockingEvent.consume()
-
isFloatingAllowed
public boolean isFloatingAllowed(Dockable dockable)
Blocks floating support (returns false) ifdockableisnull, ifFloatPolicyManager.isGlobalFloatingEnabled()returnsfalse, or if there are no entries within theSetreturned bydockable.getFrameDragSources(). Otherwise, this method returnstrue.- Specified by:
isFloatingAllowedin interfaceFloatPolicy- Overrides:
isFloatingAllowedin classFloatPolicy.NullFloatPolicy- Parameters:
dockable- theDockableto be checked for floating support- Returns:
falseif floating is blocked for the specifiedDockable;trueotherwise.- See Also:
Dockable.getFrameDragSources(),FloatPolicyManager.isGlobalFloatingEnabled()
-
-