Package jmri.jmrit.dispatcher
Class TrainInfoFile
- java.lang.Object
-
- jmri.jmrit.XmlFile
-
- jmri.jmrit.dispatcher.TrainInfoFile
-
public class TrainInfoFile extends XmlFile
Handles reading and writing of TrainInfo files to disk as an XML file to/from the dispatcher/traininfo/ directory in the user's preferences areaThis class manipulates the files conforming to the dispatcher-traininfo DTD
The file is written when the user requests that train information be saved. A TrainInfo file is read when the user request it in the Activate New Train window
This file is part of JMRI.
JMRI is open source software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrit.XmlFile
XmlFile.Validate
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static AbstractXmlAdapter.EnumIO<ActiveTrain.TrainLengthUnits>
trainlengthFromEnumMap
(package private) static AbstractXmlAdapter.EnumIO<ActiveTrain.TrainDetection>
trainsdectionFromEnumMap
-
Fields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation
-
-
Constructor Summary
Constructors Constructor Description TrainInfoFile()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
convertName(java.lang.String name)
void
deleteTrainInfoFile(java.lang.String name)
Delete a specified TrainInfo file.java.lang.String[]
getTrainInfoFileNames()
Get the names of all current TrainInfo files.java.util.List<TrainInfoFileSummary>
getTrainInfoFileSummaries()
Get the names of all current TrainInfo files.TrainInfo
readTrainInfo(java.lang.String name)
void
setFileLocation(java.lang.String testLocation)
void
writeTrainInfo(TrainInfo tf, java.lang.String name)
-
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 Detail
-
trainsdectionFromEnumMap
static final AbstractXmlAdapter.EnumIO<ActiveTrain.TrainDetection> trainsdectionFromEnumMap
-
trainlengthFromEnumMap
static final AbstractXmlAdapter.EnumIO<ActiveTrain.TrainLengthUnits> trainlengthFromEnumMap
-
-
Constructor Detail
-
TrainInfoFile
public TrainInfoFile()
-
-
Method Detail
-
setFileLocation
public void setFileLocation(java.lang.String testLocation)
-
readTrainInfo
public TrainInfo readTrainInfo(java.lang.String name) throws org.jdom2.JDOMException, java.io.IOException
- Throws:
org.jdom2.JDOMException
java.io.IOException
-
convertName
public java.lang.String convertName(java.lang.String name)
-
writeTrainInfo
public void writeTrainInfo(TrainInfo tf, java.lang.String name) throws java.io.IOException
- Throws:
java.io.IOException
-
getTrainInfoFileNames
public java.lang.String[] getTrainInfoFileNames()
Get the names of all current TrainInfo files. Returns names as an array of Strings. Returns an empty array if no files are present. Note: Fill names still end with .xml or .XML. (Modeled after a method in RecreateRosterAction.java by Bob Jacobsen)- Returns:
- names as an array or an empty array if none present
-
getTrainInfoFileSummaries
public java.util.List<TrainInfoFileSummary> getTrainInfoFileSummaries()
Get the names of all current TrainInfo files. Returns list of files and some basic details for each file .- Returns:
- names as an array or an empty array if none present
-
deleteTrainInfoFile
public void deleteTrainInfoFile(java.lang.String name)
Delete a specified TrainInfo file.- Parameters:
name
- the file to delete
-
-