Class TLcyCompositeFormatBarFactory

java.lang.Object
com.luciad.lucy.gui.formatbar.ALcyFormatBarFactory
com.luciad.lucy.gui.formatbar.TLcyCompositeFormatBarFactory

public class TLcyCompositeFormatBarFactory extends ALcyFormatBarFactory

A composite implementation of ALcyFormatBarFactory according to the composite design pattern.

When creating a new TLcyCompositeFormatBarFactory using the default constructor (see TLcyCompositeFormatBarFactory()), the created instance will only work on/with the ALcyFormatBarFactorys registered on this composite instance (see addFormatBarFactory(ALcyFormatBarFactory) and removeFormatBarFactory(ALcyFormatBarFactory)).

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

Creating an ALcyFormatBar 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.
 TLcyCompositeFormatBarFactory factory = new TLcyCompositeFormatBarFactory( aLucyEnv );
 if( factory.canCreateFormatBar( aView, aLayer ){
   ALcyFormatBar bar = factory.createFormatBar( aView, aLayer );
 }
 //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;
 
Since:
10.0
  • Constructor Details

  • Method Details

    • addFormatBarFactory

      public void addFormatBarFactory(ALcyFormatBarFactory aFormatBarFactory)

      Adds the given ALcyFormatBarFactory to the list of registered format bar factories.

      Equivalent of calling

      
         addFormatBarFactory( aFormatBarFactory, ILcyLucyEnv.PRIORITY_DEFAULT );
       
      Parameters:
      aFormatBarFactory - The format bar factory. Must not be null
      See Also:
    • addFormatBarFactory

      public void addFormatBarFactory(ALcyFormatBarFactory aFormatBarFactory, int aPriority)

      Adds the given ALcyFormatBarFactory to the list of registered format bar factories.

      If the constructor specifying an ILcyLucyEnv is used, the ALcyFormatBarFactory will be registered as a service on the Lucy back-end (see ILcyLucyEnv.addService(Object, int)). When calling ILcyLucyEnv.getServices(Class) afterwards, aFormatBarFactory will only be included in the returned list when the requested class was ALcyFormatBarFactory.class.
      Note: if you want to remove the registered ALcyFormatBarFactory afterwards, use removeFormatBarFactory(ALcyFormatBarFactory) and not ILcyLucyEnv.removeService(Object).

      Parameters:
      aFormatBarFactory - The format bar factory. Must not be null
      aPriority - The priority for the instance. Lower values mean higher priorities. Services with higher priority appear earlier in the list of results. Common values are ILcyLucyEnv.PRIORITY_DEFAULT and ILcyLucyEnv.PRIORITY_FALLBACK
      Since:
      2016.0
      See Also:
    • removeFormatBarFactory

      public void removeFormatBarFactory(ALcyFormatBarFactory aFormatBarFactory)

      Removes the given ALcyFormatBarFactory from the list of registered format bar factories. Nothing will happen if the given provider was never added before.

      If the constructor specifying an ILcyLucyEnv is used, the ALcyFormatBarFactory will be removed as service from the Lucy back-end (see ILcyLucyEnv.removeService(Object)).
      Note: it is only possible to remove ALcyFormatBarFactory instances which were registered using the addFormatBarFactory(ALcyFormatBarFactory) method.

      Parameters:
      aFormatBarFactory - The format bar factory. Must not be null
      See Also:
    • canCreateFormatBar

      public boolean canCreateFormatBar(ILcdView aView, ILcdLayer aLayer)
      Description copied from class: ALcyFormatBarFactory
      Returns true if a ALcyFormatBar can be created for the given parameters, false otherwise.
      Specified by:
      canCreateFormatBar in class ALcyFormatBarFactory
      Parameters:
      aView - The view to create the bar for. Cannot be null.
      aLayer - The layer to create this bar for. Can be null. It is null if a bar needs to be created before any layer of the format is available.
      Returns:
      true if a ALcyFormatBar can be created for the given parameters, false otherwise.
    • createFormatBar

      public ALcyFormatBar createFormatBar(ILcdView aView, ILcdLayer aLayer)
      Description copied from class: ALcyFormatBarFactory

      Creates an ALcyFormatBar for the given parameters.

      This method does not need to set the given layer to the created ALcyFormatBar, that is the responsibility of the user of this method.

      Specified by:
      createFormatBar in class ALcyFormatBarFactory
      Parameters:
      aView - The view to create the bar for. Cannot be null.
      aLayer - The layer to create this bar for. Can be null. It is null if a bar needs to be created before any layer of the format is available.
      Returns:
      the newly created ALcyFormatBar.
    • getFormatBarFactoryCount

      public int getFormatBarFactoryCount()

      Returns the number of registered ALcyFormatBarFactory instances.

      Returns:
      the number of registered ALcyFormatBarFactory instances.
    • getFormatBarFactory

      public ALcyFormatBarFactory getFormatBarFactory(int aIndex)

      Returns the ALcyFormatBarFactory at index aIndex.

      Parameters:
      aIndex - The index: 0 <= aIndex < getFormatBarFactoryCount()
      Returns:
      the ALcyFormatBarFactory at index aIndex.