Package ucar.unidata.idv
Class StateManager
java.lang.Object
ucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.StateManager
- All Implemented Interfaces:
ActionListener,EventListener,IdvConstants
This class manages the intialize properties that configure
the IDV and the persistent store for writing preferences, etc.
to the user's local .unidata/idv directory
- Author:
- IDV development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringdisable mixingprotected booleanDo we show the DisplayControl-s in the DataTree-s.protected StringThe name of the userFields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, windowFields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_APPEARANCEMODE, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, PROP_USE_TIMEDRIVER, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApply macrosprotected void_more_protected IdvObjectStoreFactory method to create theIdvObjectStore.static StringChange id from application.Get the build dategetColorProperty(String name, Color dflt) Utility method to retrieve a String property from the idv properties.Get the default help target.Get the default base help url._more_Get the jython versiondoubleGet major-minor as a numbergetPreference(String pref) Helper method that wraps getStore().get (pref)getPreference(String pref, Object dflt) Helper method that wraps getStore().get (pref)Find either the preference with the given name or, if not found, return the property value of the given namebooleangetPreferenceOrProperty(String pref, boolean dflt) Find either the preference with the given name or, if not found, return the property String value of the given name if found.doublegetPreferenceOrProperty(String pref, double dflt) Find either the preference with the given name or, if not found, return the property String value of the given name if found.getPreferenceOrProperty(String pref, String dflt) Find either the preference with the given name or, if not found, return the property String value of the given name if found.protected ListGet the preference pathsGet the hashtable of propertiesgetProperty(String name) Get a propertybooleangetProperty(String name, boolean dflt) Utility method to retrieve a boolean property from the idv properties.doublegetProperty(String name, double dflt) Utility method to retrieve an int property from the idv properties.intgetProperty(String name, int dflt) Utility method to retrieve an int property from the idv properties.getProperty(String name, String dflt) Utility method to retrieve a String property from the idv properties.booleanGet the RunningIsl property.booleanGet the flag for loading bundles synchronouslybooleanHelper method to determine whether to showDisplayControl-s in the data choosing guis.booleanLookup in the object store whether we should popup a DataSelector in a window on start up.getStore()Create theIdvObjectStore, if needed, and return it.What is the store name.Get the name of the top level users directory.getTitle()Return the title propertyReturn the user nameRead in and return the current version from the resources/VERSION file.Get the version aboutGet the major versionGet the minor versionGet the version revisionGet the ViewSize property.protected voidinitNewUserDirectory(File dir) This gets called when we first create the users local object store directory.protected voidinitObjectStore(IdvObjectStore store) Initialize the given object store.protected voidinitState(boolean interactiveMode) Initialize the store, properties andIdvResourceManagerprotected voidinitUserDirectory(File dir) This gets called when after we have created the IdvObjectStore object For now this method just copies the default rbi file into the directory.booleanReturns whether we are currently unpersisting application state from xml.protected voidInitialize the list of property files and load them into the idvProperties.protected static HashtableprocessPropertyTable(Hashtable newTable) Change property keys from application.voidputPreference(String pref, Object value) Helper method that wraps getStore().put (pref value).voidputProperty(String name, boolean value) Converts the given value to a String and sets the property name to the String valuevoidputProperty(String name, String value) Sets the property name to the given valuevoidsetAlwaysLoadBundlesSynchronously(boolean value) Set the flag to load bundles synchronouslyvoidsetRunningIsl(boolean value) Set the RunningIsl property.voidsetViewSize(Dimension value) Set the ViewSize property.voidwritePreference(String pref, Object value) Puts the given value in the object store and writes out the store.voidWrites out the store.Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDoneMethods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
-
Field Details
-
showControlsInTree
protected boolean showControlsInTreeDo we show the DisplayControl-s in the DataTree-s. -
userName
The name of the user -
PREF_SunAwtDisableMixing
disable mixing- See Also:
-
-
Constructor Details
-
StateManager
Create this manager- Parameters:
idv- The IDV
-
-
Method Details
-
setAlwaysLoadBundlesSynchronously
public void setAlwaysLoadBundlesSynchronously(boolean value) Set the flag to load bundles synchronously- Parameters:
value- true to load bundles synchronously
-
getShouldLoadBundlesSynchronously
public boolean getShouldLoadBundlesSynchronously()Get the flag for loading bundles synchronously- Returns:
- true if synchronous
-
processPropertyTable
Change property keys from application. to idv.- Parameters:
newTable- The table to change- Returns:
- The converted table
-
fixIds
Change id from application. to idv.- Parameters:
id- id to change- Returns:
- changed id
-
loadProperties
protected void loadProperties()Initialize the list of property files and load them into the idvProperties. The algorithm is as follows: first process the property files that are hard coded from the system (e.g., /ucar/unidata/idv/resources/idv.propertes, vgee.properties, etc.), then process any command line argument property files (which are added into the propertyFiles list)Now, we look for an "idv.properties" property (which is a semi-colon delimited list of property file paths) in the currently processed property files. If there is one then we create the list of property files, expand any %SITEPATH%, %USERPATH%, etc., macros and process the properties.
Note: Expanding the SITEPATH/USERPATH macros ends up creating the IdvObjectStore (to find the value of SITEPATH/USERPATH/etc.). The tricky thing is that the creation of the object store requires some things that we get from the properties (like the store name). These have to come from the original set of system property files.
-
getHelpRoot
_more_- Returns:
- _more_
-
initState
protected void initState(boolean interactiveMode) Initialize the store, properties andIdvResourceManager- Parameters:
interactiveMode- Is the idv in interactive mode (the default)
-
applyPreferences
protected void applyPreferences()_more_ -
getPreferencePaths
Get the preference paths- Returns:
- the paths for preferences
-
applyMacros
Apply macros- Parameters:
s- string- Returns:
- String with macros expanded
-
getProperties
Get the hashtable of properties- Returns:
- the properties Hashtable
-
getProperty
Get a property- Parameters:
name- name of the property- Returns:
- the property or null
-
getProperty
Utility method to retrieve a boolean property from the idv properties. If the property does not exists return the given default value.- Overrides:
getPropertyin classIdvManager- Parameters:
name- Property namedflt- The default value to return if name is not found- Returns:
- The property value converted into a boolean or dflt if not found
-
getProperty
Utility method to retrieve an int property from the idv properties. If the property does not exists return the given default value.- Overrides:
getPropertyin classIdvManager- Parameters:
name- Property namedflt- The default value to return if name is not found- Returns:
- The property value converted into an int or dflt if not found
-
getProperty
Utility method to retrieve an int property from the idv properties. If the property does not exists return the given default value.- Parameters:
name- Property namedflt- The default value to return if name is not found- Returns:
- The property value converted into an int or dflt if not found
-
getProperty
Utility method to retrieve a String property from the idv properties. If the property does not exists return the given default value.- Overrides:
getPropertyin classIdvManager- Parameters:
name- Property namedflt- The default value to return if name is not found- Returns:
- The property value or dflt if not found
-
getColorProperty
Utility method to retrieve a String property from the idv properties. If the property does not exists return the given default value.- Parameters:
name- Property namedflt- The default value to return if name is not found- Returns:
- The property value or dflt if not found
-
putProperty
Sets the property name to the given value- Parameters:
name- Property namevalue- The value
-
putProperty
Converts the given value to a String and sets the property name to the String value- Parameters:
name- Property namevalue- The value
-
getStore
Create theIdvObjectStore, if needed, and return it.- Overrides:
getStorein classIdvManager- Returns:
- The object store
-
getDefaultHelpUrl
Get the default base help url. This looks up the idv.help.defaulturl property. If its not there then it returns DEFAULT_DOCPATH- Returns:
- The base help url
-
getDefaultHelpTarget
Get the default help target. This just returns an empty string but could be overrode by a derived class.- Returns:
- The default help target
-
isLoadingXml
public boolean isLoadingXml()Returns whether we are currently unpersisting application state from xml.- Returns:
- Is the IDV currently loading an xml bundle
-
getShowControlsInTree
public boolean getShowControlsInTree()Helper method to determine whether to showDisplayControl-s in the data choosing guis.- Returns:
- Should we show data choices in the gui
-
getUserName
Return the user name- Returns:
- The user name
-
getTitle
Return the title property- Returns:
- The title from the properties ("idv.title")
-
doMakeObjectStore
Factory method to create theIdvObjectStore. This will also callinitObjectStore(IdvObjectStore)- Returns:
- A new object store.
-
initObjectStore
Initialize the given object store. This mostly initializes the user's local .unidata/idv directory when it is first created.- Parameters:
store- The object store to initialize
-
getStoreName
What is the store name. This is either the value of the idv.store.name property or the tail class name of the IDV class (e.g., DefaultIdv).- Returns:
- The name of the store. This ends up being the name of the subdirectory of the ~/.unidata/idv base directory.
-
getStoreSystemName
Get the name of the top level users directory. It is either the value of the idv.store.system property or "unidata/idv"- Returns:
- The system name
-
initNewUserDirectory
This gets called when we first create the users local object store directory.- Parameters:
dir- The new directory
-
initUserDirectory
This gets called when after we have created the IdvObjectStore object For now this method just copies the default rbi file into the directory. This makes it easier for a user to do further rbi based configurations.- Parameters:
dir- The store directory
-
writePreference
Puts the given value in the object store and writes out the store.- Parameters:
pref- The namevalue- The value
-
writePreferences
public void writePreferences()Writes out the store. -
putPreference
Helper method that wraps getStore().put (pref value). This does not write out the store.- Parameters:
pref- The namevalue- The value
-
getPreference
Helper method that wraps getStore().get (pref)- Parameters:
pref- The name of the preference- Returns:
- The value of the preference
-
getPreference
Helper method that wraps getStore().get (pref)- Parameters:
pref- The name of the preferencedflt- The default value to use if pref is not found.- Returns:
- The value of the preference of the dflt if not found
-
getPreferenceOrProperty
Find either the preference with the given name or, if not found, return the property value of the given name- Parameters:
pref- The preference or property name- Returns:
- The value of either the preference or the property
-
getPreferenceOrProperty
Find either the preference with the given name or, if not found, return the property String value of the given name if found. If not found return the dflt- Parameters:
pref- The preference or property namedflt- default- Returns:
- The value of either the preference or the property
-
getPreferenceOrProperty
Find either the preference with the given name or, if not found, return the property String value of the given name if found. If not found return the dflt- Parameters:
pref- The preference or property namedflt- default- Returns:
- The value of either the preference or the property
-
getPreferenceOrProperty
Find either the preference with the given name or, if not found, return the property String value of the given name if found. If not found return the dflt- Parameters:
pref- The preference or property namedflt- default- Returns:
- The value of either the preference or the property
-
getShowDashboardOnStart
public boolean getShowDashboardOnStart()Lookup in the object store whether we should popup a DataSelector in a window on start up.- Returns:
- Should we show the data selector on start up
-
getJythonVersion
Get the jython version- Returns:
- The jython version
-
getVersionMajor
Get the major version- Returns:
- The major version
-
getVersionMinor
Get the minor version- Returns:
- The minor version
-
getVersionRevision
Get the version revision- Returns:
- The version revision
-
getVersionAbout
Get the version about- Returns:
- The version about
-
getVersion
Read in and return the current version from the resources/VERSION file.- Returns:
- The IDV version
-
getBuildDate
Get the build date- Returns:
- build date
-
getNumberVersion
public double getNumberVersion()Get major-minor as a number- Returns:
- number version
-
setViewSize
Set the ViewSize property.- Parameters:
value- The new value for ViewSize
-
getViewSize
Get the ViewSize property.- Returns:
- The ViewSize
-
setRunningIsl
public void setRunningIsl(boolean value) Set the RunningIsl property.- Parameters:
value- The new value for RunningIsl
-
getRunningIsl
public boolean getRunningIsl()Get the RunningIsl property.- Returns:
- The RunningIsl
-