Class TLcyGXYAsynchronousLayerSelectionTransferHandler

java.lang.Object
com.luciad.lucy.datatransfer.ALcyLayerSelectionTransferHandler
com.luciad.lucy.map.asynchronous.TLcyGXYAsynchronousLayerSelectionTransferHandler
All Implemented Interfaces:
ILcdUndoableSource

public class TLcyGXYAsynchronousLayerSelectionTransferHandler extends ALcyLayerSelectionTransferHandler

Asynchronous layer selection transfer handler, wrapping around an existing handler. It allows to easily convert an existing transfer handler into a transfer handler that supports asynchronous painting.

It assumes that the methods canImport, getSourceActions and createTransferable do not modify any of the properties of the layer but simply read some of the properties of the layer or its model. In case of the exportDone method, this wrapper assumes that the layer nor its model is modified when the action was COPY. If the action was MOVE, the wrapper does expect the layer or its model to be modified. The method importData is always expected to change the layer and/or its model.

This wrapper should only be used for ALcyLayerSelectionTransferHandler handlers that operate on ILcdGXYLayer layers. If the transfer handler is used for other kinds of ILcdLayer instances, then this wrapper has no effect and the functionality of the original transfer handler is unmodified.

Since:
8.1
  • Constructor Details

    • TLcyGXYAsynchronousLayerSelectionTransferHandler

      public TLcyGXYAsynchronousLayerSelectionTransferHandler(ILcyLucyEnv aLucyEnv, ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler)
      Creates a new transfer handler.
      Parameters:
      aLucyEnv - The Lucy backend for which this transfer handler is created.
      aLayerSelectionTransferHandler - The ALcyLayerSelectionTransferHandler for which asynchronous painting must be taken into account. Must not be null.
  • Method Details

    • canImport

      public boolean canImport(DataFlavor[] aFlavors, ILcdLayer aDestinationLayer, ILcdView aDestinationView)
      Description copied from class: ALcyLayerSelectionTransferHandler
      This method determines whether this ALcyLayerSelectionTransferHandler can import the given Transferable. Typically this method will check if this ALcyLayerSelectionTransferHandler can do something with one of the DataFlavors contained in aData.
      Specified by:
      canImport in class ALcyLayerSelectionTransferHandler
      Parameters:
      aFlavors - The available flavors in which the data to import can be represented.
      aDestinationLayer - The ILcdLayer in which the data should be imported.
      aDestinationView - The ILcdView which contains aDestinationLayer.
      Returns:
      true if this ALcyLayerSelectionTransferHandler can import aData.
    • createTransferable

      public Transferable createTransferable(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView)
      Description copied from class: ALcyLayerSelectionTransferHandler
      Creates the transferable to export aSelection.
      Specified by:
      createTransferable in class ALcyLayerSelectionTransferHandler
      Parameters:
      aSelection - The selection that is to exported.
      aSourceLayer - The ILcdLayer that contains aSelection.
      aSourceView - The ILcdView that contains aSelection.
      Returns:
      The Transferable that contains the exported data in various flavors.
    • exportDone

      public void exportDone(Transferable aData, ILcdLayer aSourceLayer, ILcdView aSourceView, int aAction)
      Description copied from class: ALcyLayerSelectionTransferHandler
      This method is called when the export is done. Typically in this method you will delete the original objects if aAction was MOVE.
      Specified by:
      exportDone in class ALcyLayerSelectionTransferHandler
      Parameters:
      aData - The Transferable that was exported.
      aSourceLayer - The ILcdLayer containing the original objects. Possibly null if aAction is NONE.
      aSourceView - The ILcdView containing the original objects. Possibly null if aAction is NONE.
      aAction - The action that was performed with the transferable.
    • getSourceActions

      public int getSourceActions(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView)
      Description copied from class: ALcyLayerSelectionTransferHandler
      This method determines what this ALcyLayerSelectionTransferHandler can do with the given selection. The return value should be one of:
      Specified by:
      getSourceActions in class ALcyLayerSelectionTransferHandler
      Parameters:
      aSelection - The selection that is to exported.
      aSourceLayer - The ILcdLayer that contains aSelection.
      aSourceView - The ILcdView that contains aSelection.
      Returns:
      The action that this ALcyLayerSelectionTransferHandler can perform on aSelection.
    • importData

      public boolean importData(Transferable aData, ILcdLayer aDestinationLayer, ILcdView aDestinationView)
      Description copied from class: ALcyLayerSelectionTransferHandler
      Actually imports the data into the destination layers.
      Specified by:
      importData in class ALcyLayerSelectionTransferHandler
      Parameters:
      aData - The data to be imported.
      aDestinationLayer - The ILcdLayer in which the data should be imported.
      aDestinationView - The ILcdView which contains aDestinationLayer.
      Returns:
      Whether or not the import went successfully.