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.
COPY, COPY_OR_MOVE, MOVE, NONE
Constructor and Description |
---|
TLcyGXYAsynchronousLayerSelectionTransferHandler(ILcyLucyEnv aLucyEnv,
ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler)
Creates a new transfer handler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canImport(DataFlavor[] aFlavors,
ILcdLayer aDestinationLayer,
ILcdView aDestinationView)
This method determines whether this
ALcyLayerSelectionTransferHandler can import
the given Transferable . |
Transferable |
createTransferable(ILcdSelection aSelection,
ILcdLayer aSourceLayer,
ILcdView aSourceView)
Creates the transferable to export
aSelection . |
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 this
ALcyLayerSelectionTransferHandler can do with the
given selection. |
boolean |
importData(Transferable aData,
ILcdLayer aDestinationLayer,
ILcdView aDestinationView)
Actually imports the data into the destination layers.
|
addLogListener, addUndoableListener, fireUndoableHappened, getLogListener, removeLogListener, removeUndoableListener
public TLcyGXYAsynchronousLayerSelectionTransferHandler(ILcyLucyEnv aLucyEnv, ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler)
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
.public boolean canImport(DataFlavor[] aFlavors, ILcdLayer aDestinationLayer, ILcdView aDestinationView)
ALcyLayerSelectionTransferHandler
ALcyLayerSelectionTransferHandler
can import
the given Transferable
. Typically this method will check if this
ALcyLayerSelectionTransferHandler
can do something with one of the
DataFlavor
s contained in aData
.canImport
in class ALcyLayerSelectionTransferHandler
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
.true
if this ALcyLayerSelectionTransferHandler
can import
aData
.public Transferable createTransferable(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView)
ALcyLayerSelectionTransferHandler
aSelection
.createTransferable
in class ALcyLayerSelectionTransferHandler
aSelection
- The selection that is to exported.aSourceLayer
- The ILcdLayer
that contains aSelection.aSourceView
- The ILcdView
that contains aSelection.Transferable
that contains the exported data in various flavors.public void exportDone(Transferable aData, ILcdLayer aSourceLayer, ILcdView aSourceView, int aAction)
ALcyLayerSelectionTransferHandler
aAction
was MOVE
.exportDone
in class ALcyLayerSelectionTransferHandler
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.public int getSourceActions(ILcdSelection aSelection, ILcdLayer aSourceLayer, ILcdView aSourceView)
ALcyLayerSelectionTransferHandler
ALcyLayerSelectionTransferHandler
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 this ALcyLayerSelectionTransferHandler
can only copy
the selection.ALcyLayerSelectionTransferHandler.MOVE
: indicates this ALcyLayerSelectionTransferHandler
can only move the selection.ALcyLayerSelectionTransferHandler.COPY_OR_MOVE
: indicates this
ALcyLayerSelectionTransferHandler
can either move or copy the selection.getSourceActions
in class ALcyLayerSelectionTransferHandler
aSelection
- The selection that is to exported.aSourceLayer
- The ILcdLayer
that contains aSelection.aSourceView
- The ILcdView
that contains aSelection.ALcyLayerSelectionTransferHandler
can perform on
aSelection.public boolean importData(Transferable aData, ILcdLayer aDestinationLayer, ILcdView aDestinationView)
ALcyLayerSelectionTransferHandler
importData
in class ALcyLayerSelectionTransferHandler
aData
- The data to be imported.aDestinationLayer
- The ILcdLayer
in which the data should be imported.aDestinationView
- The ILcdView
which contains
aDestinationLayer
.