com.vlsolutions.swing.docking.event

Class DockDragEvent

public class DockDragEvent extends DockEvent

An event describing a drag operation occuring for docking purpose.

This event is used by API extenders to manage drag and drop action related to docking. This is not meant to be used by User Applications.

Standard processing of dragging is (ignoring DockableStateChange events) :

Constructor Summary
DockDragEvent(DockingDesktop desktop, DockableDragSource source, MouseEvent event)
Creates an event based on a drag source and a mouse event.
Method Summary
voidacceptDrag(Shape dropShape)
Used by a DockDropReceiver to indicate that the drag operation is accepted (mouse is over a droppable zone).
voiddelegateDrag()
Rejects the drag, but allows the docking system to search for othet drop receiver in ancestors.
ShapegetDropShape()
Returns the shape to display if drag is accepted.
booleanisDragAccepted()
returns true if drag is accepted.
booleanisDragDelegated()
If drag is not accepted, this method will be invoked to evaluate a delegating event processing.
voidrejectDrag()
Used to reject the drag (e.g. when trying to drop a component onto itself)

Constructor Detail

DockDragEvent

public DockDragEvent(DockingDesktop desktop, DockableDragSource source, MouseEvent event)
Creates an event based on a drag source and a mouse event.

The mouse coordinates are converted into the receiver's coordinates.

Method Detail

acceptDrag

public void acceptDrag(Shape dropShape)
Used by a DockDropReceiver to indicate that the drag operation is accepted (mouse is over a droppable zone).

As of version 2.1, please note that you also have to invoke #setDockingAction() to specify the action associated with the drag shape.

Parameters: dropShape the shape (in drop component coordinates) showing the drop zone, which will be displayed on the glasspane of the DockingPanel.

delegateDrag

public void delegateDrag()
Rejects the drag, but allows the docking system to search for othet drop receiver in ancestors.

for example, a TabbedDockableContainer that doesn't allow drops on its borders can delegates this management to its container.

getDropShape

public Shape getDropShape()
Returns the shape to display if drag is accepted.

This method will be invoked only if isDragAccepted returns true

As this method can be called on every mouse drag over a component, it is a good practice to reuse the same shape as lond a possible (do not create a new Shape at every invocation).

isDragAccepted

public boolean isDragAccepted()
returns true if drag is accepted.

Returns: true if drag is accepted

isDragDelegated

public boolean isDragDelegated()
If drag is not accepted, this method will be invoked to evaluate a delegating event processing.

This is useful for nested DropReceivers (like TabbedDockableContainers)

rejectDrag

public void rejectDrag()
Used to reject the drag (e.g. when trying to drop a component onto itself)
© Copyright 2004-2007 VLSolutions. All Rights Reserved.
www.vlsolutions.com : Java Components - Smart Client Applications