Class TLcyGXYAsynchronousLayerSelectionTransferHandler
- All Implemented Interfaces:
ILcdUndoableSource
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
-
Field Summary
Fields inherited from class com.luciad.lucy.datatransfer.ALcyLayerSelectionTransferHandler
COPY, COPY_OR_MOVE, MOVE, NONE
-
Constructor Summary
ConstructorDescriptionTLcyGXYAsynchronousLayerSelectionTransferHandler
(ILcyLucyEnv aLucyEnv, ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) Creates a new transfer handler. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canImport
(DataFlavor[] aFlavors, ILcdLayer aDestinationLayer, ILcdView aDestinationView) This method determines whether thisALcyLayerSelectionTransferHandler
can import the givenTransferable
.createTransferable
(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView) Creates the transferable to exportaSelection
.void
exportDone
(Transferable aData, ILcdLayer aSourceLayer, ILcdView aSourceView, int aAction) This method is called when the export is done.int
getSourceActions
(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView) This method determines what thisALcyLayerSelectionTransferHandler
can do with the given selection.boolean
importData
(Transferable aData, ILcdLayer aDestinationLayer, ILcdView aDestinationView) Actually imports the data into the destination layers.Methods inherited from class com.luciad.lucy.datatransfer.ALcyLayerSelectionTransferHandler
addLogListener, addUndoableListener, fireUndoableHappened, getLogListener, removeLogListener, removeUndoableListener
-
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
- TheALcyLayerSelectionTransferHandler
for which asynchronous painting must be taken into account. Must not benull
.
-
-
Method Details
-
canImport
public boolean canImport(DataFlavor[] aFlavors, ILcdLayer aDestinationLayer, ILcdView aDestinationView) Description copied from class:ALcyLayerSelectionTransferHandler
This method determines whether thisALcyLayerSelectionTransferHandler
can import the givenTransferable
. Typically this method will check if thisALcyLayerSelectionTransferHandler
can do something with one of theDataFlavor
s contained inaData
.- Specified by:
canImport
in classALcyLayerSelectionTransferHandler
- Parameters:
aFlavors
- The available flavors in which the data to import can be represented.aDestinationLayer
- TheILcdLayer
in which the data should be imported.aDestinationView
- TheILcdView
which containsaDestinationLayer
.- Returns:
true
if thisALcyLayerSelectionTransferHandler
can importaData
.
-
createTransferable
public Transferable createTransferable(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView) Description copied from class:ALcyLayerSelectionTransferHandler
Creates the transferable to exportaSelection
.- Specified by:
createTransferable
in classALcyLayerSelectionTransferHandler
- Parameters:
aSelection
- The selection that is to exported.aSourceLayer
- TheILcdLayer
that contains aSelection.aSourceView
- TheILcdView
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 ifaAction
wasMOVE
.- Specified by:
exportDone
in classALcyLayerSelectionTransferHandler
- Parameters:
aData
- TheTransferable
that was exported.aSourceLayer
- TheILcdLayer
containing the original objects. Possiblynull
ifaAction
isNONE
.aSourceView
- TheILcdView
containing the original objects. Possiblynull
ifaAction
isNONE
.aAction
- The action that was performed with the transferable.
-
getSourceActions
Description copied from class:ALcyLayerSelectionTransferHandler
This method determines what thisALcyLayerSelectionTransferHandler
can do with the given selection. The return value should be one of:ALcyLayerSelectionTransferHandler.NONE
: indicates this transfer handler cannot export the selection.ALcyLayerSelectionTransferHandler.COPY
: indicates thisALcyLayerSelectionTransferHandler
can only copy the selection.ALcyLayerSelectionTransferHandler.MOVE
: indicates thisALcyLayerSelectionTransferHandler
can only move the selection.ALcyLayerSelectionTransferHandler.COPY_OR_MOVE
: indicates thisALcyLayerSelectionTransferHandler
can either move or copy the selection.
- Specified by:
getSourceActions
in classALcyLayerSelectionTransferHandler
- Parameters:
aSelection
- The selection that is to exported.aSourceLayer
- TheILcdLayer
that contains aSelection.aSourceView
- TheILcdView
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 classALcyLayerSelectionTransferHandler
- Parameters:
aData
- The data to be imported.aDestinationLayer
- TheILcdLayer
in which the data should be imported.aDestinationView
- TheILcdView
which containsaDestinationLayer
.- Returns:
- Whether or not the import went successfully.
-