|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdevisor2.grid.options.Options
This class represents the central storage and management class for
all Options the user can set throughout the whole application, and some
additional settings for the GUI.
I chose an instance of java.util.Properties to hold the options,
which basically provides a container to store key-value-pairs, both
of type String.
As keys, only the ones declared as constants below in this class are
allowed.
This class also provides access to the default options, which are
hard-coded in the initdefaults() method. So every time other
developers intend to add further options to the application, all they
have to do is:
(1) add a new unique key to the constants below (by convention, separate
keys into option groups such as accelerators, view management, paths
etc)
(2) add a new line to the initDefaults method using the key you just
declared to provide a default initial value for the option
Note on accerelators: the prefix "accelerator" of the keys is used to
determine which keys represent accelerators in the OptionsDialog's
corresponding tab sheet. As accelerators are only assigned to functions
available through the MainMenu, see there how to create a new
menu item including mnemonic and accelerator.
Note on draw options: For easier access, use the DrawControl instance in
the Control Center, which is updated automatically.
Note on dialog positions: For the three dockable dialogs, the last
position the user dragged the dialog to is stored, as well as the initial
position. These screen coordinates are stored as integers representing
the relative position of the dialog's upper left corner to the MainFrame's
upper left corner. As the initial value depends on the MainFrame's size,
it is set on startup and is therefore not hard-coded.
This class is made globally accessible via the ControlCenter instance
(see there for details), so all you have to do to extract an option
at runtime is to call the "get (key)" method which will return the
requested option as String.
Additional features are persistence, you can load and save your options
as plain-text-key-value files, see the OptionsDialog class
(or better its action listener OptionsActionListener) for details.
To obtain further information about the file structure, browse the
java language and API documentation, class Properties in package
java.util, which you can browse online at the SUN web site.
devisor2.GUI.base.dialog.OptionsDialog
,
devisor2.GUI.foundation.MainMenu
Field Summary | |
static java.lang.String |
accelerator_about
key for the accelerator assigned to ABOUT |
static java.lang.String |
accelerator_acceleratoroptions
key for accelerator options |
static java.lang.String |
accelerator_adjustboundaries
key for the accelerator assigned to ADJUSTBOUNDARIES |
static java.lang.String |
accelerator_coloroptions
key for color options |
static java.lang.String |
accelerator_copy
key for the accelerator assigned to COPY |
static java.lang.String |
accelerator_copymode
key for the accelerator assigned to COPYMODE |
static java.lang.String |
accelerator_cut
key for the accelerator assigned to CUT |
static java.lang.String |
accelerator_delete
key for the accelerator assigned to DELETE |
static java.lang.String |
accelerator_deleteworkingboundary
key for the accelerator assigned to DELETEWB |
static java.lang.String |
accelerator_directinput
key for the accelerator assigned to DIRECTINPUT |
static java.lang.String |
accelerator_domainperimeter
key for the accelerator assigned to DOMAINPERIMETER |
static java.lang.String |
accelerator_domainstatistics
key for the accelerator assigned to DOMAINSTATISTICS |
static java.lang.String |
accelerator_drawoptions
key for draw options |
static java.lang.String |
accelerator_edgestatus
key for the accelerator assigned to EDGESTATUS |
static java.lang.String |
accelerator_exit
key for the accelerator assigned to EXIT |
static java.lang.String |
accelerator_faq
key for the accelerator assigned to FAQ |
static java.lang.String |
accelerator_fromtri2prm
key for the accelerator assigned to FROMTRI2PRM |
static java.lang.String |
accelerator_generaloptions
key for general options |
static java.lang.String |
accelerator_linkboundaries
key for the accelerator assigned to LINKBOUNDARIES |
static java.lang.String |
accelerator_loadbalancing
key for the accelerator assigned to LOADBALANCING |
static java.lang.String |
accelerator_manual
key for the accelerator assigned to MANUAL |
static java.lang.String |
accelerator_merge
key for the accelerator assigned to MERGE |
static java.lang.String |
accelerator_mergeboundaries
key for the accelerator assigned to MERGEBOUNDARIES |
static java.lang.String |
accelerator_mirror
key for the accelerator assigned to MIRROR |
static java.lang.String |
accelerator_miscoptions
key for misc options |
static java.lang.String |
accelerator_multipleboundarynodes
key for the accelerator assigned to MULTIPLEBOUNDARYNODES |
static java.lang.String |
accelerator_new
key for the accelerator assigned to NEW |
static java.lang.String |
accelerator_newanalytic
key for the accelerator assigned to NEWANALYTIC |
static java.lang.String |
accelerator_newboundary
key for the accelerator assigned to NEWBOUNDARY |
static java.lang.String |
accelerator_newcirclem
key for the accelerator assigned to NEWCIRCLEM |
static java.lang.String |
accelerator_newcirclep
key for the accelerator assigned to NEWCIRCLEP |
static java.lang.String |
accelerator_newedge
key for the accelerator assigned to NEWEDGE |
static java.lang.String |
accelerator_newline
key for the accelerator assigned to NEWLINE |
static java.lang.String |
accelerator_newmacro
key for the accelerator assigned to NEWMACRO |
static java.lang.String |
accelerator_newmultiline
key for the accelerator assigned to NEWMULTILINE |
static java.lang.String |
accelerator_newnode
key for the accelerator assigned to NEWNODE |
static java.lang.String |
accelerator_newquad
key for the accelerator assigned to NEWQUAD |
static java.lang.String |
accelerator_newtri
key for the accelerator assigned to NEWTRI |
static java.lang.String |
accelerator_open
key for the accelerator assigned to OPEN |
static java.lang.String |
accelerator_parallelblock
key for the accelerator assigned to PARALLELBLOCK |
static java.lang.String |
accelerator_paste
key for the accelerator assigned to PASTE |
static java.lang.String |
accelerator_print
key for the accelerator assigned to PRINT |
static java.lang.String |
accelerator_printls
key for the accelerator assigned to PRINT LANDSCAPE |
static java.lang.String |
accelerator_readme
key for the accelerator assigned to README |
static java.lang.String |
accelerator_rectifyelement
key for the accelerator assigned to RECTIFYELEMENT |
static java.lang.String |
accelerator_redo
key for the accelerator assigned to REDO |
static java.lang.String |
accelerator_refine
key for the accelerator assigned to REFINE |
static java.lang.String |
accelerator_rotate
key for the accelerator assigned to ROTATE |
static java.lang.String |
accelerator_save
key for the accelerator assigned to SAVE |
static java.lang.String |
accelerator_saveas_feast
key for the accelerator assigned to SAVEAS_FEAST |
static java.lang.String |
accelerator_saveas_feat
key for the accelerator assigned to SAVEAS_FEAT |
static java.lang.String |
accelerator_saveas_ucd
key for the accelerator assigned to SAVEAS_UCD |
static java.lang.String |
accelerator_scale
key for the accelerator assigned to SCALE |
static java.lang.String |
accelerator_selectboundary
key for the accelerator assigned to SELECTBOUNDARY |
static java.lang.String |
accelerator_selectedges
key for the accelerator assigned to SELECTEDGES |
static java.lang.String |
accelerator_selectelements
key for the accelerator assigned to SELECTELEMENTS |
static java.lang.String |
accelerator_selectnodes
key for the accelerator assigned to SELECTNODES |
static java.lang.String |
accelerator_selectsegments
key for the accelerator assigned to SELECTSEGMENTS |
static java.lang.String |
accelerator_spellchecker
key for the accelerator assigned to SPELLCHECKER |
static java.lang.String |
accelerator_swapboundaryorientation
key for the accelerator assigned to SWAPBOUNDARYORIENTATION |
static java.lang.String |
accelerator_undo
key for the accelerator assigned to UNDO |
static java.lang.String |
accelerator_viewproperties
key for the accelerator assigned to VIEWPROPERTIES |
static java.lang.String |
accelerator_zoom_resetzoom
key for the accelerator assigned to RESETZOOM |
static java.lang.String |
accelerator_zoom_setzoom
key for the accelerator assigned to SETZOOM |
static java.lang.String |
accelerator_zoom_zoomminus
key for the accelerator assigned to ZOOMMINUS |
static java.lang.String |
accelerator_zoom_zoomplus
key for the accelerator assigned to ZOOMPLUS |
static java.lang.String |
click_tolerance
key for the click tolerance |
static java.lang.String |
color_background
key for the color of the background |
static java.lang.String |
color_boundary0
key for the pallette color 0 for boundaries |
static java.lang.String |
color_boundary1
key for the pallette color 1 for boundaries |
static java.lang.String |
color_boundary10
key for the pallette color 10 for boundaries |
static java.lang.String |
color_boundary11
key for the pallette color 11 for boundaries |
static java.lang.String |
color_boundary12
key for the pallette color 12 for boundaries |
static java.lang.String |
color_boundary13
key for the pallette color 13 for boundaries |
static java.lang.String |
color_boundary14
key for the pallette color 14 for boundaries |
static java.lang.String |
color_boundary15
key for the pallette color 15 for boundaries |
static java.lang.String |
color_boundary2
key for the pallette color 2 for boundaries |
static java.lang.String |
color_boundary3
key for the pallette color 3 for boundaries |
static java.lang.String |
color_boundary4
key for the pallette color 4 for boundaries |
static java.lang.String |
color_boundary5
key for the pallette color 5 for boundaries |
static java.lang.String |
color_boundary6
key for the pallette color 6 for boundaries |
static java.lang.String |
color_boundary7
key for the pallette color 7 for boundaries |
static java.lang.String |
color_boundary8
key for the pallette color 8 for boundaries |
static java.lang.String |
color_boundary9
key for the pallette color 9 for boundaries |
static java.lang.String |
color_boundarynumber
key for the color boundarynumbers are painted with |
static java.lang.String |
color_edge
key for the color edges are painted with |
static java.lang.String |
color_edgebase
key for the base color edges are painted with |
static java.lang.String |
color_edgenumber
key for the color edgenumbers are painted with |
static java.lang.String |
color_element
key for the color elements are painted with |
static java.lang.String |
color_elementnumber
key for the color elementnumbers are painted with |
static java.lang.String |
color_fill0
key for 1st fill palette color |
static java.lang.String |
color_fill1
key for 2nd fill palette color |
static java.lang.String |
color_fill10
key for 11th fill palette color |
static java.lang.String |
color_fill11
key for 12th fill palette color |
static java.lang.String |
color_fill12
key for 13th fill palette color |
static java.lang.String |
color_fill13
key for 14th fill palette color |
static java.lang.String |
color_fill14
key for 15th fill palette color |
static java.lang.String |
color_fill15
key for 16th fill palette color |
static java.lang.String |
color_fill2
key for 3rd fill palette color |
static java.lang.String |
color_fill3
key for 4th fill palette color |
static java.lang.String |
color_fill4
key for 5th fill palette color |
static java.lang.String |
color_fill5
key for 6th fill palette color |
static java.lang.String |
color_fill6
key for 7th fill palette color |
static java.lang.String |
color_fill7
key for 8th fill palette color |
static java.lang.String |
color_fill8
key for 9th fill palette color |
static java.lang.String |
color_fill9
key for 10th fill palette color |
static java.lang.String |
color_grid
key for the color of the grid |
static java.lang.String |
color_lasso
key for the color of the lasso |
static java.lang.String |
color_node
key for the color nodes are painted with |
static java.lang.String |
color_nodenumber
key for the color nodenumbers are painted with |
static java.lang.String |
color_rect
key for the highlight color for rectangular status |
static java.lang.String |
color_selection
key for the highlight color for selections |
static java.lang.String |
draw_crosselement
key for flag if elements are crossed |
static java.lang.String |
draw_drawboundary
key for flag if boundaries are painted |
static java.lang.String |
draw_drawedge
key for flag if edges are painted |
static java.lang.String |
draw_drawelement
key for flag if elements are painted |
static java.lang.String |
draw_drawgrid
key for flag if the grid is painted |
static java.lang.String |
draw_drawnode
key for flag if nodes are painted |
static java.lang.String |
draw_drawperimeter
key for flag if the perimeter is painted |
static java.lang.String |
draw_drawrect
key for flag if rectangular elements are highlighted |
static java.lang.String |
draw_fillelement
key for flag if elements are filled |
static java.lang.String |
draw_numberboundary
key for flag if boundary numbers are painted |
static java.lang.String |
draw_numberedge
key for flag if edge numbers are painted |
static java.lang.String |
draw_numberelement
key for flag if element numbers are painted |
static java.lang.String |
draw_numbernode
key for flag if node numbers are painted |
static java.lang.String |
draw_orientationmarkers
key for flag if orientation markers are drawn |
static java.lang.String |
draw_usercoords
key for flag if user coords are displayed |
static java.lang.String |
epsilon
key for global epsilon |
static java.lang.String |
font_numbering
font used for numbering |
static java.lang.String |
font_numbering_size
size of that font |
static java.lang.String |
font_numbering_style
style |
static java.lang.String |
general_devisorhome
key for the DEVISORHOME path |
static java.lang.String |
general_faqfile
key for the faqfile path+name |
static java.lang.String |
general_featlib
key for the feat path |
static java.lang.String |
general_helpfile
key for the helpfile path+name |
static java.lang.String |
general_path
key for the general path used for load-save-dialogs |
static java.lang.String |
general_trigen
key for the trigen path |
static java.lang.String |
mainframe_height
key for the MainFrame's height |
static java.lang.String |
mainframe_width
key for the MainFrame's width |
static java.lang.String |
mainframe_x
key for the MainFrame's origin (horizontal) |
static java.lang.String |
mainframe_y
key for the MainFrame's origin (vertical) |
static java.lang.String |
metis_command
key for the metis mesher used for partioning |
static java.lang.String |
other_locale_country
key for the country code for the locale used |
static java.lang.String |
other_locale_language
key for the the language code for the locale used |
static java.lang.String |
other_lookandfeel
key for the Look&Feel used |
static java.lang.String |
other_ResourceBundleName
key for the name of the resource bundle backing the locale |
static java.lang.String |
other_undosteps
key for the maximum number of undoable steps |
static java.lang.String |
screenx
key for the width of the main frame |
static java.lang.String |
screeny
key for the height of the main frame |
static java.lang.String |
snap_enabled
key for snap enabling |
static java.lang.String |
snap_x
key for snap value in x direction |
static java.lang.String |
snap_y
key for snap value in y direction |
Constructor Summary | |
Options()
the Constructor just creates a new Options object and initializes the factory default settings |
Method Summary | |
java.lang.String |
get(java.lang.String key)
Returns the String value saved under the given key. |
java.lang.String |
getDefault(java.lang.String key)
returns the default object saved under the given key |
java.lang.String |
getHeader()
returns the current header for config files |
boolean |
isAlreadyAccelerator(java.lang.String accelerator)
This method just checks if the given accelerator is already in use in the application |
java.util.Enumeration |
keys()
returns an enumeration of all the keys in the options file |
void |
load(java.lang.String filename)
loads user settings from a file |
void |
resetToDefaults()
Resets all user-modified options to factory defaults |
void |
save(java.lang.String filename)
saves the user settings to a file |
void |
set(java.lang.String key,
java.lang.String newObject)
sets the value saved under the given key to the new Object |
void |
setHeader(java.lang.String header)
sets the config file header text to a specific user-defined value |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String mainframe_width
public static final java.lang.String mainframe_height
public static final java.lang.String mainframe_x
public static final java.lang.String mainframe_y
public static final java.lang.String metis_command
public static final java.lang.String general_path
public static final java.lang.String screenx
public static final java.lang.String screeny
public static final java.lang.String general_devisorhome
public static final java.lang.String general_helpfile
public static final java.lang.String general_faqfile
public static final java.lang.String general_trigen
public static final java.lang.String general_featlib
public static final java.lang.String other_lookandfeel
public static final java.lang.String other_locale_country
public static final java.lang.String other_locale_language
public static final java.lang.String other_ResourceBundleName
public static final java.lang.String other_undosteps
public static final java.lang.String draw_usercoords
public static final java.lang.String draw_orientationmarkers
public static final java.lang.String draw_drawboundary
public static final java.lang.String draw_numberboundary
public static final java.lang.String draw_drawnode
public static final java.lang.String draw_numbernode
public static final java.lang.String draw_drawedge
public static final java.lang.String draw_numberedge
public static final java.lang.String draw_drawelement
public static final java.lang.String draw_numberelement
public static final java.lang.String draw_crosselement
public static final java.lang.String draw_fillelement
public static final java.lang.String draw_drawgrid
public static final java.lang.String draw_drawperimeter
public static final java.lang.String draw_drawrect
public static final java.lang.String click_tolerance
public static final java.lang.String snap_enabled
public static final java.lang.String snap_x
public static final java.lang.String snap_y
public static final java.lang.String epsilon
public static final java.lang.String color_node
public static final java.lang.String color_edgebase
public static final java.lang.String color_edge
public static final java.lang.String color_element
public static final java.lang.String color_boundarynumber
public static final java.lang.String color_nodenumber
public static final java.lang.String color_edgenumber
public static final java.lang.String color_elementnumber
public static final java.lang.String color_fill0
public static final java.lang.String color_fill1
public static final java.lang.String color_fill2
public static final java.lang.String color_fill3
public static final java.lang.String color_fill4
public static final java.lang.String color_fill5
public static final java.lang.String color_fill6
public static final java.lang.String color_fill7
public static final java.lang.String color_fill8
public static final java.lang.String color_fill9
public static final java.lang.String color_fill10
public static final java.lang.String color_fill11
public static final java.lang.String color_fill12
public static final java.lang.String color_fill13
public static final java.lang.String color_fill14
public static final java.lang.String color_fill15
public static final java.lang.String color_selection
public static final java.lang.String color_rect
public static final java.lang.String color_grid
public static final java.lang.String color_background
public static final java.lang.String color_lasso
public static final java.lang.String color_boundary0
public static final java.lang.String color_boundary1
public static final java.lang.String color_boundary2
public static final java.lang.String color_boundary3
public static final java.lang.String color_boundary4
public static final java.lang.String color_boundary5
public static final java.lang.String color_boundary6
public static final java.lang.String color_boundary7
public static final java.lang.String color_boundary8
public static final java.lang.String color_boundary9
public static final java.lang.String color_boundary10
public static final java.lang.String color_boundary11
public static final java.lang.String color_boundary12
public static final java.lang.String color_boundary13
public static final java.lang.String color_boundary14
public static final java.lang.String color_boundary15
public static final java.lang.String font_numbering
public static final java.lang.String font_numbering_size
public static final java.lang.String font_numbering_style
public static final java.lang.String accelerator_new
public static final java.lang.String accelerator_open
public static final java.lang.String accelerator_save
public static final java.lang.String accelerator_saveas_ucd
public static final java.lang.String accelerator_saveas_feat
public static final java.lang.String accelerator_saveas_feast
public static final java.lang.String accelerator_merge
public static final java.lang.String accelerator_print
public static final java.lang.String accelerator_printls
public static final java.lang.String accelerator_exit
public static final java.lang.String accelerator_undo
public static final java.lang.String accelerator_redo
public static final java.lang.String accelerator_cut
public static final java.lang.String accelerator_copy
public static final java.lang.String accelerator_paste
public static final java.lang.String accelerator_copymode
public static final java.lang.String accelerator_delete
public static final java.lang.String accelerator_deleteworkingboundary
public static final java.lang.String accelerator_scale
public static final java.lang.String accelerator_rotate
public static final java.lang.String accelerator_mirror
public static final java.lang.String accelerator_selectboundary
public static final java.lang.String accelerator_zoom_setzoom
public static final java.lang.String accelerator_zoom_resetzoom
public static final java.lang.String accelerator_zoom_zoomplus
public static final java.lang.String accelerator_zoom_zoomminus
public static final java.lang.String accelerator_selectnodes
public static final java.lang.String accelerator_selectelements
public static final java.lang.String accelerator_selectsegments
public static final java.lang.String accelerator_selectedges
public static final java.lang.String accelerator_viewproperties
public static final java.lang.String accelerator_newboundary
public static final java.lang.String accelerator_directinput
public static final java.lang.String accelerator_newline
public static final java.lang.String accelerator_newmultiline
public static final java.lang.String accelerator_newcirclep
public static final java.lang.String accelerator_newcirclem
public static final java.lang.String accelerator_newanalytic
public static final java.lang.String accelerator_newedge
public static final java.lang.String accelerator_newtri
public static final java.lang.String accelerator_newquad
public static final java.lang.String accelerator_newmacro
public static final java.lang.String accelerator_newnode
public static final java.lang.String accelerator_adjustboundaries
public static final java.lang.String accelerator_linkboundaries
public static final java.lang.String accelerator_fromtri2prm
public static final java.lang.String accelerator_swapboundaryorientation
public static final java.lang.String accelerator_domainperimeter
public static final java.lang.String accelerator_domainstatistics
public static final java.lang.String accelerator_multipleboundarynodes
public static final java.lang.String accelerator_edgestatus
public static final java.lang.String accelerator_parallelblock
public static final java.lang.String accelerator_loadbalancing
public static final java.lang.String accelerator_rectifyelement
public static final java.lang.String accelerator_refine
public static final java.lang.String accelerator_spellchecker
public static final java.lang.String accelerator_mergeboundaries
public static final java.lang.String accelerator_generaloptions
public static final java.lang.String accelerator_drawoptions
public static final java.lang.String accelerator_coloroptions
public static final java.lang.String accelerator_acceleratoroptions
public static final java.lang.String accelerator_miscoptions
public static final java.lang.String accelerator_manual
public static final java.lang.String accelerator_faq
public static final java.lang.String accelerator_readme
public static final java.lang.String accelerator_about
Constructor Detail |
public Options()
Method Detail |
public void save(java.lang.String filename) throws java.io.IOException, java.lang.ClassCastException, java.io.FileNotFoundException
filename
- the filename (full path) where to save to
java.io.IOException
- - if an IOexception occurred during
writing
java.lang.ClassCastException
- - if the keys in the file could
not be casted to Strings
java.io.FileNotFoundException
- - if the file could not be
opened for writingpublic void load(java.lang.String filename) throws java.io.IOException, java.lang.ClassCastException, java.io.FileNotFoundException
filename
- the filename (full path) where to load from
java.io.IOException
- - if an IOexception occurred during
reading
java.lang.ClassCastException
- - if the keys in the file
could not be casted to Strings
java.io.FileNotFoundException
- if the file could not be foundpublic java.util.Enumeration keys()
public void setHeader(java.lang.String header)
header
- - a String containing the new headerpublic java.lang.String getHeader()
public void resetToDefaults()
public java.lang.String get(java.lang.String key)
key
- - one of the constants declared in this class
public java.lang.String getDefault(java.lang.String key)
key
- - the key to the option you want the default for
public void set(java.lang.String key, java.lang.String newObject)
key
- the key for the new valuenewObject
- the new value itselfpublic boolean isAlreadyAccelerator(java.lang.String accelerator)
accelerator
- - a String representation of an accelerator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |