org.globus.cog.gridface.impl.desktop.dnd
Class DesktopTransferHandler

java.lang.Object
  extended byjavax.swing.TransferHandler
      extended byorg.globus.cog.gridface.impl.desktop.dnd.DesktopTransferHandler
All Implemented Interfaces:
Serializable

public class DesktopTransferHandler
extends TransferHandler

See Also:
Serialized Form

Field Summary
protected  JComponent dragComponent
          Component where drag was initiated
protected  int dragPoint_x
          Point where drag initiated on the component
protected  int dragPoint_y
           
protected  JComponent dropComponent
          Component on which drop happened
protected static org.globus.cog.gridface.impl.desktop.dnd.DesktopTransferHandler.DropHandler dropHandler
          DropHandler to handle drop actions during drag
protected  int dropPoint_x
          Point where drop happened on Desktop
protected  int dropPoint_y
           
static boolean isImportDesktopIconGroup
           
static boolean isSystemImportToDesktop
           
static boolean isSystemLinuxImportToDesktop
           
static boolean isSystemWindowsImportToDesktop
           
 
Fields inherited from class javax.swing.TransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
 
Constructor Summary
DesktopTransferHandler()
           
 
Method Summary
 boolean canImport(JComponent dropComponent, DataFlavor[] flavors)
           
protected  Transferable createTransferable(JComponent dragComponent)
          Third method called during drag and drop.
 void exportAsDrag(JComponent comp, InputEvent e, int action)
          First method being called to initiate drag, usually by mouseDragged in MouseMotionListener.
 JComponent getDragComponent()
           
 Point getDragPoint()
           
 JComponent getDropComponent()
           
static org.globus.cog.gridface.impl.desktop.dnd.DesktopTransferHandler.DropHandler getDropHandler()
           
 Point getDropPoint()
           
 int getSourceActions(JComponent c)
          Second method called after initiating drag to get supported actions
 boolean importData(JComponent c, Transferable t)
          Most important method during drop operation.
 void setDragComponent(JComponent dragComponent)
           
 void setDragPoint(Point dragPoint)
           
 void setDropComponent(JComponent dropComponent)
           
 void setDropPoint(Point dropPoint)
           
 
Methods inherited from class javax.swing.TransferHandler
exportDone, exportToClipboard, getCopyAction, getCutAction, getPasteAction, getVisualRepresentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isSystemImportToDesktop

public static boolean isSystemImportToDesktop

isSystemLinuxImportToDesktop

public static boolean isSystemLinuxImportToDesktop

isSystemWindowsImportToDesktop

public static boolean isSystemWindowsImportToDesktop

isImportDesktopIconGroup

public static boolean isImportDesktopIconGroup

dragPoint_x

protected int dragPoint_x
Point where drag initiated on the component


dragPoint_y

protected int dragPoint_y

dropPoint_x

protected int dropPoint_x
Point where drop happened on Desktop


dropPoint_y

protected int dropPoint_y

dragComponent

protected JComponent dragComponent
Component where drag was initiated


dropComponent

protected JComponent dropComponent
Component on which drop happened


dropHandler

protected static org.globus.cog.gridface.impl.desktop.dnd.DesktopTransferHandler.DropHandler dropHandler
DropHandler to handle drop actions during drag

Constructor Detail

DesktopTransferHandler

public DesktopTransferHandler()
Method Detail

exportAsDrag

public void exportAsDrag(JComponent comp,
                         InputEvent e,
                         int action)
First method being called to initiate drag, usually by mouseDragged in MouseMotionListener. This method overrides TransferHandler exportAsDrag and saves drag initiating component and the drag location.


getSourceActions

public int getSourceActions(JComponent c)
Second method called after initiating drag to get supported actions

Returns:
source action supported

createTransferable

protected Transferable createTransferable(JComponent dragComponent)
Third method called during drag and drop. Creates DestkopIconTransferable object containing the selected icons on our desktop

Returns:
DesktopIconTransferable object containing selected icons on desktop

canImport

public boolean canImport(JComponent dropComponent,
                         DataFlavor[] flavors)
Returns:
true if data flavor is supported

importData

public boolean importData(JComponent c,
                          Transferable t)
Most important method during drop operation. This method is called by the drop method in DropHandler after a succesful drop. This method performs actions of moving icons if drop is on desktop, or launching if drop is on icon.

Returns:
true if import was successful

getDropHandler

public static org.globus.cog.gridface.impl.desktop.dnd.DesktopTransferHandler.DropHandler getDropHandler()
Returns:
return drop handler

getDropPoint

public Point getDropPoint()

setDropPoint

public void setDropPoint(Point dropPoint)

getDragPoint

public Point getDragPoint()

setDragPoint

public void setDragPoint(Point dragPoint)

getDragComponent

public JComponent getDragComponent()

setDragComponent

public void setDragComponent(JComponent dragComponent)

getDropComponent

public JComponent getDropComponent()

setDropComponent

public void setDropComponent(JComponent dropComponent)