public class RecentFilesManager extends Object
| Modifier and Type | Field and Description |
|---|---|
private static RecentFilesManager |
currentManager |
private String |
fileName |
private JAXBContext |
jaxbContext |
private static org.apache.log4j.Logger |
logger |
private Marshaller |
marshaller |
private ObjectFactory |
of |
private File |
path |
private RecentFiles |
recentFiles |
private Unmarshaller |
unmarshaller |
private File |
xmlFile |
private InputStream |
xmlSchemaFileIS |
private String |
xmlSchemaLocation |
| Constructor and Description |
|---|
RecentFilesManager()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNewRecentFile(File f,
DataType dataType,
int maxItems)
This method adds a recently opened file to the top of the existing ones.
|
void |
clearRecentFiles()
This method erases the list of latest files.
|
private File |
exist(File jaxbFile)
Search for an existing file in the list.
|
static RecentFilesManager |
getCurrentInstance() |
RecentFiles |
getRecentFiles()
Gets the recent file list.
|
static void |
main(String[] args) |
void |
read()
Public delegate method for reading the xml file.
|
protected void |
readXML()
Loads the list of recent files from an existing XML file.
|
private static void |
setCurrentInstance(RecentFilesManager arg) |
private void |
setLastUpdate()
Each time the configuration is updated, write the time stamp too.
|
private void |
validate()
Validates the XML file against the defined schema.
|
protected void |
writeInitialXML(RecentFiles empty)
Writes an initial XML file to the specified path in the file system.
|
protected void |
writeXML()
Writes an XML file to the specified path in the file system.
|
private static final org.apache.log4j.Logger logger
private static RecentFilesManager currentManager
private File path
private String fileName
private final String xmlSchemaLocation
private File xmlFile
private InputStream xmlSchemaFileIS
private JAXBContext jaxbContext
private Marshaller marshaller
private Unmarshaller unmarshaller
private RecentFiles recentFiles
private ObjectFactory of
public void addNewRecentFile(File f, DataType dataType, int maxItems) throws Exception
private File exist(File jaxbFile)
jaxbFile - File objectpublic void clearRecentFiles()
throws Exception
Exceptionpublic RecentFiles getRecentFiles()
private void validate()
public void read()
throws JAXBException
JAXBExceptionprotected void readXML()
throws JAXBException
JAXBException - - if the XML file does not comply with the schemaprotected void writeXML()
protected void writeInitialXML(RecentFiles empty)
private void setLastUpdate()
public static RecentFilesManager getCurrentInstance()
private static void setCurrentInstance(RecentFilesManager arg)
public static void main(String[] args)
Copyright © 2009–2017 Helmut Ahammer, Philipp Kainz. All rights reserved.