Class TLcyCompositeLayerSelectionTransferHandler

java.lang.Object
com.luciad.lucy.datatransfer.ALcyLayerSelectionTransferHandler
com.luciad.lucy.datatransfer.TLcyCompositeLayerSelectionTransferHandler
All Implemented Interfaces:
ILcdUndoableSource

public class TLcyCompositeLayerSelectionTransferHandler extends ALcyLayerSelectionTransferHandler

Composite implementation of ALcyLayerSelectionTransferHandler according to the composite design pattern.

When creating a new TLcyCompositeLayerSelectionTransferHandler using the default constructor (see TLcyCompositeLayerSelectionTransferHandler()), the created instance will only work on/with the ALcyLayerSelectionTransferHandlers registered on this composite instance (see addLayerSelectionTransferHandler(ALcyLayerSelectionTransferHandler) and removeLayerSelectionTransferHandler(ALcyLayerSelectionTransferHandler)).

When creating a new TLcyCompositeLayerSelectionTransferHandler using the constructor specifying an ILcyLucyEnv instance (see TLcyCompositeLayerSelectionTransferHandler(com.luciad.lucy.ILcyLucyEnv), the created instance will work on the Lucy back-end services. It will use all registered ALcyLayerSelectionTransferHandler instances of the Lucy back-end, adding and/or removing an ALcyLayerSelectionTransferHandler will add/remove the ALcyLayerSelectionTransferHandler as service from Lucy, ... .

For example adding and/or removing a Transferable using the back-end based implementation can be done by creating a new instance of this class:


 //Create a new instance whenever you need it.
 TLcyCompositeLayerSelectionTransferHandler handler = new TLcyCompositeLayerSelectionTransferHandler( aLucyEnv );
 //add and remove a handler
 handler.addLayerSelectionTransferHandler( aLayerSelectionTransferHandler );
 handler.removeLayerSelectionTransferHanlder( anotherLayerSelectionTransferHandler );
 //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
 handler = null;
 

The same result can be obtained by using the back-end services directly:


 //Suppose we have a reference to the back-end
 ILcyLucyEnv backEnd;
 //add and remove a handler
 backEnd.addService( aLayerSelectionTransferHandler );
 backEnd.removeService( anotherLayerSelectionTransferHandler );
 

Note: there is a restriction on the ALcyLayerSelectionTransferHandler instances which are added to this TLcyCompositeLayerSelectionTransferHandler, or which are registered directly as service on the Lucy back-end. When the ALcyLayerSelectionTransferHandler exports to a custom DataFlavor, ie. a DataFlavor defined by yourself, the transfer data associated with this DataFlavor should be a ILcyLayerSubsetList.

See Also: