Class TLcyDataTransferManager
This manager is a central container for ALcyLayerSelectionTransferHandler
objects
by using a TLcyCompositeLayerSelectionTransferHandler
. The
registered ALcyLayerSelectionTransferHandler
objects are responsible for converting
model objects from one representation to another. This allows Lucy to provide, for instance,
copy/paste functionality.
Consult the javadoc of TLcyCompositeLayerSelectionTransferHandler
for more information about adding and/or removing ALcyLayerSelectionTransferHandler
s,
either directly to the TLcyCompositeLayerSelectionTransferHandler
or by using the
Lucy back-end services.
Obtaining, adding and/or removing ALcyLayerSelectionTransferHandler
instances can
either be achieved by using the corresponding methods in this class, or by using the
corresponding methods provided in TLcyCompositeLayerSelectionTransferHandler
.
When using the back-end based TLcyDataTransferManager
, obtaining, adding and/or
removing ALcyLayerSelectionTransferHandler
instances can be achieved on any back-end
based TLcyCompositeLayerSelectionTransferHandler
, e.g. there is no need to go through this
TLcyDataTransferManager
. This is illustrated in the code snippets below, which
are equivalent:
Obtaining, adding and/or removing an ALcyLayerSelectionTransferHandler
through a
back-end based TLcyDataTransferManager
:
//Create a new instance whenever you need it
TLcyDataTransferManager manager = new TLcyDataTransferManager( aLucyEnv );
//add a handler
manager.addLayerSelectionTransferHandler( aLayerSelectionTransferHandler );
//remove a handler
manager.removeLayerSelectionTransferHandler( anotherLayerSelectionTransferHandler );
//obtain a handler
ALcyLayerSelectionTransferHandler handler =
manager.getLayerSelectionTransferHandler( manager.getLayerSelectionTransferHandlerCount() -1 );
//There is no need to keep a reference to the composite instance, you can create a new one
//the next time you would need it
manager = null;
Obtaining, adding and/or removing an ALcyLayerSelectionTransferHandler
through a
back-end based TLcyCompositeLayerSelectionTransferHandler
:
//Create a new instance whenever you need it
TLcyCompositeLayerSelectionTransferHandler composite = new TLcyCompositeLayerSelectionTransferHandler( aLucyEnv );
//add a handler
composite.addLayerSelectionTransferHandler( aLayerSelectionTransferHandler );
//remove a handler
composite.removeLayerSelectionTransferHandler( anotherLayerSelectionTransferHandler );
//obtain a handler
ALcyLayerSelectionTransferHandler handler =
composite.getLayerSelectionTransferHandler( composite.getLayerSelectionTransferHandlerCount() -1 );
//There is no need to keep a reference to the composite instance, you can create a new one
//the next time you would need it
manager = null;
Obtaining, adding and/or removing an ALcyLayerSelectionTransferHandler
directly from/on the
back-end:
//Suppose we have a reference to the back-end
ILcyLucyEnv backEnd;
//add a handler
backEnd.addService( aLayerSelectionTransferHandler );
//remove a handler
backEnd.removeService( anotherLayerSelectionTransferHandler );
//obtain a handler
List<ALcyLayerSelectionTransferHandler> handlers =
backEnd.getServices( ALcyLayerSelectionTransferHandler.class );
ALcyLayerSelectionTransferHandler handler = handlers.get( handlers.size() -1 );
Note: when ALcyLayerSelectionTransferHandler implementations added to this
manager or to the TLcyCompositeLayerSelectionTransferHandler
can export to a custom DataFlavor
, the transfer data associated with this
DataFlavor
should be an ILcyLayerSubsetList
.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final DataFlavor
This data flavor gives you access to the complete transferables representing the data. -
Constructor Summary
ConstructorDescriptionDefault constructor.TLcyDataTransferManager
(ILcyLucyEnv aLucyEnv) Construct aTLcyDataTransferManager
working on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayerSelectionTransferHandler
(ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) AddsaLayerSelectionTransferHandler
to theTLcyCompositeLayerSelectionTransferHandler
.Returns theTLcyCompositeLayerSelectionTransferHandler
used for thisTLcyDataTransferManager
.getLayerSelectionTransferHandler
(int aIndex) Returns theALcyLayerSelectionTransferHandler
at locationaIndex
in theTLcyCompositeLayerSelectionTransferHandler
.int
Returns the number ofALcyLayerSelectionTransferHandler
objects theTLcyCompositeLayerSelectionTransferHandler
contains.void
removeLayerSelectionTransferHandler
(ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) RemovesaLayerSelectionTransferHandler
from theTLcyCompositeLayerSelectionTransferHandler
.
-
Field Details
-
TRANSFERABLES_LIST
This data flavor gives you access to the complete transferables representing the data. You can consult this data when you need more information about the data represented by other flavors. For instance, when the
Transferable
on the clipboard supports theTLcyMapDataFlavor.GENERAL_SHAPE_FLAVOR
as well as this flavor, you can consult the data from this flavor to see if not each transferable separately contains more detailed data.The representation class of this DataFlavor is a
java.util.List
. All elements in this list are guaranteed to beTransferable
instances. These transferables are the original transferables as they were generated by theALcyLayerSelectionTransferHandler
.Note that one should never rely on the properties of this constant (e.g.
TRANSFERABLES_LIST.getMimeType()
), as they might change in a future version of Lucy. Instead one should always compare directly with this constant.
-
-
Constructor Details
-
TLcyDataTransferManager
public TLcyDataTransferManager()Default constructor.
The created instance will use a TLcyCompositeLayerSelectionTransferHandler which will only work the
ALcyLayerSelectionTransferHandler
instances registered to it. If you want to use all registeredALcyLayerSelectionTransferHandler
instances of the Lucy back-end, useTLcyDataTransferManager(com.luciad.lucy.ILcyLucyEnv)
instead.- See Also:
-
TLcyDataTransferManager
Construct a
TLcyDataTransferManager
working on the Lucy back-end.The created instance will use a TLcyCompositeLayerSelectionTransferHandler which will use all
ALcyLayerSelectionTransferHandler
instances registered to the back-end, and adding and/or removingALcyLayerSelectionTransferHandler
instances to/from theTLcyCompositeLayerSelectionTransferHandler
will respectively add/remove it as service from the back-end.If you want to create a
TLcyDataTransferManager
which does not use the back-end, useTLcyDataTransferManager()
instead.- Parameters:
aLucyEnv
- The Lucy back-end- See Also:
-
-
Method Details
-
addLayerSelectionTransferHandler
public void addLayerSelectionTransferHandler(ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) Adds
aLayerSelectionTransferHandler
to theTLcyCompositeLayerSelectionTransferHandler
.Note: when
aLayerSelectionTransferHandler
exports to a customDataFlavor
, ie. aDataFlavor
defined by yourself, the transfer data associated with thisDataFlavor
should be aILcyLayerSubsetList
.- Parameters:
aLayerSelectionTransferHandler
- The handler to add to the list.- See Also:
-
getLayerSelectionTransferHandlerCount
public int getLayerSelectionTransferHandlerCount()Returns the number of
ALcyLayerSelectionTransferHandler
objects theTLcyCompositeLayerSelectionTransferHandler
contains.- Returns:
- The number of handlers.
- See Also:
-
getLayerSelectionTransferHandler
Returns the
ALcyLayerSelectionTransferHandler
at locationaIndex
in theTLcyCompositeLayerSelectionTransferHandler
.- Parameters:
aIndex
- The position of theALcyLayerSelectionTransferHandler
you want to retrieve.- Returns:
- The handler at the specified location.
- See Also:
-
removeLayerSelectionTransferHandler
public void removeLayerSelectionTransferHandler(ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) Removes
aLayerSelectionTransferHandler
from theTLcyCompositeLayerSelectionTransferHandler
.- Parameters:
aLayerSelectionTransferHandler
- TheALcyLayerSelectionTransferHandler
to remove.- See Also:
-
getCompositeLayerSelectionTransferHandler
Returns the
TLcyCompositeLayerSelectionTransferHandler
used for thisTLcyDataTransferManager
.If the constructor specifying an
ILcyLucyEnv
is used, theTLcyCompositeLayerSelectionTransferHandler
will be based on allALcyLayerSelectionTransferHandler
instances registered to the Lucy back-end.- Returns:
- The composite
ALcyLayerSelectionTransferHandler
. - See Also:
-