org.jmol.export.dialog

Class HistoryFile

public class HistoryFile extends Object

The history file contains data from previous uses of Jmol.

Author: Bradley A. Smith (bradley@baysmith.com)

Field Summary
Filefile
The location of the history file.
Stringheader
The information written to the header of the history file.
Propertiesproperties
The data stored in the history file.
Constructor Summary
HistoryFile(File file, String header)
Creates a history file.
Method Summary
voidaddProperties(Properties properties)
Adds the given properties to the history.
booleanaddProperty(String key, String value)
Adds the given property to the history.
booleanaddWindowBorder(String name, Point border)
Adds the window border to the history.
voidaddWindowInfo(String name, Component window, Point border)
Adds the window informations to the history.
booleanaddWindowPosition(String name, Point position)
Adds the window position to the history.
booleanaddWindowSize(String name, Dimension size)
Adds the window size to the history.
booleanaddWindowVisibility(String name, boolean visible)
Adds the window visibility to the history.
FilegetFile()
PropertiesgetProperties()
StringgetProperty(String key, String defaultValue)
Get the value of a property
PointgetWindowBorder(String name)
PointgetWindowPosition(String name)
DimensiongetWindowSize(String name)
BooleangetWindowVisibility(String name)
voidload()
Loads properties from the history file.
voidrepositionWindow(String name, Component window, int minWidth, int minHeight)
Uses the informations in the history to reposition the window.
voidrepositionWindow(String name, Component window)
Uses the informations in the history to reposition the window.
voidsave()
Saves properties to the history file.

Field Detail

file

File file
The location of the history file.

header

String header
The information written to the header of the history file.

properties

private Properties properties
The data stored in the history file.

Constructor Detail

HistoryFile

public HistoryFile(File file, String header)
Creates a history file.

Parameters: file the location of the file. header information written to the header of the file.

Method Detail

addProperties

public void addProperties(Properties properties)
Adds the given properties to the history. If a property existed previously, it will be replaced.

Parameters: properties the properties to add.

addProperty

private boolean addProperty(String key, String value)
Adds the given property to the history. If it existed previously, it will be replaced.

Parameters: key Key of the property to add value Value of the property

Returns: true if the property is modified

addWindowBorder

private boolean addWindowBorder(String name, Point border)
Adds the window border to the history. If it existed previously, it will be replaced.

Parameters: name window name border Window border

Returns: Tells if the properties are modified

addWindowInfo

public void addWindowInfo(String name, Component window, Point border)
Adds the window informations to the history. If it existed previously, it will be replaced.

Parameters: name Window name window Window border Point border

addWindowPosition

private boolean addWindowPosition(String name, Point position)
Adds the window position to the history. If it existed previously, it will be replaced.

Parameters: name Window name position Window position

Returns: Tells if the properties are modified

addWindowSize

private boolean addWindowSize(String name, Dimension size)
Adds the window size to the history. If it existed previously, it will be replaced.

Parameters: name Window name size Window size

Returns: Tells if the properties are modified

addWindowVisibility

private boolean addWindowVisibility(String name, boolean visible)
Adds the window visibility to the history. If it existed previously, it will be replaced.

Parameters: name Window name visible Window visibilite

Returns: Tells if the properties are modified

getFile

public File getFile()

getProperties

public Properties getProperties()

Returns: The properties stored in the history file.

getProperty

public String getProperty(String key, String defaultValue)
Get the value of a property

Parameters: key Key of the property to find defaultValue Default value to use if the property is not found

Returns: The value of the property

getWindowBorder

public Point getWindowBorder(String name)

Parameters: name window name

Returns: window border stored in the history file

getWindowPosition

public Point getWindowPosition(String name)

Parameters: name Window name

Returns: Position of the window stored in the history file

getWindowSize

public Dimension getWindowSize(String name)

Parameters: name Window name

Returns: Size of the window stored in the history file

getWindowVisibility

public Boolean getWindowVisibility(String name)

Parameters: name Window name

Returns: Visibility of the window stored in the history file

load

private void load()
Loads properties from the history file.

repositionWindow

public void repositionWindow(String name, Component window, int minWidth, int minHeight)
Uses the informations in the history to reposition the window.

Parameters: name Window name window Window minWidth minHeight

repositionWindow

public void repositionWindow(String name, Component window)
Uses the informations in the history to reposition the window.

Parameters: name Window name window Window

save

private void save()
Saves properties to the history file.