org.apache.ojb.tools.mapping.reversedb2.dnd2
Interface DropPasteWorkerInterface

All Known Implementing Classes:
RejectAllDropWorker, ReverseDbNodesDropWorker, ReverseDbNodesToOjbMetaDropWorker

public interface DropPasteWorkerInterface

This interface is used by DropTargetHelper to determine whether a drop can be performed and to import the data from the transferable into the model of the component.

Version:
$Id: DropPasteWorkerInterface.java,v 1.5 2002/11/08 13:29:30 brj Exp $
Author:
Florian Bruckner

Method Summary
 int getAcceptableActions(java.awt.Component c)
          Returns a bitmask of acceptable actions for this component.
 int getAcceptableActions(java.awt.Component c, java.awt.datatransfer.DataFlavor[] flavor)
          Returns a bitmaks of acceptable actions for the supplied Component and DataFlavor.
 java.awt.datatransfer.DataFlavor getSupportedDataFlavor()
           
 boolean importData(java.awt.Component c, java.awt.datatransfer.Transferable t, int action)
          This is the method that is doing the real work.
 

Method Detail

getSupportedDataFlavor

public java.awt.datatransfer.DataFlavor getSupportedDataFlavor()
Returns:
the DataFlavor this Worker is going to accept.

getAcceptableActions

public int getAcceptableActions(java.awt.Component c,
                                java.awt.datatransfer.DataFlavor[] flavor)
Returns a bitmaks of acceptable actions for the supplied Component and DataFlavor. If more than one DataFlavor is queried, the resulting bitmask should include all possible actions for all flavors.

Parameters:
c - The component that is the possible drop target.
flavor - The DataFlavours that are associate with the drop action
Returns:
a bitmask of actions this Worker can process with the supplied flavors.

getAcceptableActions

public int getAcceptableActions(java.awt.Component c)
Returns a bitmask of acceptable actions for this component. As this method doesn't provide the DataFlavors in this action, all possible acceptable actions should be returned. All possible actions are defined in DnDWorkerConstants

Parameters:
c - The component where the drop could occur.
Returns:
a bitmask of actions this Worker capable of.

importData

public boolean importData(java.awt.Component c,
                          java.awt.datatransfer.Transferable t,
                          int action)
This is the method that is doing the real work. You get the Component where the drop has occurred, the Transferable with the data and the requested action.

Parameters:
c - The component where the drop has occurred
t - The transferable that shall be imported
action - The action that should be performed.
Returns:
true if the transfer was successful, false if not. If there are more than one Workers are registered with the helper and this method returns false, the next helper is asked to do the import. If true is returned, the action is supposed to be complete and no other worker will be asked. So be careful what you return here, if you return false, no modification to the target model should have happened.


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14