org.jdesktop.wonderland.client.jme.dnd.spi
Interface DataFlavorHandlerSPI

All Known Implementing Classes:
FileListDataFlavorHandler, URIListDataFlavorHandler, URLDataFlavorHandler

public interface DataFlavorHandlerSPI

Handler for different data flavors for drag-and-drop. Classes implement this interface to handle different DataFlavor objects when dropped into the world.

Author:
Jordan Slott

Nested Class Summary
static interface DataFlavorHandlerSPI.ImportResultListener
          An interface for the results of import
 
Method Summary
 boolean accept(DropTargetEvent3D dtde, java.awt.datatransfer.DataFlavor flavor)
          Returns true to accept the event.
 java.awt.datatransfer.DataFlavor[] getDataFlavors()
          Returns an array of DataFlavors that this class supports.
 java.lang.String getFileExtension(DropTargetEvent3D dtde, java.awt.datatransfer.DataFlavor flavor)
          Returns the file extension of the given event, if the extension can be determined.
 void handleDrop(DropTargetDropEvent3D dtde, java.awt.datatransfer.DataFlavor flavor)
          Handles when an item has been dropped into the world with a data flavor supported by this class.
 void handleImport(DropTargetDropEvent3D dtde, java.awt.datatransfer.DataFlavor flavor, DataFlavorHandlerSPI.ImportResultListener listener)
          Handles importing a file with the given data flavor (using the content import manager).
 

Method Detail

getDataFlavors

java.awt.datatransfer.DataFlavor[] getDataFlavors()
Returns an array of DataFlavors that this class supports. If none, then return an empty array.

Parameters:
An - array of DataFlavor objects

getFileExtension

java.lang.String getFileExtension(DropTargetEvent3D dtde,
                                  java.awt.datatransfer.DataFlavor flavor)
Returns the file extension of the given event, if the extension can be determined. If the extension cannot be determined from the given event, return null.


accept

boolean accept(DropTargetEvent3D dtde,
               java.awt.datatransfer.DataFlavor flavor)
Returns true to accept the event. This method provides the handler the additional ability to either accept or reject the event. If rejected, the system tries to find another suitable data flavor handler

Parameters:
event - the event to handle
dataFlavor - the flavor being queried for

handleDrop

void handleDrop(DropTargetDropEvent3D dtde,
                java.awt.datatransfer.DataFlavor flavor)
Handles when an item has been dropped into the world with a data flavor supported by this class.

Parameters:
event - the event to handle
flavor - the flavor being queried for

handleImport

void handleImport(DropTargetDropEvent3D dtde,
                  java.awt.datatransfer.DataFlavor flavor,
                  DataFlavorHandlerSPI.ImportResultListener listener)
Handles importing a file with the given data flavor (using the content import manager). When the import completes, the given listener will be asynchronously notified with the status.

Parameters:
event - the event to handle
flavor - the flavor to handle
listener - the import listener to notify with the results of the import, or null if no listener should be notified.


Open Wonderland - http://openwonderland.org