Package net.sf.jaxodraw.util
Class JaxoPrefs
- java.lang.Object
-
- net.sf.jaxodraw.util.JaxoPrefs
-
public final class JaxoPrefs extends java.lang.ObjectResponsible for importing/exporting user preferences.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_RECENT_FILESDefines the maximum numbers of recent files presented in the recent file menu.static java.lang.StringPREF_AMPLITUDEThe preferred amplitude for photon and gluon objects.static java.lang.StringPREF_ANTIALIASA boolean preference indicating whether to use antialias or not.static java.lang.StringPREF_ARROWA boolean preference indicating whether to draw arrows or not.static java.lang.StringPREF_ARROWINSETThe preferred arrow inset.static java.lang.StringPREF_ARROWLENGTHThe preferred arrow length.static java.lang.StringPREF_ARROWPOSITIONThe preferred arrow poaition.static java.lang.StringPREF_ARROWWIDTHThe preferred arrow width.static java.lang.StringPREF_BROWSERThe preferred HTML browser.static java.lang.StringPREF_CANVASBACKGROUNDThe preferred canvas background color.static java.lang.StringPREF_COLORThe preferred Object color.static java.lang.StringPREF_COLORSPACEThe preferred color space.static java.lang.StringPREF_DEFAULTACTIONThe default action.static java.lang.StringPREF_DLSEPThe preferred separation of double line objects.static java.lang.StringPREF_DVIPSPATHThe preferred dvips path.static java.lang.StringPREF_EDITORThe preferred text editor.static java.lang.StringPREF_GRIDCOLORThe preferred canvas background color.static java.lang.StringPREF_GRIDONOFFA boolean preference indicating whether the grid is on or off.static java.lang.StringPREF_GRIDSIZEThe preferred grid size.static java.lang.StringPREF_GRIDSTYLEThe preferred grid style.static java.lang.StringPREF_GRIDTYPEThe preferred grid type.static java.lang.StringPREF_LANGUAGEThe preferred language.static java.lang.StringPREF_LATEXPATHThe preferred latex path.static java.lang.StringPREF_LINEWIDTHThe preferred line width.static java.lang.StringPREF_LOOKNFEELThe preferred Look and Feel (as of 2.0, the Class Name).static java.lang.StringPREF_PSFAMILYThe preferred Postscript font family.static java.lang.StringPREF_PSROTANGLEThe preferred postscript text rotation angle.static java.lang.StringPREF_PSSIZEThe preferred Postscript font size.static java.lang.StringPREF_PSSTYLEThe preferred Postscript font style.static java.lang.StringPREF_PSVIEWERThe preferred postscript viewer.static java.lang.StringPREF_SCREENSIZEXThe preferred screen size - x dimension.static java.lang.StringPREF_SCREENSIZEYThe preferred screen size - y dimension.static java.lang.StringPREF_SHOWGRIDBARA boolean preference indicating whether to show the gridbar bar or not.static java.lang.StringPREF_SHOWSPLASHWINDOWA boolean preference indicating whether to show the start-up splash window or not.static java.lang.StringPREF_SHOWSTATUSA boolean preference indicating whether to show the status bar or not.static java.lang.StringPREF_SHOWTOOLA boolean preference indicating whether to show the tool bar or not.static java.lang.StringPREF_SNAPONOFFA boolean preference indicating whether snapping is on or off.static java.lang.StringPREF_TEXALIGNThe preferred TeX alignment.static java.lang.StringPREF_TEXROTANGLEThe preferred LaTeX text rotation angle.static java.lang.StringPREF_TEXSIZEThe preferred TeX font size.static java.lang.StringPREF_TEXTCOLORThe preferred Text color.static java.lang.StringPREF_UNDODEPTHThe preferred undo depth.static java.lang.StringPREF_USER_DIRThe current user directory.static java.lang.StringPREF_VERSIONThe version of the preferences.static java.lang.StringPREF_VERTEXSIZEThe preferred default vertex size.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddRecentFile(java.lang.String st)Adds the given absolute path name to the list of recntly opened files.static voidclearRecentFiles()Sets all recent files to empty Strings.static booleangetBooleanPref(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 floatgetFloatPref(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 intgetIntPref(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.util.Map<java.lang.String,java.lang.Object>getState()State of preferences.static java.lang.StringgetStringPref(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 voidinitSessionPrefs()Sets the Preferences for the current session from the Preferences node.static voidresetPref(java.lang.String name)Re-sets the given Preference to its default value.static voidsavePrefs()Saves the current set of Preferences to the user Preferences node, so they will be used in later sessions.static voidsaveRecentFiles()Saves the last visited files in the Preferences node.static voidsetBooleanPref(java.lang.String name, boolean newPref)Sets the preference with 'name' to the boolean value of newPref.static voidsetFloatPref(java.lang.String name, float newPref)Sets the preference with 'name' to the float value of newPref.static voidsetIntPref(java.lang.String name, int newPref)Sets the preference with 'name' to the int value newPref.static voidsetRecentFiles(java.lang.String[] filePaths)Set the recently opened files to the given array of absolute path names.static voidsetState(java.util.Map<java.lang.String,java.lang.Object> value)Restore the preferences to a previous state.static voidsetStringPref(java.lang.String name, java.lang.String str)Sets the preference with 'name' to the string str.
-
-
-
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 whether 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 whether 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 whether to use antialias or not.- See Also:
- Constant Field Values
-
PREF_ARROW
public static final java.lang.String PREF_ARROW
A boolean preference indicating whether to draw arrows or not.- See Also:
- Constant Field Values
-
PREF_GRIDONOFF
public static final java.lang.String PREF_GRIDONOFF
A boolean preference indicating whether 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 whether snapping is on or off.- See Also:
- Constant Field Values
-
PREF_SHOWGRIDBAR
public static final java.lang.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 java.lang.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 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.util.Map<java.lang.String,java.lang.Object> getState()
State of preferences. The only use is to restore the current state later (after having made temporary changes) withsetState(java.util.Map).- Returns:
- Object
-
setState
public static void setState(java.util.Map<java.lang.String,java.lang.Object> value)
Restore the preferences to a previous state.- Parameters:
value- previous state to be set, obtained fromgetState().
-
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.
-
-