Package jmri.jmrit.operations
Class OperationsXml
- java.lang.Object
-
- jmri.jmrit.XmlFile
-
- jmri.jmrit.operations.OperationsXml
-
- Direct Known Subclasses:
CarManagerXml
,EngineManagerXml
,LocationManagerXml
,OperationsSetupXml
,RouteManagerXml
,TrainManagerXml
public abstract class OperationsXml extends XmlFile
Loads and stores the operation setup using xml files.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jmri.jmrit.XmlFile
XmlFile.Validate
-
-
Field Summary
-
Fields inherited from class jmri.jmrit.XmlFile
dtdLocation, xsltLocation
-
-
Constructor Summary
Constructors Constructor Description OperationsXml()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static boolean
areFilesDirty()
Checks to see if any operations files are dirtystatic boolean
checkFileName(java.lang.String name)
Checks name for the file control characters:protected java.io.File
createFile(java.lang.String fullPathName, boolean backupFile)
java.lang.String
getDefaultOperationsFilename()
static java.lang.String
getFileLocation()
Absolute path to location of Operations files.static java.lang.String
getOperationsDirectoryName()
java.lang.String
getOperationsFileName()
boolean
isDirty()
protected void
load()
abstract void
readFile(java.lang.String filename)
static void
save()
Saves operation files that have been modified.void
setDirty(boolean b)
static void
setFileLocation(java.lang.String location)
Set path to location of Operations files.static void
setOperationsDirectoryName(java.lang.String name)
void
setOperationsFileName(java.lang.String name)
protected void
writeFile(java.lang.String filename)
void
writeFileIfDirty()
void
writeOperationsFile()
Store the all of the operation train objects in the default place, including making a backup if needed-
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
-
-
-
-
Constructor Detail
-
OperationsXml
public OperationsXml()
-
-
Method Detail
-
writeOperationsFile
public void writeOperationsFile()
Store the all of the operation train objects in the default place, including making a backup if needed
-
load
protected void load()
-
createFile
protected java.io.File createFile(java.lang.String fullPathName, boolean backupFile)
-
writeFile
protected void writeFile(java.lang.String filename) throws java.io.FileNotFoundException, java.io.IOException
- Throws:
java.io.FileNotFoundException
java.io.IOException
-
readFile
public abstract void readFile(java.lang.String filename) throws org.jdom2.JDOMException, java.io.IOException
- Parameters:
filename
- The string file name.- Throws:
org.jdom2.JDOMException
- Due to XML parsing errorjava.io.IOException
- Due to trouble accessing named file
-
setDirty
public void setDirty(boolean b)
-
isDirty
public boolean isDirty()
-
writeFileIfDirty
public void writeFileIfDirty()
-
getDefaultOperationsFilename
public java.lang.String getDefaultOperationsFilename()
-
setOperationsDirectoryName
public static void setOperationsDirectoryName(java.lang.String name)
-
getOperationsDirectoryName
public static java.lang.String getOperationsDirectoryName()
-
setOperationsFileName
public void setOperationsFileName(java.lang.String name)
-
getOperationsFileName
public java.lang.String getOperationsFileName()
-
getFileLocation
public static java.lang.String getFileLocation()
Absolute path to location of Operations files.Default is in the user's files path, but can be set to anything.
- Returns:
- The string path name.
- See Also:
FileUtil.getUserFilesPath()
-
setFileLocation
public static void setFileLocation(java.lang.String location)
Set path to location of Operations files.Default is in the user's files path, but can be set to anything.
- Parameters:
location
- path to file, including trailing file separator.
-
checkFileName
public static boolean checkFileName(java.lang.String name)
Checks name for the file control characters:- Parameters:
name
- The string to check for a valid file name.- Returns:
- true if name is okay, false if name contains a control character.
-
save
public static void save()
Saves operation files that have been modified.
-
areFilesDirty
public static boolean areFilesDirty()
Checks to see if any operations files are dirty- Returns:
- True if any operations parameters have been modified.
-
-