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
ConstructorsConstructorDescriptionTLcyGXYAsynchronousLayerSelectionTransferHandler(ILcyLucyEnv aLucyEnv, ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) Creates a new transfer handler. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanImport(DataFlavor[] aFlavors, ILcdLayer aDestinationLayer, ILcdView aDestinationView) This method determines whether thisALcyLayerSelectionTransferHandlercan import the givenTransferable.createTransferable(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView) Creates the transferable to exportaSelection.voidexportDone(Transferable aData, ILcdLayer aSourceLayer, ILcdView aSourceView, int aAction) This method is called when the export is done.intgetSourceActions(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView) This method determines what thisALcyLayerSelectionTransferHandlercan do with the given selection.booleanimportData(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- TheALcyLayerSelectionTransferHandlerfor 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:ALcyLayerSelectionTransferHandlerThis method determines whether thisALcyLayerSelectionTransferHandlercan import the givenTransferable. Typically this method will check if thisALcyLayerSelectionTransferHandlercan do something with one of theDataFlavors contained inaData.- Specified by:
canImportin classALcyLayerSelectionTransferHandler- Parameters:
aFlavors- The available flavors in which the data to import can be represented.aDestinationLayer- TheILcdLayerin which the data should be imported.aDestinationView- TheILcdViewwhich containsaDestinationLayer.- Returns:
trueif thisALcyLayerSelectionTransferHandlercan importaData.
-
createTransferable
public Transferable createTransferable(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView) Description copied from class:ALcyLayerSelectionTransferHandlerCreates the transferable to exportaSelection.- Specified by:
createTransferablein classALcyLayerSelectionTransferHandler- Parameters:
aSelection- The selection that is to exported.aSourceLayer- TheILcdLayerthat contains aSelection.aSourceView- TheILcdViewthat contains aSelection.- Returns:
- The
Transferablethat contains the exported data in various flavors.
-
exportDone
public void exportDone(Transferable aData, ILcdLayer aSourceLayer, ILcdView aSourceView, int aAction) Description copied from class:ALcyLayerSelectionTransferHandlerThis method is called when the export is done. Typically in this method you will delete the original objects ifaActionwasMOVE.- Specified by:
exportDonein classALcyLayerSelectionTransferHandler- Parameters:
aData- TheTransferablethat was exported.aSourceLayer- TheILcdLayercontaining the original objects. PossiblynullifaActionisNONE.aSourceView- TheILcdViewcontaining the original objects. PossiblynullifaActionisNONE.aAction- The action that was performed with the transferable.
-
getSourceActions
Description copied from class:ALcyLayerSelectionTransferHandlerThis method determines what thisALcyLayerSelectionTransferHandlercan 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 thisALcyLayerSelectionTransferHandlercan only copy the selection.ALcyLayerSelectionTransferHandler.MOVE: indicates thisALcyLayerSelectionTransferHandlercan only move the selection.ALcyLayerSelectionTransferHandler.COPY_OR_MOVE: indicates thisALcyLayerSelectionTransferHandlercan either move or copy the selection.
- Specified by:
getSourceActionsin classALcyLayerSelectionTransferHandler- Parameters:
aSelection- The selection that is to exported.aSourceLayer- TheILcdLayerthat contains aSelection.aSourceView- TheILcdViewthat contains aSelection.- Returns:
- The action that this
ALcyLayerSelectionTransferHandlercan perform on aSelection.
-
importData
public boolean importData(Transferable aData, ILcdLayer aDestinationLayer, ILcdView aDestinationView) Description copied from class:ALcyLayerSelectionTransferHandlerActually imports the data into the destination layers.- Specified by:
importDatain classALcyLayerSelectionTransferHandler- Parameters:
aData- The data to be imported.aDestinationLayer- TheILcdLayerin which the data should be imported.aDestinationView- TheILcdViewwhich containsaDestinationLayer.- Returns:
- Whether or not the import went successfully.
-