Class OptionsFile
- java.lang.Object
-
- jmri.jmrit.XmlFile
-
- jmri.jmrit.dispatcher.OptionsFile
-
- All Implemented Interfaces:
InstanceManagerAutoDefault
public class OptionsFile extends XmlFile implements InstanceManagerAutoDefault
Handles reading and writing of Dispatcher options to disk as an XML file called "dispatcher-options.xml" in the user's preferences area.This class manipulates the files conforming to the dispatcher-options DTD
The file is written when the user requests that options be saved. If the dispatcheroptions.xml file is present when Dispatcher is started, it is read and options set accordingly
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 protected DispatcherFrame
dispatcher
(package private) static AbstractXmlAdapter.EnumIO<DispatcherFrame.TrainsFrom>
trainsFromEnumMap
-
Fields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation
-
-
Constructor Summary
Constructors Constructor Description OptionsFile()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
readDispatcherOptions(DispatcherFrame f)
Read Dispatcher Options from a file in the user's preferences directory.static void
setDefaultFileName(java.lang.String testLocation)
void
writeDispatcherOptions(DispatcherFrame f)
Write out Dispatcher options to a file in the user's preferences directory.-
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
-
trainsFromEnumMap
static final AbstractXmlAdapter.EnumIO<DispatcherFrame.TrainsFrom> trainsFromEnumMap
-
dispatcher
protected DispatcherFrame dispatcher
-
-
Constructor Detail
-
OptionsFile
public OptionsFile()
-
-
Method Detail
-
setDefaultFileName
public static void setDefaultFileName(java.lang.String testLocation)
-
readDispatcherOptions
public void readDispatcherOptions(DispatcherFrame f) throws org.jdom2.JDOMException, java.io.IOException
Read Dispatcher Options from a file in the user's preferences directory. If the file containing Dispatcher Options does not exist, this routine returns quietly.The lename attribute is deprecated at 5.1.3. The current value will be retained.
- Parameters:
f
- The dispatcher instance.- Throws:
org.jdom2.JDOMException
- if dispatcher parameter logically incorrectjava.io.IOException
- if dispatcher parameter not found
-
writeDispatcherOptions
public void writeDispatcherOptions(DispatcherFrame f) throws java.io.IOException
Write out Dispatcher options to a file in the user's preferences directory.The lename attribute is deprecated at 5.1.3. The current value will be retained.
- Parameters:
f
- Dispatcher instance.- Throws:
java.io.IOException
- Thrown if dispatcher option file not found
-
-