Search this API

y.view
Interface DropSupport.EventHandler

Enclosing class:
DropSupport

public static interface DropSupport.EventHandler

Handles data flavor dependent access to drag and drop events for DropSupport's default node and edge transfers.

Implementations of this interface may be used to leverage DropSupport's default node and edge transfers for custom data flavors. I.e. for inter-process drag and drop support, DropSupport's default data flavors cannot be used. In that case, a custom EventHandler implementation for e.g. a text flavor may be used.

 

Method Summary
 boolean accept(java.awt.dnd.DropTargetDragEvent e)
          Determines whether the current drag and drop operation should be continued or aborted.
 boolean accept(java.awt.dnd.DropTargetDropEvent e)
          Determines whether the current drag and drop operation should be continued or aborted.
 boolean canHandle(java.awt.dnd.DropTargetDragEvent e)
          Determines whether or not this handler should be used for the drag and drop operation initiated by the specified drag enter event.
 java.lang.Object getTransferData(java.awt.dnd.DropTargetDragEvent e)
          Retrieves the transfer data from the specified event.
 java.lang.Object getTransferData(java.awt.dnd.DropTargetDropEvent e)
          Retrieves the transfer data from the specified event.
 

Method Detail

canHandle

boolean canHandle(java.awt.dnd.DropTargetDragEvent e)
Determines whether or not this handler should be used for the drag and drop operation initiated by the specified drag enter event.

If different data flavors are used for node and edge transfers, this method may unconditionally return false. Only if the same flavor is used for both node and edge transfers (e.g. a text flavor for inter-process drag and drop support), this check is necessary to differentiate between node transfers and edge transfers.

Parameters:
e - the drag enter event that initiates a new drag and drop operation.
Returns:
true if this handler should be used for the initiated drag and drop operation and false if DropSupport's default mechanism for determining the appropriate handler should be used.
See Also:
DropSupport.setEdgeEventHandler(y.view.DropSupport.EventHandler), DropSupport.setNodeEventHandler(y.view.DropSupport.EventHandler)

accept

boolean accept(java.awt.dnd.DropTargetDragEvent e)
Determines whether the current drag and drop operation should be continued or aborted.

Parameters:
e - the currently processed event.
Returns:
true if the drag and drop operation should be continued; false if the drag and drop operation should be aborted.

accept

boolean accept(java.awt.dnd.DropTargetDropEvent e)
Determines whether the current drag and drop operation should be continued or aborted.

Parameters:
e - the currently processed event.
Returns:
true if the drag and drop operation should be continued; false if the drag and drop operation should be aborted.

getTransferData

java.lang.Object getTransferData(java.awt.dnd.DropTargetDragEvent e)
Retrieves the transfer data from the specified event.

Depending on whether this handler is used for node or edge transfers, this method has to return either a NodeRealizer or an EdgeRealizer instance.

Parameters:
e - the event from which to extract the transfer data.
Returns:
the NodeRealizer or EdgeRealizer instance representing the specified event's transfer data.
See Also:
DropSupport.setEdgeEventHandler(y.view.DropSupport.EventHandler), DropSupport.setNodeEventHandler(y.view.DropSupport.EventHandler)

getTransferData

java.lang.Object getTransferData(java.awt.dnd.DropTargetDropEvent e)
Retrieves the transfer data from the specified event.

Depending on whether this handler is used for node or edge transfers, this method has to return either a NodeRealizer or an EdgeRealizer instance.

Parameters:
e - the event from which to extract the transfer data.
Returns:
the NodeRealizer or EdgeRealizer instance representing the specified event's transfer data.
See Also:
DropSupport.setEdgeEventHandler(y.view.DropSupport.EventHandler), DropSupport.setNodeEventHandler(y.view.DropSupport.EventHandler)

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.