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 ALcyLayerSelectionTransferHandlers,
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
FieldsModifier and TypeFieldDescriptionstatic final DataFlavorThis data flavor gives you access to the complete transferables representing the data. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.TLcyDataTransferManager(ILcyLucyEnv aLucyEnv) Construct aTLcyDataTransferManagerworking on the Lucy back-end. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLayerSelectionTransferHandler(ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) AddsaLayerSelectionTransferHandlerto theTLcyCompositeLayerSelectionTransferHandler.Returns theTLcyCompositeLayerSelectionTransferHandlerused for thisTLcyDataTransferManager.getLayerSelectionTransferHandler(int aIndex) Returns theALcyLayerSelectionTransferHandlerat locationaIndexin theTLcyCompositeLayerSelectionTransferHandler.intReturns the number ofALcyLayerSelectionTransferHandlerobjects theTLcyCompositeLayerSelectionTransferHandlercontains.voidremoveLayerSelectionTransferHandler(ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) RemovesaLayerSelectionTransferHandlerfrom 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
Transferableon the clipboard supports theTLcyMapDataFlavor.GENERAL_SHAPE_FLAVORas 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 beTransferableinstances. 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
ALcyLayerSelectionTransferHandlerinstances registered to it. If you want to use all registeredALcyLayerSelectionTransferHandlerinstances of the Lucy back-end, useTLcyDataTransferManager(com.luciad.lucy.ILcyLucyEnv)instead.- See Also:
-
TLcyDataTransferManager
Construct a
TLcyDataTransferManagerworking on the Lucy back-end.The created instance will use a TLcyCompositeLayerSelectionTransferHandler which will use all
ALcyLayerSelectionTransferHandlerinstances registered to the back-end, and adding and/or removingALcyLayerSelectionTransferHandlerinstances to/from theTLcyCompositeLayerSelectionTransferHandlerwill respectively add/remove it as service from the back-end.If you want to create a
TLcyDataTransferManagerwhich 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
aLayerSelectionTransferHandlerto theTLcyCompositeLayerSelectionTransferHandler.Note: when
aLayerSelectionTransferHandlerexports to a customDataFlavor, ie. aDataFlavordefined by yourself, the transfer data associated with thisDataFlavorshould be aILcyLayerSubsetList.- Parameters:
aLayerSelectionTransferHandler- The handler to add to the list.- See Also:
-
getLayerSelectionTransferHandlerCount
public int getLayerSelectionTransferHandlerCount()Returns the number of
ALcyLayerSelectionTransferHandlerobjects theTLcyCompositeLayerSelectionTransferHandlercontains.- Returns:
- The number of handlers.
- See Also:
-
getLayerSelectionTransferHandler
Returns the
ALcyLayerSelectionTransferHandlerat locationaIndexin theTLcyCompositeLayerSelectionTransferHandler.- Parameters:
aIndex- The position of theALcyLayerSelectionTransferHandleryou want to retrieve.- Returns:
- The handler at the specified location.
- See Also:
-
removeLayerSelectionTransferHandler
public void removeLayerSelectionTransferHandler(ALcyLayerSelectionTransferHandler aLayerSelectionTransferHandler) Removes
aLayerSelectionTransferHandlerfrom theTLcyCompositeLayerSelectionTransferHandler.- Parameters:
aLayerSelectionTransferHandler- TheALcyLayerSelectionTransferHandlerto remove.- See Also:
-
getCompositeLayerSelectionTransferHandler
Returns the
TLcyCompositeLayerSelectionTransferHandlerused for thisTLcyDataTransferManager.If the constructor specifying an
ILcyLucyEnvis used, theTLcyCompositeLayerSelectionTransferHandlerwill be based on allALcyLayerSelectionTransferHandlerinstances registered to the Lucy back-end.- Returns:
- The composite
ALcyLayerSelectionTransferHandler. - See Also:
-