com.levigo.jadice.swing.dnd
Class CompositeImportHandler

java.lang.Object
  extended by com.levigo.jadice.swing.dnd.CompositeImportHandler
All Implemented Interfaces:
ImportHandler, com.levigo.jadice.swing.internal.transfer.SelfDescribingImportHandler

public class CompositeImportHandler
extends Object
implements ImportHandler, com.levigo.jadice.swing.internal.transfer.SelfDescribingImportHandler

An ImportHandler encompassing a set of delegate ImportHandlers. The data flavors supported by this handler are the union of all supported data flavors of the element handlers.

The encompassed handlers will be called in the same order as the were given in the constructors. Hence integrators are advised to order the handlers from the most specific to the most general one.

See Also:
CompositeExportHandler

Constructor Summary
CompositeImportHandler(ImportHandler... delegates)
          Create a CompositeImportHandler using the given array of delegate handlers.
CompositeImportHandler(List<? extends ImportHandler> delegates)
          Create a CompositeImportHandler using the given list of delegate handlers.
 
Method Summary
 String getImportActionDescription(Transferable data, int importAction, ImportParameters parameters)
           
 int getImportActionForFlavor(DataFlavor flavor, ImportParameters parameters)
          Returns the accepted DnD action for the given DataFlavor by this import handler.
 boolean importData(Transferable t, int dropAction, ImportParameters parameters)
          Import from the given Transferable into the given ViewComponent.
 boolean isDataFlavorSupported(DataFlavor flavor, ImportParameters parameters)
          Check whether the given DataFlavor is supported by this import handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeImportHandler

public CompositeImportHandler(ImportHandler... delegates)
Create a CompositeImportHandler using the given array of delegate handlers.

Parameters:
delegates - The delegate ImportHandlers

CompositeImportHandler

public CompositeImportHandler(List<? extends ImportHandler> delegates)
Create a CompositeImportHandler using the given list of delegate handlers.

Parameters:
delegates - The delegate ImportHandlers
Method Detail

importData

public boolean importData(Transferable t,
                          int dropAction,
                          ImportParameters parameters)
                   throws IOException,
                          UnsupportedFlavorException,
                          JadiceException
Description copied from interface: ImportHandler
Import from the given Transferable into the given ViewComponent.

Specified by:
importData in interface ImportHandler
Parameters:
t - The Transferable to import
dropAction - the user drop action of the import
parameters - the import parameters containing additional context information
Returns:
true if the import succeeded
Throws:
IOException
UnsupportedFlavorException
JadiceException

isDataFlavorSupported

public boolean isDataFlavorSupported(DataFlavor flavor,
                                     ImportParameters parameters)
Description copied from interface: ImportHandler
Check whether the given DataFlavor is supported by this import handler.

Specified by:
isDataFlavorSupported in interface ImportHandler
Parameters:
flavor - The flavor in which the transfer bundle will be provided when supported.
parameters - the import parameters containing additional context information
Returns:
true if the given flavor is supported.

getImportActionForFlavor

public int getImportActionForFlavor(DataFlavor flavor,
                                    ImportParameters parameters)
Description copied from interface: ImportHandler
Returns the accepted DnD action for the given DataFlavor by this import handler.

Specified by:
getImportActionForFlavor in interface ImportHandler
Parameters:
flavor - The flavor in which the transfer bundle will be provided when supported.
parameters - the import parameters containing additional context information
Returns:
int one of the DnDConstants action constants. Returns which DnD action will be accepted by this import handler for the given flavor. If the flavor is not supported DnDConstants.ACTION_NONE will be returned.
See Also:
ImportHandler.getImportActionForFlavor(java.awt.datatransfer.DataFlavor, ImportParameters)

getImportActionDescription

public String getImportActionDescription(Transferable data,
                                         int importAction,
                                         ImportParameters parameters)
Specified by:
getImportActionDescription in interface com.levigo.jadice.swing.internal.transfer.SelfDescribingImportHandler


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.