net.sf.jaxodraw.util
Class JaxoPrefs

java.lang.Object
  extended by net.sf.jaxodraw.util.JaxoPrefs

public final class JaxoPrefs
extends java.lang.Object

Responsible for importing/exporting user preferences.

Since:
2.0

Field Summary
static int MAX_RECENT_FILES
          Defines the maximum numbers of recent files presented in the recent file menu.
static java.lang.String PREF_AMPLITUDE
          The preferred amplitude for photon and gluon objects.
static java.lang.String PREF_ANTIALIAS
          A boolean preference indicating wether to use antialias or not.
static java.lang.String PREF_ARROW
          A boolean preference indicating wether to draw arrows or not.
static java.lang.String PREF_ARROWINSET
          The preferred arrow inset.
static java.lang.String PREF_ARROWLENGTH
          The preferred arrow length.
static java.lang.String PREF_ARROWPOSITION
          The preferred arrow poaition.
static java.lang.String PREF_ARROWWIDTH
          The preferred arrow width.
static java.lang.String PREF_BROWSER
          The preferred HTML browser.
static java.lang.String PREF_CANVASBACKGROUND
          The preferred canvas background color.
static java.lang.String PREF_COLOR
          The preferred Object color.
static java.lang.String PREF_COLORSPACE
          The preferred color space.
static java.lang.String PREF_DEFAULTACTION
          The default action.
static java.lang.String PREF_DLSEP
          The preferred separation of double line objects.
static java.lang.String PREF_DVIPSPATH
          The preferred dvips path.
static java.lang.String PREF_EDITOR
          The preferred text editor.
static java.lang.String PREF_GRIDCOLOR
          The preferred canvas background color.
static java.lang.String PREF_GRIDONOFF
          A boolean preference indicating wether the grid is on or off.
static java.lang.String PREF_GRIDSIZE
          The preferred grid size.
static java.lang.String PREF_GRIDSTYLE
          The preferred grid style.
static java.lang.String PREF_GRIDTYPE
          The preferred grid type.
static java.lang.String PREF_LANGUAGE
          The preferred language.
static java.lang.String PREF_LATEXPATH
          The preferred latex path.
static java.lang.String PREF_LINEWIDTH
          The preferred line width.
static java.lang.String PREF_LOOKNFEEL
          The preferred Look and Feel (as of 2.0, the Class Name).
static java.lang.String PREF_PSFAMILY
          The preferred Postscript font family.
static java.lang.String PREF_PSROTANGLE
          The preferred postscript text rotation angle.
static java.lang.String PREF_PSSIZE
          The preferred Postscript font size.
static java.lang.String PREF_PSSTYLE
          The preferred Postscript font style.
static java.lang.String PREF_PSVIEWER
          The preferred postscript viewer.
static java.lang.String PREF_SCREENSIZEX
          The preferred screen size - x dimension.
static java.lang.String PREF_SCREENSIZEY
          The preferred screen size - y dimension.
static java.lang.String PREF_SHOWGRIDBAR
          A boolean preference indicating wether to show the gridbar bar or not.
static java.lang.String PREF_SHOWSPLASHWINDOW
          A boolean preference indicating wether to show the start-up splash window or not.
static java.lang.String PREF_SHOWSTATUS
          A boolean preference indicating wether to show the status bar or not.
static java.lang.String PREF_SHOWTOOL
          A boolean preference indicating wether to show the tool bar or not.
static java.lang.String PREF_SNAPONOFF
          A boolean preference indicating wether snapping is on or off.
static java.lang.String PREF_TEXALIGN
          The preferred TeX alignment.
static java.lang.String PREF_TEXROTANGLE
          The preferred LaTeX text rotation angle.
static java.lang.String PREF_TEXSIZE
          The preferred TeX font size.
static java.lang.String PREF_TEXTCOLOR
          The preferred Text color.
static java.lang.String PREF_UNDODEPTH
          The preferred undo depth.
static java.lang.String PREF_USER_DIR
          The current user directory.
static java.lang.String PREF_VERSION
          The version of the preferences.
static java.lang.String PREF_VERTEXSIZE
          The preferred default vertex size.
 
Method Summary
static void addRecentFile(java.lang.String st)
          Adds the given absolute path name to the list of recntly opened files.
static void clearRecentFiles()
          Sets all recent files to empty Strings.
static boolean getBooleanPref(java.lang.String name)
          Returns the preference with 'name' as a boolean, or throws a IllegalArgumentException if it does not correspond to a boolean.
static float getFloatPref(java.lang.String name)
          Returns the preference with 'name' as a float, or throws a IllegalArgumentException if it does not correspond to a float.
static int getIntPref(java.lang.String name)
          Returns the preference with 'name' as an integer, or throws a IllegalArgumentException if it does not correspond to an int.
static java.lang.String[] getRecentFiles()
          Returns an array of recently opened files.
static java.lang.Object getState()
          State of preferences.
static java.lang.String getStringPref(java.lang.String name)
          Returns the preference with 'name' as a String, or throws a IllegalArgumentException if it does not correspond to a String.
static void initSessionPrefs()
          Sets the Preferences for the current session from the Preferences node.
static void resetPref(java.lang.String name)
          Re-sets the given Preference to its default value.
static void savePrefs()
          Saves the current set of Preferences to the user Preferences node, so they will be used in later sessions.
static void saveRecentFiles()
          Saves the last visited files in the Preferences node.
static void setBooleanPref(java.lang.String name, boolean newPref)
          Sets the preference with 'name' to the boolean value of newPref.
static void setFloatPref(java.lang.String name, float newPref)
          Sets the preference with 'name' to the float value of newPref.
static void setIntPref(java.lang.String name, int newPref)
          Sets the preference with 'name' to the int value newPref.
static void setRecentFiles(java.lang.String[] filePaths)
          Set the recently opened files to the given array of absolute path names.
static void setState(java.lang.Object value)
          Restore the preferences to a previous state.
static void setStringPref(java.lang.String name, java.lang.String str)
          Sets the preference with 'name' to the string str.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREF_BROWSER

public static final java.lang.String PREF_BROWSER
The preferred HTML browser.

See Also:
Constant Field Values

PREF_EDITOR

public static final java.lang.String PREF_EDITOR
The preferred text editor.

See Also:
Constant Field Values

PREF_PSVIEWER

public static final java.lang.String PREF_PSVIEWER
The preferred postscript viewer.

See Also:
Constant Field Values

PREF_LOOKNFEEL

public static final java.lang.String PREF_LOOKNFEEL
The preferred Look and Feel (as of 2.0, the Class Name).

See Also:
Constant Field Values

PREF_LANGUAGE

public static final java.lang.String PREF_LANGUAGE
The preferred language.

See Also:
Constant Field Values

PREF_GRIDTYPE

public static final java.lang.String PREF_GRIDTYPE
The preferred grid type.

See Also:
Constant Field Values

PREF_COLOR

public static final java.lang.String PREF_COLOR
The preferred Object color.

See Also:
Constant Field Values

PREF_PSFAMILY

public static final java.lang.String PREF_PSFAMILY
The preferred Postscript font family.

See Also:
Constant Field Values

PREF_TEXTCOLOR

public static final java.lang.String PREF_TEXTCOLOR
The preferred Text color.

See Also:
Constant Field Values

PREF_LATEXPATH

public static final java.lang.String PREF_LATEXPATH
The preferred latex path.

See Also:
Constant Field Values

PREF_DVIPSPATH

public static final java.lang.String PREF_DVIPSPATH
The preferred dvips path.

See Also:
Constant Field Values

PREF_CANVASBACKGROUND

public static final java.lang.String PREF_CANVASBACKGROUND
The preferred canvas background color.

See Also:
Constant Field Values

PREF_VERSION

public static final java.lang.String PREF_VERSION
The version of the preferences.

See Also:
Constant Field Values

PREF_GRIDCOLOR

public static final java.lang.String PREF_GRIDCOLOR
The preferred canvas background color.

See Also:
Constant Field Values

PREF_USER_DIR

public static final java.lang.String PREF_USER_DIR
The current user directory.

See Also:
Constant Field Values

PREF_SCREENSIZEX

public static final java.lang.String PREF_SCREENSIZEX
The preferred screen size - x dimension.

See Also:
Constant Field Values

PREF_SCREENSIZEY

public static final java.lang.String PREF_SCREENSIZEY
The preferred screen size - y dimension.

See Also:
Constant Field Values

PREF_GRIDSIZE

public static final java.lang.String PREF_GRIDSIZE
The preferred grid size.

See Also:
Constant Field Values

PREF_AMPLITUDE

public static final java.lang.String PREF_AMPLITUDE
The preferred amplitude for photon and gluon objects.

See Also:
Constant Field Values

PREF_PSSTYLE

public static final java.lang.String PREF_PSSTYLE
The preferred Postscript font style.

See Also:
Constant Field Values

PREF_PSSIZE

public static final java.lang.String PREF_PSSIZE
The preferred Postscript font size.

See Also:
Constant Field Values

PREF_TEXSIZE

public static final java.lang.String PREF_TEXSIZE
The preferred TeX font size.

See Also:
Constant Field Values

PREF_TEXALIGN

public static final java.lang.String PREF_TEXALIGN
The preferred TeX alignment.

See Also:
Constant Field Values

PREF_PSROTANGLE

public static final java.lang.String PREF_PSROTANGLE
The preferred postscript text rotation angle.

See Also:
Constant Field Values

PREF_TEXROTANGLE

public static final java.lang.String PREF_TEXROTANGLE
The preferred LaTeX text rotation angle.

See Also:
Constant Field Values

PREF_DEFAULTACTION

public static final java.lang.String PREF_DEFAULTACTION
The default action.

See Also:
Constant Field Values

PREF_UNDODEPTH

public static final java.lang.String PREF_UNDODEPTH
The preferred undo depth.

See Also:
Constant Field Values

PREF_COLORSPACE

public static final java.lang.String PREF_COLORSPACE
The preferred color space.

See Also:
Constant Field Values

PREF_GRIDSTYLE

public static final java.lang.String PREF_GRIDSTYLE
The preferred grid style.

See Also:
Constant Field Values

PREF_VERTEXSIZE

public static final java.lang.String PREF_VERTEXSIZE
The preferred default vertex size.

See Also:
Constant Field Values

PREF_LINEWIDTH

public static final java.lang.String PREF_LINEWIDTH
The preferred line width.

See Also:
Constant Field Values

PREF_DLSEP

public static final java.lang.String PREF_DLSEP
The preferred separation of double line objects.

See Also:
Constant Field Values

PREF_ARROWPOSITION

public static final java.lang.String PREF_ARROWPOSITION
The preferred arrow poaition.

See Also:
Constant Field Values

PREF_ARROWLENGTH

public static final java.lang.String PREF_ARROWLENGTH
The preferred arrow length.

See Also:
Constant Field Values

PREF_ARROWWIDTH

public static final java.lang.String PREF_ARROWWIDTH
The preferred arrow width.

See Also:
Constant Field Values

PREF_ARROWINSET

public static final java.lang.String PREF_ARROWINSET
The preferred arrow inset.

See Also:
Constant Field Values

PREF_SHOWTOOL

public static final java.lang.String PREF_SHOWTOOL
A boolean preference indicating wether to show the tool bar or not.

See Also:
Constant Field Values

PREF_SHOWSTATUS

public static final java.lang.String PREF_SHOWSTATUS
A boolean preference indicating wether to show the status bar or not.

See Also:
Constant Field Values

PREF_ANTIALIAS

public static final java.lang.String PREF_ANTIALIAS
A boolean preference indicating wether to use antialias or not.

See Also:
Constant Field Values

PREF_ARROW

public static final java.lang.String PREF_ARROW
A boolean preference indicating wether to draw arrows or not.

See Also:
Constant Field Values

PREF_GRIDONOFF

public static final java.lang.String PREF_GRIDONOFF
A boolean preference indicating wether the grid is on or off.

See Also:
Constant Field Values

PREF_SNAPONOFF

public static final java.lang.String PREF_SNAPONOFF
A boolean preference indicating wether snapping is on or off.

See Also:
Constant Field Values

PREF_SHOWGRIDBAR

public static final java.lang.String PREF_SHOWGRIDBAR
A boolean preference indicating wether to show the gridbar bar or not.

See Also:
Constant Field Values

PREF_SHOWSPLASHWINDOW

public static final java.lang.String PREF_SHOWSPLASHWINDOW
A boolean preference indicating wether to show the start-up splash window or not.

See Also:
Constant Field Values

MAX_RECENT_FILES

public static final int MAX_RECENT_FILES
Defines the maximum numbers of recent files presented in the recent file menu.

See Also:
Constant Field Values
Method Detail

getRecentFiles

public static java.lang.String[] getRecentFiles()
Returns an array of recently opened files.

Returns:
An array containing the absolute paths of recently opened files or empty Strings.

setRecentFiles

public static void setRecentFiles(java.lang.String[] filePaths)
Set the recently opened files to the given array of absolute path names.

Parameters:
filePaths - the absolute path names. If an entry is null, it will be replaced by an empty String.

clearRecentFiles

public static void clearRecentFiles()
Sets all recent files to empty Strings.


addRecentFile

public static void addRecentFile(java.lang.String st)
Adds the given absolute path name to the list of recntly opened files.

Parameters:
st - an absolute path name.

getStringPref

public static java.lang.String getStringPref(java.lang.String name)
Returns the preference with 'name' as a String, or throws a IllegalArgumentException if it does not correspond to a String.

Parameters:
name - The name of the preference.
Returns:
The preference with 'name'.

getIntPref

public static int getIntPref(java.lang.String name)
Returns the preference with 'name' as an integer, or throws a IllegalArgumentException if it does not correspond to an int.

Parameters:
name - The name of the preference.
Returns:
The preference with 'name'.

getFloatPref

public static float getFloatPref(java.lang.String name)
Returns the preference with 'name' as a float, or throws a IllegalArgumentException if it does not correspond to a float.

Parameters:
name - The name of the preference.
Returns:
The preference with 'name'.

getBooleanPref

public static boolean getBooleanPref(java.lang.String name)
Returns the preference with 'name' as a boolean, or throws a IllegalArgumentException if it does not correspond to a boolean.

Parameters:
name - The name of the preference.
Returns:
The preference with 'name'.

setStringPref

public static void setStringPref(java.lang.String name,
                                 java.lang.String str)
Sets the preference with 'name' to the string str.

Parameters:
name - The name of the preference to be set.
str - the preference to be set.

setIntPref

public static void setIntPref(java.lang.String name,
                              int newPref)
Sets the preference with 'name' to the int value newPref.

Parameters:
name - The name of the preference to be set.
newPref - The preference to be set.

setFloatPref

public static void setFloatPref(java.lang.String name,
                                float newPref)
Sets the preference with 'name' to the float value of newPref.

Parameters:
name - The name of the preference to be set.
newPref - The preference to be set.

setBooleanPref

public static void setBooleanPref(java.lang.String name,
                                  boolean newPref)
Sets the preference with 'name' to the boolean value of newPref.

Parameters:
name - The name of the preference to be set.
newPref - The preference to be set.

getState

public static java.lang.Object getState()
State of preferences. The only use is to restore the current state later (after having made temporary changes) with setState(Object).

Returns:
Object

setState

public static void setState(java.lang.Object value)
Restore the preferences to a previous state.

Parameters:
value - previous state to be set, obtained from getState().

initSessionPrefs

public static void initSessionPrefs()
Sets the Preferences for the current session from the Preferences node.


resetPref

public static void resetPref(java.lang.String name)
Re-sets the given Preference to its default value.

Parameters:
name - the name of the preference to re-set.

savePrefs

public static void savePrefs()
Saves the current set of Preferences to the user Preferences node, so they will be used in later sessions.


saveRecentFiles

public static void saveRecentFiles()
Saves the last visited files in the Preferences node.



Licensed under GPL. For more information, see http://jaxodraw.sourceforge.net/license.html or the LICENSE file in the jaxodraw distribution.