jmri.jmrit.decoderdefn
Class DecoderIndexFile

java.lang.Object
  extended by jmri.jmrit.XmlFile
      extended by jmri.jmrit.decoderdefn.DecoderIndexFile

public class DecoderIndexFile
extends XmlFile

DecoderIndex represents a decoderIndex.xml file in memory.

This allows a program to navigate to various decoder descriptions without having to manipulate files.

This class doesn't provide tools for defining the index; that's done manually, or at least not done here.

Multiple DecoderIndexFile objects don't make sense, so we use an "instance" member to navigate to a single one.

Author:
Bob Jacobsen Copyright (C) 2001

Field Summary
protected  Hashtable<String,String> _mfgIdFromNameHash
           
protected  Hashtable<String,String> _mfgNameFromIdHash
           
protected static String decoderIndexFileName
           
protected  List<DecoderFile> decoderList
           
protected  ArrayList<String> mMfgNameList
           
 
Fields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation
 
Constructor Summary
DecoderIndexFile()
           
 
Method Summary
 boolean checkEntry(int i, String mfgName, String family, String mfgID, String decoderVersionID, String decoderProductID, String model)
          Check if an entry consistent with specific properties.
protected static String defaultDecoderIndexFilename()
          Return the filename String for the default decoder index file, including location.
 DecoderFile fileFromTitle(String title)
          Return DecoderFile from a "title" string, ala selection in matchingComboBox.
static void forceCreationOfNewIndex()
          Force creation of a new user index
 List<String> getMfgNameList()
           
static DecoderIndexFile instance()
           
static JComboBox jComboBoxFromList(List<DecoderFile> l)
          Return a JComboBox made with the titles from a list of DecoderFile entries
static ComboBoxModel jComboBoxModelFromList(List<DecoderFile> l)
          Return a new ComboBoxModel made with the titles from a list of DecoderFile entries
 JComboBox matchingComboBox(String mfg, String family, String decoderMfgID, String decoderVersionID, String decoderProductID, String model)
          Get a JComboBox representing the choices that match some information
 List<DecoderFile> matchingDecoderList(String mfg, String family, String decoderMfgID, String decoderVersionID, String decoderProductID, String model)
          Get a List of decoders matching some information
 String mfgIdFromName(String name)
           
 String mfgNameFromId(String name)
           
 int numDecoders()
           
static void resetInstance()
           
 void writeFile(String name, DecoderIndexFile oldIndex, String[] files)
           
 
Methods inherited from class jmri.jmrit.XmlFile
addDefaultInfo, backupFileName, checkFile, createFileNameWithDate, dumpElement, ensurePrefsPresent, findFile, getBuilder, getRootViaURI, getVerify, makeBackupFile, makeBackupFile, newDocument, newDocument, prefsDir, reportError1, reportError2, resourcesDir, revertBackupFile, rootFromFile, rootFromName, rootFromURL, scriptsDir, setScriptsFileLocationDefault, setUserFileLocationDefault, setVerify, userFileChooser, userFileChooser, userFileChooser, userFileChooser, userFileLocationDefault, writeXML, xmlDir
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

decoderList

protected List<DecoderFile> decoderList

_mfgIdFromNameHash

protected Hashtable<String,String> _mfgIdFromNameHash

_mfgNameFromIdHash

protected Hashtable<String,String> _mfgNameFromIdHash

mMfgNameList

protected ArrayList<String> mMfgNameList

decoderIndexFileName

protected static final String decoderIndexFileName
See Also:
Constant Field Values
Constructor Detail

DecoderIndexFile

public DecoderIndexFile()
Method Detail

numDecoders

public int numDecoders()

getMfgNameList

public List<String> getMfgNameList()

mfgIdFromName

public String mfgIdFromName(String name)

mfgNameFromId

public String mfgNameFromId(String name)

matchingDecoderList

public List<DecoderFile> matchingDecoderList(String mfg,
                                             String family,
                                             String decoderMfgID,
                                             String decoderVersionID,
                                             String decoderProductID,
                                             String model)
Get a List of decoders matching some information


matchingComboBox

public JComboBox matchingComboBox(String mfg,
                                  String family,
                                  String decoderMfgID,
                                  String decoderVersionID,
                                  String decoderProductID,
                                  String model)
Get a JComboBox representing the choices that match some information


jComboBoxFromList

public static JComboBox jComboBoxFromList(List<DecoderFile> l)
Return a JComboBox made with the titles from a list of DecoderFile entries


jComboBoxModelFromList

public static ComboBoxModel jComboBoxModelFromList(List<DecoderFile> l)
Return a new ComboBoxModel made with the titles from a list of DecoderFile entries


fileFromTitle

public DecoderFile fileFromTitle(String title)
Return DecoderFile from a "title" string, ala selection in matchingComboBox.


checkEntry

public boolean checkEntry(int i,
                          String mfgName,
                          String family,
                          String mfgID,
                          String decoderVersionID,
                          String decoderProductID,
                          String model)
Check if an entry consistent with specific properties. A null String entry always matches. Strings are used for convenience in GUI building. Don't bother asking about the model number...


resetInstance

public static void resetInstance()

instance

public static DecoderIndexFile instance()

forceCreationOfNewIndex

public static void forceCreationOfNewIndex()
Force creation of a new user index


writeFile

public void writeFile(String name,
                      DecoderIndexFile oldIndex,
                      String[] files)
               throws IOException
Throws:
IOException

defaultDecoderIndexFilename

protected static String defaultDecoderIndexFilename()
Return the filename String for the default decoder index file, including location. This is here to allow easy override in tests.



Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads