Package com.luciad.format.dafif.gui
Class TLcdDAFIFTypeLoader
java.lang.Object
com.luciad.format.dafif.gui.TLcdDAFIFTypeLoader
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
ConstructorDescriptionTLcdDAFIFTypeLoader
(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 TypeMethodDescriptionvoid
addDAFIFLoaderListener
(ILcdDAFIFLoaderListener aDAFIFLoaderListener) Registers a listener forTLcdDAFIFLoaderEvent
objects fired by this DAFIF loader.void
addStatusListener
(ILcdStatusListener aStatusListener) Registers a status listener to use for monitoring the decoding progress of this DAFIF loader.void
dispose()
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 aTLcdDAFIFLoaderEvent
with the specified properties.protected void
fireDAFIFLoaderEvent
(int aID, String aRegion, ILcdModel aModel, boolean aShouldRepaintView) Fires aTLcdDAFIFLoaderEvent
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 getAvailableICAORegionsGet the List of available ICAO regions (Strings) for this data type.Object[]
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.getName()
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 the model corresponding to the region indicated by the element of fAvailableICAORegions with index fCurrentICAORegionIndices[ aCurrentIndex ] in position aNewIndex of aNewModelArray.protected void
Load the model corresponding to the region indicated by the element of fAvailableICAORegions with index fNewICAORegionIndices[ aNewIndex ] into position aNewIndex of aNewModelArray.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.void
removeDAFIFLoaderListener
(ILcdDAFIFLoaderListener aDAFIFLoaderListener) Unregisters the specified DAFIF loader listener.void
removeStatusListener
(ILcdStatusListener aStatusListener) 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.toString()
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 the given view with data from the DAFIF source directory aDAFIFRootDir.
-
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 anILcdDAFIFSubTypeFilteringDecoder
andaEnableSubTypeFiltering
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
Get the name of the DAFIF data type which this instance will keep track of.- Returns:
- Name of the DAFIF data type.
-
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
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
Get an array of enumerated values defining all subtypes of a given DAFIF(T) feature type. Note : This array MUST NOT be modified. SeeILcdDAFIFSubTypeFilteringDecoder.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
Get the model decoder used to decode DAFIF(T) records.- Returns:
- the model decoder used to decode DAFIF(T) records.
-
setCurrentModels
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
Get an array of models that are currently loaded for this data type. The model at positioni
in the array corresponds to the regionavailableICAORegions[ 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
-
update
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
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
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
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
Registers a status listener to use for monitoring the decoding progress of this DAFIF loader.- Parameters:
aStatusListener
- an ILcdStatusListener
-
removeStatusListener
Unregisters the specified status listener.- Parameters:
aStatusListener
- a previously registered ILcdStatusListener
-
addDAFIFLoaderListener
Registers a listener forTLcdDAFIFLoaderEvent
objects fired by this DAFIF loader.- Parameters:
aDAFIFLoaderListener
- an ILcdDAFIFLoaderListener
-
removeDAFIFLoaderListener
Unregisters the specified DAFIF loader listener.- Parameters:
aDAFIFLoaderListener
- a previously registered ILcdDAFIFLoaderListener
-
fireDAFIFLoaderEvent
Fires aTLcdDAFIFLoaderEvent
with the specified properties.- Parameters:
aID
- the ID of the event (one ofMODEL_ADDED
orMODEL_REMOVED
)aRegion
- the ICAO region that has been updatedaModel
- the model that has been added or removed
-
fireDAFIFLoaderEvent
protected void fireDAFIFLoaderEvent(int aID, String aRegion, ILcdModel aModel, boolean aShouldRepaintView) Fires aTLcdDAFIFLoaderEvent
with the specified properties.- Parameters:
aID
- the ID of the event (one ofMODEL_ADDED
orMODEL_REMOVED
)aRegion
- the ICAO region that has been updatedaModel
- the model that has been added or removedaShouldRepaintView
- true if the event should trigger a view repaint
-
fireDAFIFLoaderEvent
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.Returnstrue
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 istrue
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.
-