public class DefaultFloatPolicy extends FloatPolicy.NullFloatPolicy
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.FloatPolicy.NullFloatPolicy
Constructor and Description |
---|
DefaultFloatPolicy() |
Modifier and Type | Method and Description |
---|---|
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() . |
public static DefaultFloatPolicy getInstance()
DefaultFloatPolicy
.DefaultFloatPolicy
.public boolean isFloatDropAllowed(DockingEvent evt)
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.isFloatDropAllowed
in interface FloatPolicy
isFloatDropAllowed
in class FloatPolicy.NullFloatPolicy
evt
- the DockingEvent
to be checked for drop-to-float
supportfalse
if the DockingEvent
is attempting to float
an already floating Dockable
with no other
Dockables
in its current dialog; true
otherwise.FloatPolicy.isFloatDropAllowed(DockingEvent)
,
DockingEvent.getOldDockingPort()
,
FloatingDockingPort.getDockableCount()
,
DockingEvent.consume()
public boolean isFloatingAllowed(Dockable dockable)
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
.isFloatingAllowed
in interface FloatPolicy
isFloatingAllowed
in class FloatPolicy.NullFloatPolicy
dockable
- the Dockable
to be checked for floating supportfalse
if floating is blocked for the specified
Dockable
; true
otherwise.Dockable.getFrameDragSources()
,
FloatPolicyManager.isGlobalFloatingEnabled()