Class TLcdDAFIFTypeLoader

java.lang.Object
com.luciad.format.dafif.gui.TLcdDAFIFTypeLoader

public class TLcdDAFIFTypeLoader extends Object
This class is used for loading one specific type of DAFIF data. It also keeps track of currently loaded models for this type of data and of loading/unloading models when a new set of regions has been chosen. Some DAFIF types may also be further categorized into subtypes base on the value of some attribute, Subtypes are exposed by ILcdDAFIFSubTypeFilteringDecoder implementation.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TLcdDAFIFTypeLoader(String aName, List aAvailableICAORegions, List aAvailableICAOCountryCodes, ILcdModelDecoder aModelDecoder)
    Create a new loader instance.
    TLcdDAFIFTypeLoader(String aName, List aAvailableICAORegions, List aAvailableICAOCountryCodes, ILcdModelDecoder aModelDecoder, boolean aEnableSubTypeFiltering)
    Create a new loader instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Registers a listener for TLcdDAFIFLoaderEvent objects fired by this DAFIF loader.
    void
    Registers a status listener to use for monitoring the decoding progress of this DAFIF loader.
    void
    Clean up before loader is removed: this removes all currently loaded models from the given view.
    protected void
    fireDAFIFLoaderEvent(int aID, String aRegion, ILcdModel aModel)
    Fires a TLcdDAFIFLoaderEvent with the specified properties.
    protected void
    fireDAFIFLoaderEvent(int aID, String aRegion, ILcdModel aModel, boolean aShouldRepaintView)
    Fires a TLcdDAFIFLoaderEvent with the specified properties.
    protected void
    Fires a the specified DAFIF loader event.
    Get the list of country names for all the ICAO region codes retrieved by getAvailableICAORegions
    Get the List of available ICAO regions (Strings) for this data type.
    Get an array of enumerated values defining all subtypes of a given DAFIF(T) feature type.
    int[]
    Get an array of indices into the List of available ICAO regions that indicate the currently loaded regions.
    Get an array of models that are currently loaded for this data type.
    int[]
    Get an array of indices into the list of available subtypes that indicates the currently loaded subtypes.
    Get the model decoder used to decode DAFIF(T) records.
    Get the name of the DAFIF data type which this instance will keep track of.
    int[]
    Get an array of indices into the List of available ICAO regions that indicate the desired regions.
    int[]
    Get an array of indices into the list of available subtypes that indicates the desired subtypes.
    static boolean
    Deprecated.
    This method has been deprecated.
    protected void
    keep(ILcdModel[] aNewModelArray, int aNewIndex, int aCurrentIndex)
    Keep the model corresponding to the region indicated by the element of fAvailableICAORegions with index fCurrentICAORegionIndices[ aCurrentIndex ] in position aNewIndex of aNewModelArray.
    protected void
    load(String aDAFIFRoot, ILcdModel[] aNewModelArray, int aNewIndex)
    Load the model corresponding to the region indicated by the element of fAvailableICAORegions with index fNewICAORegionIndices[ aNewIndex ] into position aNewIndex of aNewModelArray.
    void
    Signals that the given model has been removed by an external cause and that the current status of the loader should be updated.
    void
    Unregisters the specified DAFIF loader listener.
    void
    Unregisters the specified status listener.
    static void
    setClassTraceOn(boolean aClassTraceOn)
    Deprecated.
    This method has been deprecated.
    void
    setCurrentICAORegionIndices(int[] aCurrentICAORegionIndices)
    This method is not part of the committed API and as such the behavior of this method is not specified.
    void
    setCurrentModels(ILcdModel[] aCurrentModels)
    This method is not part of the committed API and as such the behavior of this method is not specified.
    void
    setNewICAORegionIndices(int[] aNewICAORegionIndices)
    Set an array of indices into the List of available ICAO regions that indicate the desired regions.
    void
    setNewSubTypeIndices(int[] aSubTypeIndices)
    Set an array of indices into the array of available subtypes that indicates which subtypes must be decoded.
     
    protected void
    unload(int aCurrentIndex)
    Unload the model corresponding to the region indicated by the element of fAvailableICAORegions with index fCurrentICAORegionIndices[ aCurrentIndex ].
    protected void
    unload(int aCurrentIndex, boolean aShouldRepaintView)
    Unload the model corresponding to the region indicated by the element of fAvailableICAORegions with index fCurrentICAORegionIndices[ aCurrentIndex ].
    protected void
    Unloads all current models.
    void
    update(String aDAFIFRootDir)
    Update the given view with data from the DAFIF source directory aDAFIFRootDir.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TLcdDAFIFTypeLoader

      public TLcdDAFIFTypeLoader(String aName, List aAvailableICAORegions, List aAvailableICAOCountryCodes, ILcdModelDecoder aModelDecoder)
      Create a new loader instance.
      Parameters:
      aName - Name of the DAFIF data type which this instance will keep track of.
      aAvailableICAORegions - List of available ICAO regions (Strings) for this data type.
      aAvailableICAOCountryCodes - List of available ICAO country codes (Strings) for this data type.
      aModelDecoder - Model decoder to use for decoding this data type.
    • TLcdDAFIFTypeLoader

      public TLcdDAFIFTypeLoader(String aName, List aAvailableICAORegions, List aAvailableICAOCountryCodes, ILcdModelDecoder aModelDecoder, boolean aEnableSubTypeFiltering)
      Create a new loader instance. If the supplied model decoder is an ILcdDAFIFSubTypeFilteringDecoder and aEnableSubTypeFiltering is true, the loader will enable control over the subtype filtering functionality of the decoder.
      Parameters:
      aName - Name of the DAFIF data type which this instance will keep track of.
      aAvailableICAORegions - List of available ICAO regions (Strings) for this data type.
      aAvailableICAOCountryCodes - List of available ICAO country codes (Strings) for this data type.
      aModelDecoder - Model decoder to use for decoding this data type.
      aEnableSubTypeFiltering - true if subtype filtering should be enabled
  • Method Details

    • getName

      public String getName()
      Get the name of the DAFIF data type which this instance will keep track of.
      Returns:
      Name of the DAFIF data type.
    • getAvailableICAORegions

      public List getAvailableICAORegions()
      Get the List of available ICAO regions (Strings) for this data type.
      Returns:
      the List of available ICAO regions (Strings) for this data type.
    • getAvailableICAOCountryNames

      public List getAvailableICAOCountryNames()
      Get the list of country names for all the ICAO region codes retrieved by getAvailableICAORegions
      Returns:
      the List of available ICAO region Country names for this data type as a List of String objects
    • getAvailableSubTypes

      public Object[] getAvailableSubTypes()
      Get an array of enumerated values defining all subtypes of a given DAFIF(T) feature type. Note : This array MUST NOT be modified. See ILcdDAFIFSubTypeFilteringDecoder.setSubTypesToDecode(int[]).
      Returns:
      an array of enumerated values defining subtypes of a given DAFIF feature type. If no subtypes are defined or subtype filtering is disabled, the array is empty.
    • getModelDecoder

      public ILcdModelDecoder getModelDecoder()
      Get the model decoder used to decode DAFIF(T) records.
      Returns:
      the model decoder used to decode DAFIF(T) records.
    • setCurrentModels

      public void setCurrentModels(ILcdModel[] aCurrentModels)
      This method is not part of the committed API and as such the behavior of this method is not specified. This method is for internal use ONLY.
      Parameters:
      aCurrentModels -
    • getCurrentModels

      public ILcdModel[] getCurrentModels()
      Get an array of models that are currently loaded for this data type. The model at position i in the array corresponds to the region availableICAORegions[ currentICAORegionIndices[ i ] ].
      Returns:
      an array of models that are currently loaded for this data type.
    • getCurrentICAORegionIndices

      public int[] getCurrentICAORegionIndices()
      Get an array of indices into the List of available ICAO regions that indicate the currently loaded regions.
      Returns:
      An array of indices into availableICAORegions.
    • setCurrentICAORegionIndices

      public void setCurrentICAORegionIndices(int[] aCurrentICAORegionIndices)
      This method is not part of the committed API and as such the behavior of this method is not specified. This method is for internal use ONLY.
      Parameters:
      aCurrentICAORegionIndices -
    • getCurrentSubTypeIndices

      public int[] getCurrentSubTypeIndices()
      Get an array of indices into the list of available subtypes that indicates the currently loaded subtypes. Note: This array should not be modified outside of this class.
      Returns:
      an array of indices into getAvailableSubTypes()
    • getNewICAORegionIndices

      public int[] getNewICAORegionIndices()
      Get an array of indices into the List of available ICAO regions that indicate the desired regions. Some of these might already be loaded, others not. Note: This array should not be modified outside of this class.
      Returns:
      An array of indices into availableICAORegions.
    • setNewICAORegionIndices

      public void setNewICAORegionIndices(int[] aNewICAORegionIndices)
      Set an array of indices into the List of available ICAO regions that indicate the desired regions. Some of these might already be loaded, others not.
      Parameters:
      aNewICAORegionIndices - An array of indices into availableICAORegions.
    • getNewSubTypeIndices

      public int[] getNewSubTypeIndices()
      Get an array of indices into the list of available subtypes that indicates the desired subtypes. Some might be already loaded, ie present in the array returned by #getCurrentSubtypesIndices, some might not. Note : The returned array should not be modified.
      Returns:
      the array of indices into getAvailableSubTypes() that indicates desired subtypes
    • setNewSubTypeIndices

      public void setNewSubTypeIndices(int[] aSubTypeIndices)
      Set an array of indices into the array of available subtypes that indicates which subtypes must be decoded.
      Parameters:
      aSubTypeIndices - an array of indices into the array of available subtypes.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • update

      public void update(String aDAFIFRootDir)
      Update the given view with data from the DAFIF source directory aDAFIFRootDir. The currently loaded regions (currentICAORegionIndices) are compared to the desired regions (newICAORegionIndices). New regions that are not yet loaded are loaded and regions that are currently loaded, but no longer wanted, are unloaded. Regions that occur in both lists are kept unless their subtypes selection has changed.
      Parameters:
      aDAFIFRootDir - Source directory from which to read. The region code is appended as a subdirectory to this path.
    • dispose

      public void dispose()
      Clean up before loader is removed: this removes all currently loaded models from the given view. Important note: An instance on which dispose() has been called, should no longer be used in any way. Calling dispose() does not update internal bookkeeping, but just removed all models.
    • load

      protected void load(String aDAFIFRoot, ILcdModel[] aNewModelArray, int aNewIndex)
      Load the model corresponding to the region indicated by the element of fAvailableICAORegions with index fNewICAORegionIndices[ aNewIndex ] into position aNewIndex of aNewModelArray.
      Parameters:
      aDAFIFRoot - The root directory containing the DAFIF data.
      aNewModelArray - New array with loaded models.
      aNewIndex - Index into fNewICAORegionIndices.
    • keep

      protected void keep(ILcdModel[] aNewModelArray, int aNewIndex, int aCurrentIndex)
      Keep the model corresponding to the region indicated by the element of fAvailableICAORegions with index fCurrentICAORegionIndices[ aCurrentIndex ] in position aNewIndex of aNewModelArray.
      Parameters:
      aNewModelArray - New array with loaded models.
      aNewIndex - Index into fNewICAORegionIndices.
      aCurrentIndex - Position in fCurrentModels where the model to be kept is currently stored.
    • unload

      protected void unload(int aCurrentIndex)
      Unload the model corresponding to the region indicated by the element of fAvailableICAORegions with index fCurrentICAORegionIndices[ aCurrentIndex ].
      Parameters:
      aCurrentIndex - Index into fNewICAORegionIndices.
    • unload

      protected void unload(int aCurrentIndex, boolean aShouldRepaintView)
      Unload the model corresponding to the region indicated by the element of fAvailableICAORegions with index fCurrentICAORegionIndices[ aCurrentIndex ].
      Parameters:
      aCurrentIndex - Index into fNewICAORegionIndices.
      aShouldRepaintView - a flag passed to the trigger event that tells the receiver if the view should be repaint or not.
    • unloadAll

      protected void unloadAll()
      Unloads all current models.
    • modelRemovedExternally

      public void modelRemovedExternally(ILcdModel aModel)
      Signals that the given model has been removed by an external cause and that the current status of the loader should be updated.
      Parameters:
      aModel - The model that has been removed.
    • addStatusListener

      public void addStatusListener(ILcdStatusListener aStatusListener)
      Registers a status listener to use for monitoring the decoding progress of this DAFIF loader.
      Parameters:
      aStatusListener - an ILcdStatusListener
    • removeStatusListener

      public void removeStatusListener(ILcdStatusListener aStatusListener)
      Unregisters the specified status listener.
      Parameters:
      aStatusListener - a previously registered ILcdStatusListener
    • addDAFIFLoaderListener

      public void addDAFIFLoaderListener(ILcdDAFIFLoaderListener aDAFIFLoaderListener)
      Registers a listener for TLcdDAFIFLoaderEvent objects fired by this DAFIF loader.
      Parameters:
      aDAFIFLoaderListener - an ILcdDAFIFLoaderListener
    • removeDAFIFLoaderListener

      public void removeDAFIFLoaderListener(ILcdDAFIFLoaderListener aDAFIFLoaderListener)
      Unregisters the specified DAFIF loader listener.
      Parameters:
      aDAFIFLoaderListener - a previously registered ILcdDAFIFLoaderListener
    • fireDAFIFLoaderEvent

      protected void fireDAFIFLoaderEvent(int aID, String aRegion, ILcdModel aModel)
      Fires a TLcdDAFIFLoaderEvent with the specified properties.
      Parameters:
      aID - the ID of the event (one of MODEL_ADDED or MODEL_REMOVED)
      aRegion - the ICAO region that has been updated
      aModel - the model that has been added or removed
    • fireDAFIFLoaderEvent

      protected void fireDAFIFLoaderEvent(int aID, String aRegion, ILcdModel aModel, boolean aShouldRepaintView)
      Fires a TLcdDAFIFLoaderEvent with the specified properties.
      Parameters:
      aID - the ID of the event (one of MODEL_ADDED or MODEL_REMOVED)
      aRegion - the ICAO region that has been updated
      aModel - the model that has been added or removed
      aShouldRepaintView - true if the event should trigger a view repaint
    • fireDAFIFLoaderEvent

      protected void fireDAFIFLoaderEvent(TLcdDAFIFLoaderEvent aEvent)
      Fires a the specified DAFIF loader event.
      Parameters:
      aEvent - a TLcdDAFIFLoaderEvent
    • isClassTraceOn

      public static boolean isClassTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • setClassTraceOn

      public static void setClassTraceOn(boolean aClassTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for all instances of this class. If the argument is true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
      Parameters:
      aClassTraceOn - if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.