net.sourceforge.jsxe
Class BufferHistory

java.lang.Object
  extended bynet.sourceforge.jsxe.BufferHistory

public class BufferHistory
extends Object

Maintains the files that have been used recently and their properties. The recent.xml file in the .jsXe directory in the user's home directory holds properties and info about how the user was using the document when he or she closed it last. This way the user can resume work on a file fairly seamlessly even though they closed the file previously or exited jsXe entirely

Version:
$Id: BufferHistory.java 832 2006-04-08 04:02:47Z ian_lewis $
Author:
Ian Lewis (IanLewis@member.fsf.org)

Nested Class Summary
static class BufferHistory.BufferHistoryEntry
          Represents an entry in the buffer history.
 
Constructor Summary
BufferHistory()
          Creates a new empty buffer history
 
Method Summary
 ArrayList getEntries()
          Gets a list of all entries in the buffer history
 BufferHistory.BufferHistoryEntry getEntry(String path)
          Gets an entry in the buffer history for the path given.
 void load(File file)
          Loads the buffer history from a file on disk.
 void save(File file)
          Saves the buffer history to a file on disk
 void setEntry(BufferHistory.BufferHistoryEntry entry)
          Adds a new entry to the buffer history.
 void setEntry(DocumentBuffer buffer, String viewName)
          Adds or updates an entry in the buffer history for an open file
 void setEntry(String path, String viewName, Properties properties)
          Adds or updates an entry in the buffer history for the path given
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferHistory

public BufferHistory()
Creates a new empty buffer history

Method Detail

getEntry

public BufferHistory.BufferHistoryEntry getEntry(String path)
Gets an entry in the buffer history for the path given.

Parameters:
path - the path of the file in the buffer history
Returns:
the BufferHistoryEntry object containing the info

getEntries

public ArrayList getEntries()
Gets a list of all entries in the buffer history

Returns:
an ArrayList of BufferHistoryEntry objects

setEntry

public void setEntry(DocumentBuffer buffer,
                     String viewName)
Adds or updates an entry in the buffer history for an open file

Parameters:
buffer - the DocumentBuffer to update the history for
viewName - the name of the document view that was being used

setEntry

public void setEntry(String path,
                     String viewName,
                     Properties properties)
Adds or updates an entry in the buffer history for the path given

Parameters:
viewName - the name of the document view that was being used
properties - the properties to save to the history

setEntry

public void setEntry(BufferHistory.BufferHistoryEntry entry)
Adds a new entry to the buffer history. If the entry is for a file that is already in the history then the info in the history is updated with the new info.

Parameters:
entry - the BufferHistoryEntry to set to the history

load

public void load(File file)
          throws IOException,
                 SAXException,
                 ParserConfigurationException
Loads the buffer history from a file on disk.

Parameters:
file - the file from which to load the buffer history
Throws:
IOException
SAXException
ParserConfigurationException

save

public void save(File file)
          throws IOException
Saves the buffer history to a file on disk

Parameters:
file - the file to save the buffer history to
Throws:
IOException