org.jdesktop.wonderland.client.jme.dnd
Class URIListDataFlavorHandler

java.lang.Object
  extended by org.jdesktop.wonderland.client.jme.dnd.URIListDataFlavorHandler
All Implemented Interfaces:
DataFlavorHandlerSPI

public class URIListDataFlavorHandler
extends java.lang.Object
implements DataFlavorHandlerSPI

A handler to support drag-and-drop from a URI (perhaps from a web browser). The data flavor supported has the mime type "application/x-java-url". This simply looks for a Cell that can handle the data type and launches it.

Author:
Jordan Slott

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jdesktop.wonderland.client.jme.dnd.spi.DataFlavorHandlerSPI
DataFlavorHandlerSPI.ImportResultListener
 
Constructor Summary
URIListDataFlavorHandler()
           
 
Method Summary
 boolean accept(DropTargetEvent3D event, java.awt.datatransfer.DataFlavor dataFlavor)
          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 event, java.awt.datatransfer.DataFlavor flavor)
          Returns the file extension of the given event, if the extension can be determined.
 void handleDrop(DropTargetDropEvent3D event, java.awt.datatransfer.DataFlavor dataFlavor)
          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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URIListDataFlavorHandler

public URIListDataFlavorHandler()
Method Detail

getDataFlavors

public java.awt.datatransfer.DataFlavor[] getDataFlavors()
Description copied from interface: DataFlavorHandlerSPI
Returns an array of DataFlavors that this class supports. If none, then return an empty array.

Specified by:
getDataFlavors in interface DataFlavorHandlerSPI

getFileExtension

public java.lang.String getFileExtension(DropTargetEvent3D event,
                                         java.awt.datatransfer.DataFlavor flavor)
Description copied from interface: DataFlavorHandlerSPI
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.

Specified by:
getFileExtension in interface DataFlavorHandlerSPI

accept

public boolean accept(DropTargetEvent3D event,
                      java.awt.datatransfer.DataFlavor dataFlavor)
Description copied from interface: DataFlavorHandlerSPI
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

Specified by:
accept in interface DataFlavorHandlerSPI

handleDrop

public void handleDrop(DropTargetDropEvent3D event,
                       java.awt.datatransfer.DataFlavor dataFlavor)
Description copied from interface: DataFlavorHandlerSPI
Handles when an item has been dropped into the world with a data flavor supported by this class.

Specified by:
handleDrop in interface DataFlavorHandlerSPI
dataFlavor - the flavor being queried for

handleImport

public void handleImport(DropTargetDropEvent3D dtde,
                         java.awt.datatransfer.DataFlavor flavor,
                         DataFlavorHandlerSPI.ImportResultListener listener)
Description copied from interface: DataFlavorHandlerSPI
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.

Specified by:
handleImport in interface DataFlavorHandlerSPI
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