Class TLcyCompositeCustomizerPanelFactory

java.lang.Object
com.luciad.lucy.util.TLcyGenericComposite<ILcyCustomizerPanelFactory>
com.luciad.lucy.gui.customizer.TLcyCompositeCustomizerPanelFactory
All Implemented Interfaces:
ILcyCustomizerPanelFactory, Iterable<ILcyCustomizerPanelFactory>

public class TLcyCompositeCustomizerPanelFactory extends TLcyGenericComposite<ILcyCustomizerPanelFactory> implements ILcyCustomizerPanelFactory

ILcyCustomizerPanelFactory implementation that follows the composite design pattern. As such, it delegates all the real work to the ILcyCustomizerPanel's added to this factory.

The factories added to this composite can be given a priority. Factories with a higher priority will be consulted first when this composite performs any operation.

A typical usage of the priorities would be to add a ILcyCustomizerPanelFactory implementation for a specific type of layer using say PRIORITY_NORMAL. For all other types of layers, you could then add a general implementation using PRIORITY_FALLBACK. As PRIORITY_NORMAL takes precedence over PRIORITY_FALLBACK, there is no need to exclude the specific layer in the canCreateCustomizerPanel method of the general implementation, and therefore the general implementation does not need to know anything about the more specific one.

When creating a new TLcyCompositeCustomizerPanelFactory using the default constructor (see TLcyCompositeCustomizerPanelFactory(), the created instance will only work on/with the ILcyCustomizerPanelFactorys registered on this composite instance (see addCustomizerPanelFactory(ILcyCustomizerPanelFactory, int) and removeCustomizerPanelFactory(ILcyCustomizerPanelFactory)).

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

Creating an ILcyCustomizerPanel 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
 TLcyCompositeCustomizerPanelFactory factory = new TLcyCompositeCustomizerPanelFactory( aLucyEnv );
 if ( factory.canCreateCustomizerPanel( aObject ){
   ILcyCustomizerPanel customizerPanel = factory.createCustomizerPanel( aObject );
 } else {
   //none of the registered ILcyCustomizerPanelFactory could create a customizer panel for aObject
 }
 //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
 factory = null;