net.sf.jaxodraw.util
Class JaxoPrefs

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

public final class JaxoPrefs
extends 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 String PREF_AMPLITUDE
          The preferred amplitude for photon and gluon objects.
static String PREF_ANTIALIAS
          A boolean preference indicating whether to use antialias or not.
static String PREF_ARROW
          A boolean preference indicating whether to draw arrows or not.
static String PREF_ARROWINSET
          The preferred arrow inset.
static String PREF_ARROWLENGTH
          The preferred arrow length.
static String PREF_ARROWPOSITION
          The preferred arrow poaition.
static String PREF_ARROWWIDTH
          The preferred arrow width.
static String PREF_BROWSER
          The preferred HTML browser.
static String PREF_CANVASBACKGROUND
          The preferred canvas background color.
static String PREF_COLOR
          The preferred Object color.
static String PREF_COLORSPACE
          The preferred color space.
static String PREF_DEFAULTACTION
          The default action.
static String PREF_DLSEP
          The preferred separation of double line objects.
static String PREF_DVIPSPATH
          The preferred dvips path.
static String PREF_EDITOR
          The preferred text editor.
static String PREF_GRIDCOLOR
          The preferred canvas background color.
static String PREF_GRIDONOFF
          A boolean preference indicating whether the grid is on or off.
static String PREF_GRIDSIZE
          The preferred grid size.
static String PREF_GRIDSTYLE
          The preferred grid style.
static String PREF_GRIDTYPE
          The preferred grid type.
static String PREF_LANGUAGE
          The preferred language.
static String PREF_LATEXPATH
          The preferred latex path.
static String PREF_LINEWIDTH
          The preferred line width.
static String PREF_LOOKNFEEL
          The preferred Look and Feel (as of 2.0, the Class Name).
static String PREF_PSFAMILY
          The preferred Postscript font family.
static String PREF_PSROTANGLE
          The preferred postscript text rotation angle.
static String PREF_PSSIZE
          The preferred Postscript font size.
static String PREF_PSSTYLE
          The preferred Postscript font style.
static String PREF_PSVIEWER
          The preferred postscript viewer.
static String PREF_SCREENSIZEX
          The preferred screen size - x dimension.
static String PREF_SCREENSIZEY
          The preferred screen size - y dimension.
static String PREF_SHOWGRIDBAR
          A boolean preference indicating whether to show the gridbar bar or not.
static String PREF_SHOWSPLASHWINDOW
          A boolean preference indicating whether to show the start-up splash window or not.
static String PREF_SHOWSTATUS
          A boolean preference indicating whether to show the status bar or not.
static String PREF_SHOWTOOL
          A boolean preference indicating whether to show the tool bar or not.
static String PREF_SNAPONOFF
          A boolean preference indicating whether snapping is on or off.
static String PREF_TEXALIGN
          The preferred TeX alignment.
static String PREF_TEXROTANGLE
          The preferred LaTeX text rotation angle.
static String PREF_TEXSIZE
          The preferred TeX font size.
static String PREF_TEXTCOLOR
          The preferred Text color.
static String PREF_UNDODEPTH
          The preferred undo depth.
static String PREF_USER_DIR
          The current user directory.
static String PREF_VERSION
          The version of the preferences.
static String PREF_VERTEXSIZE
          The preferred default vertex size.
 
Method Summary
static void addRecentFile(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(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(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(String name)
          Returns the preference with 'name' as an integer, or throws a IllegalArgumentException if it does not correspond to an int.
static String[] getRecentFiles()
          Returns an array of recently opened files.
static Map<String,Object> getState()
          State of preferences.
static String getStringPref(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(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(String name, boolean newPref)
          Sets the preference with 'name' to the boolean value of newPref.
static void setFloatPref(String name, float newPref)
          Sets the preference with 'name' to the float value of newPref.
static void setIntPref(String name, int newPref)
          Sets the preference with 'name' to the int value newPref.
static void setRecentFiles(String[] filePaths)
          Set the recently opened files to the given array of absolute path names.
static void setState(Map<String,Object> value)
          Restore the preferences to a previous state.
static void setStringPref(String name, 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 String PREF_BROWSER
The preferred HTML browser.

See Also:
Constant Field Values

PREF_EDITOR

public static final String PREF_EDITOR
The preferred text editor.

See Also:
Constant Field Values

PREF_PSVIEWER

public static final String PREF_PSVIEWER
The preferred postscript viewer.

See Also:
Constant Field Values

PREF_LOOKNFEEL

public static final 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 String PREF_LANGUAGE
The preferred language.

See Also:
Constant Field Values

PREF_GRIDTYPE

public static final String PREF_GRIDTYPE
The preferred grid type.

See Also:
Constant Field Values

PREF_COLOR

public static final String PREF_COLOR
The preferred Object color.

See Also:
Constant Field Values

PREF_PSFAMILY

public static final String PREF_PSFAMILY
The preferred Postscript font family.

See Also:
Constant Field Values

PREF_TEXTCOLOR

public static final String PREF_TEXTCOLOR
The preferred Text color.

See Also:
Constant Field Values

PREF_LATEXPATH

public static final String PREF_LATEXPATH
The preferred latex path.

See Also:
Constant Field Values

PREF_DVIPSPATH

public static final String PREF_DVIPSPATH
The preferred dvips path.

See Also:
Constant Field Values

PREF_CANVASBACKGROUND

public static final String PREF_CANVASBACKGROUND
The preferred canvas background color.

See Also:
Constant Field Values

PREF_VERSION

public static final String PREF_VERSION
The version of the preferences.

See Also:
Constant Field Values

PREF_GRIDCOLOR

public static final String PREF_GRIDCOLOR
The preferred canvas background color.

See Also:
Constant Field Values

PREF_USER_DIR

public static final String PREF_USER_DIR
The current user directory.

See Also:
Constant Field Values

PREF_SCREENSIZEX

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

See Also:
Constant Field Values

PREF_SCREENSIZEY

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

See Also:
Constant Field Values

PREF_GRIDSIZE

public static final String PREF_GRIDSIZE
The preferred grid size.

See Also:
Constant Field Values

PREF_AMPLITUDE

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

See Also:
Constant Field Values

PREF_PSSTYLE

public static final String PREF_PSSTYLE
The preferred Postscript font style.

See Also:
Constant Field Values

PREF_PSSIZE

public static final String PREF_PSSIZE
The preferred Postscript font size.

See Also:
Constant Field Values

PREF_TEXSIZE

public static final String PREF_TEXSIZE
The preferred TeX font size.

See Also:
Constant Field Values

PREF_TEXALIGN

public static final String PREF_TEXALIGN
The preferred TeX alignment.

See Also:
Constant Field Values

PREF_PSROTANGLE

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

See Also:
Constant Field Values

PREF_TEXROTANGLE

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

See Also:
Constant Field Values

PREF_DEFAULTACTION

public static final String PREF_DEFAULTACTION
The default action.

See Also:
Constant Field Values

PREF_UNDODEPTH

public static final String PREF_UNDODEPTH
The preferred undo depth.

See Also:
Constant Field Values

PREF_COLORSPACE

public static final String PREF_COLORSPACE
The preferred color space.

See Also:
Constant Field Values

PREF_GRIDSTYLE

public static final String PREF_GRIDSTYLE
The preferred grid style.

See Also:
Constant Field Values

PREF_VERTEXSIZE

public static final String PREF_VERTEXSIZE
The preferred default vertex size.

See Also:
Constant Field Values

PREF_LINEWIDTH

public static final String PREF_LINEWIDTH
The preferred line width.

See Also:
Constant Field Values

PREF_DLSEP

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

See Also:
Constant Field Values

PREF_ARROWPOSITION

public static final String PREF_ARROWPOSITION
The preferred arrow poaition.

See Also:
Constant Field Values

PREF_ARROWLENGTH

public static final String PREF_ARROWLENGTH
The preferred arrow length.

See Also:
Constant Field Values

PREF_ARROWWIDTH

public static final String PREF_ARROWWIDTH
The preferred arrow width.

See Also:
Constant Field Values

PREF_ARROWINSET

public static final String PREF_ARROWINSET
The preferred arrow inset.

See Also:
Constant Field Values

PREF_SHOWTOOL

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

See Also:
Constant Field Values

PREF_SHOWSTATUS

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

See Also:
Constant Field Values

PREF_ANTIALIAS

public static final String PREF_ANTIALIAS
A boolean preference indicating whether to use antialias or not.

See Also:
Constant Field Values

PREF_ARROW

public static final String PREF_ARROW
A boolean preference indicating whether to draw arrows or not.

See Also:
Constant Field Values

PREF_GRIDONOFF

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

See Also:
Constant Field Values

PREF_SNAPONOFF

public static final String PREF_SNAPONOFF
A boolean preference indicating whether snapping is on or off.

See Also:
Constant Field Values

PREF_SHOWGRIDBAR

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

See Also:
Constant Field Values

PREF_SHOWSPLASHWINDOW

public static final String PREF_SHOWSPLASHWINDOW
A boolean preference indicating whether 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 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(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(String st)
Adds the given absolute path name to the list of recntly opened files.

Parameters:
st - an absolute path name.

getStringPref

public static String getStringPref(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(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(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(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(String name,
                                 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(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(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(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 Map<String,Object> getState()
State of preferences. The only use is to restore the current state later (after having made temporary changes) with setState(java.util.Map).

Returns:
Object

setState

public static void setState(Map<String,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(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.



Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.