jmri.jmrit.dispatcher
Class TrainInfoFile

java.lang.Object
  extended by jmri.jmrit.XmlFile
      extended by 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 area

This 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.

Author:
Dave Duchamp Copyright (C) 2009

Field Summary
 
Fields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation
 
Constructor Summary
TrainInfoFile()
           
 
Method Summary
 void deleteTrainInfoFile(String name)
          Delete a specified TrainInfo file
 String[] getTrainInfoFileNames()
          Get the names of all current TrainInfo files Returns names as an array of Strings.
 TrainInfo readTrainInfo(String name)
           
 void setFileLocation(String testLocation)
           
 void writeTrainInfo(TrainInfo tf, String name)
           
 
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
 

Constructor Detail

TrainInfoFile

public TrainInfoFile()
Method Detail

setFileLocation

public void setFileLocation(String testLocation)

readTrainInfo

public TrainInfo readTrainInfo(String name)
                        throws JDOMException,
                               IOException
Throws:
JDOMException
IOException

writeTrainInfo

public void writeTrainInfo(TrainInfo tf,
                           String name)
                    throws IOException
Throws:
IOException

getTrainInfoFileNames

public 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)


deleteTrainInfoFile

public void deleteTrainInfoFile(String name)
Delete a specified TrainInfo file



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