Package jmri.jmrit.consisttool
Class ConsistFile
java.lang.Object
jmri.jmrit.XmlFile
jmri.jmrit.consisttool.ConsistFile
- All Implemented Interfaces:
PropertyChangeListener,EventListener
- Direct Known Subclasses:
WiFiConsistFile
Handle saving/restoring consist information to XML files. This class
manipulates files conforming to the consist-roster-config DTD.
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrit.XmlFile
XmlFile.Validate -
Field Summary
FieldsFields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringGet the filename for the default Consist file, including location.static StringGetFile Location.voidvoidreadConsistLocoList(org.jdom2.Element consist, Consist newConsist) voidreadFile()Read all consists from the default file name.voidRead all consists from a file.voidwriteFile(List<LocoAddress> consistList) Write all consists to the default file name.voidwriteFile(List<LocoAddress> consistList, String fileName) Write all consists to a file.Methods inherited from class jmri.jmrit.XmlFile
addDefaultInfo, backupFileName, checkFile, createFileNameWithDate, dumpElement, findFile, getBuilder, getDefaultDtdLocation, getDefaultValidate, getDtdLocation, getProcessingInstructionHRef, getProcessingInstructionType, getRoot, getValidate, makeBackupFile, makeBackupFile, newDocument, newDocument, revertBackupFile, rootFromFile, rootFromInputStream, rootFromName, rootFromURL, setDefaultDtdLocation, setDefaultValidate, setDtdLocation, setValidate, userFileChooser, userFileChooser, writeXML, xmlDir
-
Field Details
-
consistMan
-
-
Constructor Details
-
ConsistFile
public ConsistFile()
-
-
Method Details
-
readConsistLocoList
-
readFile
Read all consists from the default file name.- Throws:
org.jdom2.JDOMException- if unable to parse consistsIOException- if unable to read file
-
readFile
Read all consists from a file.- Parameters:
fileName- path to file- Throws:
org.jdom2.JDOMException- if unable to parse consistsIOException- if unable to read file
-
writeFile
Write all consists to the default file name.- Parameters:
consistList- list of consist addresses- Throws:
IOException- if unable to write file
-
writeFile
Write all consists to a file.- Parameters:
consistList- list of consist addressesfileName- path to file- Throws:
IOException- if unable to write file
-
getFileLocation
GetFile Location.- Returns:
- the preferences subdirectory in which Consist Files are kept this is relative to the roster files location.
-
defaultConsistFilename
Get the filename for the default Consist file, including location.- Returns:
- the filename
-
propertyChange
- Specified by:
propertyChangein interfacePropertyChangeListener
-