bibliothek.gui.dock.control.relocator
Class DefaultDockRelocatorEvent

java.lang.Object
  extended by bibliothek.gui.dock.control.relocator.DefaultDockRelocatorEvent
All Implemented Interfaces:
DockRelocatorEvent

public class DefaultDockRelocatorEvent
extends Object
implements DockRelocatorEvent

A default implementation of DockRelocatorEvent.

Author:
Benjamin Sigg

Constructor Summary
DefaultDockRelocatorEvent(DockController controller, Dockable dockable, Dockable[] implicit, DockStation target, Point mouse, boolean move)
          Creates a new event.
 
Method Summary
 void cancel()
          Cancels the entire operation, the Dockable remains at its current place and all visible indicators are removed.
 void drop()
          Advices to complete the drag and drop operation right now, this operation at least requires DockRelocatorEvent.getTarget() to be not null, otherwise this operation is equal to calling DockRelocatorEvent.cancel().
 void forbid()
          Forbids the current event to complete, depending on the state of the operation this is equivalent to calling DockRelocatorEvent.cancel().
 DockController getController()
          Gets the controller in whose realm this event was created.
 Dockable getDockable()
          Gets the Dockable which is or will be dragged.
 Dockable[] getImplicitDockables()
          Gets a set of Dockables that will also change their parent due to this event.
 Point getMouseLocation()
          Gets the location of the mouse on the screen.
 DockRelocator getSource()
          Gets the DockRelocator which created this event.
 DockStation getTarget()
          Gets the current target of the drag and drop operation, if the operation would finish now, the dockable would be dropped onto this station.
Please note that this field does not take into consideration, that the dockable may be forced onto another parent.
 void ignore()
          The DockRelocator is to behave as if this event never happened.
 boolean isCanceled()
          Tells whether this event is already canceled.
 boolean isDropping()
          Tells whether this event will result in a drop operation.
 boolean isForbidden()
          Tells whether this event is forbidden.
 boolean isIgnored()
          Tells whether the DockRelocator behaves as if an event did not happen.
 boolean isMove()
          Tells whether the event really is a move event (the parent of the Dockable does not change).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDockRelocatorEvent

public DefaultDockRelocatorEvent(DockController controller,
                                 Dockable dockable,
                                 Dockable[] implicit,
                                 DockStation target,
                                 Point mouse,
                                 boolean move)
Creates a new event.

Parameters:
controller - the controller in whose realm the event happens
dockable - the element that is moved around
implicit - the elements that change their position too
target - the potential parent of dockable
mouse - the location of the mouse on the screen or null
move - whether the event does not change the parent of dockable
Method Detail

cancel

public void cancel()
Description copied from interface: DockRelocatorEvent
Cancels the entire operation, the Dockable remains at its current place and all visible indicators are removed.

Specified by:
cancel in interface DockRelocatorEvent

drop

public void drop()
Description copied from interface: DockRelocatorEvent
Advices to complete the drag and drop operation right now, this operation at least requires DockRelocatorEvent.getTarget() to be not null, otherwise this operation is equal to calling DockRelocatorEvent.cancel().

Specified by:
drop in interface DockRelocatorEvent

forbid

public void forbid()
Description copied from interface: DockRelocatorEvent
Forbids the current event to complete, depending on the state of the operation this is equivalent to calling DockRelocatorEvent.cancel().

Specified by:
forbid in interface DockRelocatorEvent

getController

public DockController getController()
Description copied from interface: DockRelocatorEvent
Gets the controller in whose realm this event was created.

Specified by:
getController in interface DockRelocatorEvent
Returns:
the controller, not null

getDockable

public Dockable getDockable()
Description copied from interface: DockRelocatorEvent
Gets the Dockable which is or will be dragged.

Specified by:
getDockable in interface DockRelocatorEvent
Returns:
the dragged item

getImplicitDockables

public Dockable[] getImplicitDockables()
Description copied from interface: DockRelocatorEvent
Gets a set of Dockables that will also change their parent due to this event. This list contains only the set of Dockables that are directly affected by this event. Elements that are affected indirectly, e.g. because a DockStation remains that has only one child and thus gets removed, are not included.

Specified by:
getImplicitDockables in interface DockRelocatorEvent
Returns:
the items whose position is about to change too, can be empty but not null

getSource

public DockRelocator getSource()
Description copied from interface: DockRelocatorEvent
Gets the DockRelocator which created this event.

Specified by:
getSource in interface DockRelocatorEvent
Returns:
the relocator, not null

getTarget

public DockStation getTarget()
Description copied from interface: DockRelocatorEvent
Gets the current target of the drag and drop operation, if the operation would finish now, the dockable would be dropped onto this station.
Please note that this field does not take into consideration, that the dockable may be forced onto another parent. Clients should always ask the Dockable directly for its real parent.

Specified by:
getTarget in interface DockRelocatorEvent
Returns:
the current target or null if either the drag and drop operation is not yet started or if there is no target selected

getMouseLocation

public Point getMouseLocation()
Description copied from interface: DockRelocatorEvent
Gets the location of the mouse on the screen. This includes imaginary points created by calls to a DirectRemoteRelocator or a RemoteRelocator. The property may not be set if either the location of the mouse is not important for the current event, or simply if the location of the mouse is not known.

Specified by:
getMouseLocation in interface DockRelocatorEvent
Returns:
the location of the mouse, may be null

isCanceled

public boolean isCanceled()
Description copied from interface: DockRelocatorEvent
Tells whether this event is already canceled. This can either be due to a call to DockRelocatorEvent.cancel() or because the DockRelocator already decided that the operation has to be canceled.

Specified by:
isCanceled in interface DockRelocatorEvent
Returns:
whether the operation is canceled
See Also:
DockRelocatorEvent.cancel()

isDropping

public boolean isDropping()
Description copied from interface: DockRelocatorEvent
Tells whether this event will result in a drop operation. This can be either due to a call to DockRelocatorEvent.drop() or because the DockRelocator already decided that a the operation has to finish.

Specified by:
isDropping in interface DockRelocatorEvent
Returns:
whether the dockable will be dropped
See Also:
DockRelocatorEvent.drop()

isForbidden

public boolean isForbidden()
Description copied from interface: DockRelocatorEvent
Tells whether this event is forbidden. This can either be due to a call to DockRelocatorEvent.forbid() or because the DockRelocator already decided that this operation should not have an effect.

Specified by:
isForbidden in interface DockRelocatorEvent
Returns:
whether the operation is forbidden
See Also:
DockRelocatorEvent.forbid()

ignore

public void ignore()
Description copied from interface: DockRelocatorEvent
The DockRelocator is to behave as if this event never happened. Usually this means that the MouseEvent is not consumed and that no action takes place. Note however that some events cannot be ignored, for example if the operation is canceled.

Specified by:
ignore in interface DockRelocatorEvent

isIgnored

public boolean isIgnored()
Description copied from interface: DockRelocatorEvent
Tells whether the DockRelocator behaves as if an event did not happen.

Specified by:
isIgnored in interface DockRelocatorEvent
Returns:
whether to ignore the event

isMove

public boolean isMove()
Description copied from interface: DockRelocatorEvent
Tells whether the event really is a move event (the parent of the Dockable does not change).

Specified by:
isMove in interface DockRelocatorEvent
Returns:
true if the event describes a move event, false if not or if the event does not describe a drop operation.