|
SwingFX v1.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.java.swingfx.jdraggable.DefaultDraggableManager
A default implementation of the DraggableManager
interface. This
implementation provides the basic functionality to enable Component
's which implement the Draggable
interface to actually be dragged
when a user selects and drags a component. Depending on the DragPolicy
that is set, not all components must implement the Draggable
interface.
This implementation only supports one component to be dragged at a time.
Another idea for an implementation of DraggableManager
is one which
registers a JLayeredPane
as the "Draggable Container"
such that when a component is dragged, it's depth (or Z-Order) within the
"Draggable Container" is changed such that it is on top of the other components.
Field Summary |
Fields inherited from interface net.java.swingfx.jdraggable.DraggableManager |
STATE_DRAGGING, STATE_STILL, STATE_UNKNOWN |
Constructor Summary | |
DefaultDraggableManager()
Creates a new DraggableManager with no "Draggable Container"
registered |
|
DefaultDraggableManager(Container draggableContainer)
Creates a new DraggableManager and registers
draggableContainer as the "Draggable Container" |
Method Summary | |
void |
componentAdded(ContainerEvent e)
|
void |
componentRemoved(ContainerEvent e)
|
boolean |
dragging()
Called while the Component is being dragged |
Container |
getDraggableContainer()
Returns the Container which registered itself as the
"Draggable Container" with this DraggableManager |
DragPolicy |
getDragPolicy()
Returns the DragPolicy which this manager obides by |
byte |
getState(Draggable draggableComponent)
Returns the state of the current Draggable component which this
manager is handling |
void |
registerDraggableContainer(Container draggableContainer)
Registers the given Container as the "Draggable Container" |
void |
setDragPolicy(DragPolicy dragPolicy)
Set the policy for which components are eligible for dragging |
void |
setNullifyLayout(boolean nullifyLayout)
Sets whether the "draggable container" layout manager should be set to null once a component is dragged, or not. |
boolean |
shouldNullifyLayout()
Returns the "nullify layout" value |
boolean |
startDrag(Component componentToDrag)
Called before a Component is actually dragged |
boolean |
stopDrag()
Called when a Component has stopped being dragged |
void |
unregisterDraggableContainer(Container draggableContainer)
Un-Registers the given Container from being the "Draggable Container" |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultDraggableManager()
DraggableManager
with no "Draggable Container"
registered
DefaultDraggableManager(Container)
,
registerDraggableContainer(Container)
public DefaultDraggableManager(Container draggableContainer)
DraggableManager
and registers
draggableContainer
as the "Draggable Container"
draggableContainer
- the "Draggable Container" to register
IllegalArgumentException
- if draggableContainer
is
null
DefaultDraggableManager()
,
registerDraggableContainer(Container)
Method Detail |
public void setNullifyLayout(boolean nullifyLayout)
DraggableManager
null
once a component is dragged, or not.
null
, the components
may lose their "dragged" position if the container is resized.
true
setNullifyLayout
in interface DraggableManager
nullifyLayout
- true
to nullify the layout manager,
false
otherwisepublic boolean shouldNullifyLayout()
DraggableManager
shouldNullifyLayout
in interface DraggableManager
true
to nullify the layout manager of the "draggable
container", false
otherwisepublic boolean startDrag(Component componentToDrag)
DraggableManager
Component
is actually dragged
startDrag
in interface DraggableManager
componentToDrag
- the component which was chosen to be dragged
true
if the "drag" can continue, false
otherwisepublic boolean dragging()
DraggableManager
Component
is being dragged
dragging
in interface DraggableManager
true
if the dragging can continue,
false
otherwisepublic boolean stopDrag()
DraggableManager
Component
has stopped being dragged
stopDrag
in interface DraggableManager
true
if no errors occurred when the drag completed,
false
otherwisepublic Container getDraggableContainer()
Container
which registered itself as the
"Draggable Container" with this DraggableManager
getDraggableContainer
in interface DraggableManager
null
if not
Container
has been registered as the
"Draggable Container"public byte getState(Draggable draggableComponent)
Draggable
component which this
manager is handling
getState
in interface DraggableManager
draggableComponent
- the Draggable
whose state
is of interest
Draggable
componentDraggableManager.getState(net.java.swingfx.jdraggable.Draggable)
public void registerDraggableContainer(Container draggableContainer)
Container
as the "Draggable Container"
registerDraggableContainer
in interface DraggableManager
draggableContainer
- the Container
whose Draggable
components should be able to be dragged
IllegalArgumentException
- if a Container
has already
been registeredDraggableManager.registerDraggableContainer(java.awt.Container)
public void unregisterDraggableContainer(Container draggableContainer)
Container
from being the "Draggable Container"
unregisterDraggableContainer
in interface DraggableManager
draggableContainer
- the Container
to unregister
IllegalArgumentException
- if the given container is not the same
as the already registered container
IllegalStateException
- if no container is currently registeredDraggableManager.unregisterDraggableContainer(Container)
public DragPolicy getDragPolicy()
DragPolicy
which this manager obides by
getDragPolicy
in interface DraggableManager
DragPolicy
for this manager. If no
policy has been set the default policy is used.DraggableManager.getDragPolicy()
,
setDragPolicy(DragPolicy)
,
DragPolicy.DEFAULT
public void setDragPolicy(DragPolicy dragPolicy)
DraggableManager
setDragPolicy
in interface DraggableManager
dragPolicy
- the policy to setDraggableManager.getDragPolicy()
,
DragPolicy
public void componentAdded(ContainerEvent e)
componentAdded
in interface ContainerListener
public void componentRemoved(ContainerEvent e)
componentRemoved
in interface ContainerListener
|
SwingFX v1.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |