Package edu.wisc.ssec.mcidasv
Class StateManager
java.lang.Object
ucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.StateManager
edu.wisc.ssec.mcidasv.StateManager
- All Implemented Interfaces:
Constants
,ActionListener
,EventListener
,HyperlinkListener
,IdvConstants
This class is used to initialize McIDAS-V.
The initialization process includes creating an "object store" (for preferences), user-modifiable settings, and so on.
McIDAS-V uses this class to perform pretty much all version-check operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Logger
Logging object.private String
Lazily-loadedncIdv.jar
build timestamp.private String
Lazily-loadedncIdv.jar
version.static final String
Error message shown when given userpath cannot be used.static final String
Message shown when asking the user to select a userpath.private String
Lazily-loadedmcidasv.jar
version.private String
Lazily-loaded VisAD build date.private String
Lazily-loaded VisAD revision number.Fields inherited from class ucar.unidata.idv.StateManager
PREF_SunAwtDisableMixing, showControlsInTree, userName
Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, window
Fields inherited from interface edu.wisc.ssec.mcidasv.Constants
BLANK_COMP_GROUP, COMP_MONITORPANEL, DATASELECTOR_NAME, DEFAULT_COLOR_PICKER_SIZE, DEFAULT_DOCPATH, DEFAULT_MAP_Z_LEVEL, DEFAULT_SERVERSTATE, DISPLAY_NAME, DISPLAYCONTROLLER_NAME, ELEMENT_DOUBLE_WIDTH, ELEMENT_DOUBLEDOUBLE_WIDTH, ELEMENT_HALF_WIDTH, ELEMENT_ONEHALF_WIDTH, ELEMENT_WIDTH, EVENT_FILECHOOSER_START, EVENT_FILECHOOSER_STOP, FILTER_MCV, FILTER_MCVMCVZ, FILTER_MCVZ, GAP_RELATED, GAP_UNRELATED, HOMEPAGE_URL, ICON_ACCEPT_SMALL, ICON_ADD_SMALL, ICON_APPLY_SMALL, ICON_BACKGROUND_SMALL, ICON_CANCEL, ICON_CANCEL_SMALL, ICON_CHECKVERSION_SMALL, ICON_COLORTABLE_SMALL, ICON_CONNECT_SMALL, ICON_CONSOLE_SMALL, ICON_DATAEXPLORER_SMALL, ICON_DEFAULTLAYOUT_SMALL, ICON_DEFAULTLAYOUTADD_SMALL, ICON_DEFAULTLAYOUTDELETE_SMALL, ICON_DELETE_SMALL, ICON_DISCONNECT_SMALL, ICON_ERROR_SMALL, ICON_EXCLAMATION_SMALL, ICON_FAVORITE_SMALL, ICON_FAVORITEMANAGE_SMALL, ICON_FAVORITESAVE_SMALL, ICON_FORUMS_SMALL, ICON_GETTINGSTARTED_SMALL, ICON_HELP, ICON_HELP_SMALL, ICON_HELPTIPS_SMALL, ICON_INFORMATION_SMALL, ICON_LAYOUTEDIT_SMALL, ICON_LOCALDATA_SMALL, ICON_LOCATION_SMALL, ICON_MCIDASV_DEFAULT, ICON_MCIDASV_SMALL, ICON_NEWTAB_SMALL, ICON_NEWWINDOW_SMALL, ICON_NEXT_SMALL, ICON_NOTE_SMALL, ICON_OPEN, ICON_OPEN_SMALL, ICON_PREFERENCES_SMALL, ICON_PREVIOUS_SMALL, ICON_RANDOM_SMALL, ICON_RANGEANDBEARING_SMALL, ICON_REDO_SMALL, ICON_REFRESH, ICON_REFRESH_SMALL, ICON_REMOVE_SMALL, ICON_REMOVEDATA_SMALL, ICON_REMOVELAYERS_SMALL, ICON_REMOVELAYERSDATA_SMALL, ICON_SAVE, ICON_SAVE_SMALL, ICON_SAVEAS_SMALL, ICON_SUPPORT_SMALL, ICON_UNDO_SMALL, ICON_UPDATE, ICON_USERSGUIDE_SMALL, lineStyles, LOCAL_ADDE_PORT, MACRO_BUILDDATE, MACRO_COPYRIGHT_YEAR, MACRO_GRANULE_COUNT, MACRO_IDV_VERSION, MACRO_VERSION, MACRO_VISAD_VERSION, MAX_MEMORY_32BIT, MCV_BLUE, MCV_BLUE_DARK, NOTICE_URL, OS_OSX, PANEL_NAME, PREF_AUTO_SAVE_DEFAULT_LAYOUT, PREF_CONFIRM_REMOVE_BOTH, PREF_CONFIRM_REMOVE_DATA, PREF_CONFIRM_REMOVE_LAYERS, PREF_IMAGE_PREVIEW, PREF_LIST_ADDE_SERVERS, PREF_LIST_ADVANCED, PREF_LIST_AVAILABLE_DISPLAYS, PREF_LIST_DATA_CHOOSERS, PREF_LIST_FORMATS_DATA, PREF_LIST_GENERAL, PREF_LIST_LOCAL_ADDE, PREF_LIST_NAV_CONTROLS, PREF_LIST_TOOLBAR, PREF_LIST_VIEW, PREF_MODIFY_DEFAULT_COLOR_TABLE, PREF_NUM_IMAGE_PRESET_IMGCHOOSER, PREF_NUM_IMAGE_PRESET_RADARCHOOSER, PREF_OPEN_LIMIT_WIN, PREF_PRERELEASE_CHECK, PREF_SAVE_DASHBOARD_VIZ, PREF_SERVERSTATE, PREF_SHOW_SYSTEM_BUNDLES, PREF_SYSTEMSERVERSIMG, PREF_TBM_SIZE, PREF_VERSION_CHECK, PRERELEASE_URL, PROP_ABOUTTEXT, PROP_APP_ICON, PROP_BUILD_DATE, PROP_CHAN, PROP_COPYRIGHT_YEAR, PROP_DASHBOARD_BOUNDS, PROP_GRANULE_COUNT, PROP_HOMEPAGE, PROP_HYDRA_360, PROP_RECENT_COLORS, PROP_SERVERS, PROP_SERVERS_ALL, PROP_SYSMEM, PROP_TABBED_UI, PROP_VERSION_MAJOR, PROP_VERSION_MINOR, PROP_VERSION_RELEASE, PROP_VERSIONFILE, PROP_VISAD_DATE, PROP_VISAD_ORIGINAL, PROP_VISAD_PARSE_FAIL, PROP_VISAD_REVISION, PROP_VP_CATOPEN, PROP_VP_SHOWCATS, PROP_VP_SHOWPOPUP, PROPERTIES_FILE, SCRUB_STRINGS_FILE, SUFFIX_MCV, SUFFIX_MCVZ, TOOLTIP_PROGRESSIVE_RESOLUTION, USER_DIRECTORY_NAME, VERSION_HANDLER_URL, VERSION_URL
Fields 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 TypeMethodDescriptionvoid
checkForNewerVersion
(boolean notifyDialog) void
checkForNewerVersionPrerelease
(boolean notifyDialog) void
checkForNewerVersionStable
(boolean notifyDialog) void
checkForNotice
(boolean notifyDialog) void
Handle a click on a link.static int
compareVersions
(String thisVersion, String thatVersion) Compare version strings.void
debugNotice
(String noticeContents, boolean notifyDialog, boolean disableCache) Debug a McIDAS-V "system notice" before sending it to all users!protected IdvObjectStore
Override to set the right user directory.boolean
Returns the current Jython version.Connect to McIDAS-V website and look for latest pre-release version.Connect to McIDAS-V website and look for latest stable version.Return the timestamp from whenncIdv.jar
was created.Return the version information withinncIdv.jar
.private String
Connect to McIDAS website and look for latest notice.private String
Get the name of the current operating system (via "os.name" system property).getProperty
(String name) Get a property.Find the value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.boolean
getPropertyOrPreference
(String name, boolean dflt) Find theBoolean
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.double
getPropertyOrPreference
(String name, double dflt) Find theDouble
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.int
getPropertyOrPreference
(String name, int dflt) Find theInteger
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.getPropertyOrPreference
(String name, String dflt) Find theString
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.Overridden to get dir of the unnecessary second level directory.Overridden to set default of McIDAS-VReturns information about the current version of McIDAS-V and the IDV, along with their respective build dates.Return the timestamp from when visad.jar was created.Return the "version" of VisAD.void
Handle a change to a link.protected void
initObjectStore
(IdvObjectStore store) Initialize the given object store.protected void
initState
(boolean interactiveMode) Initialize the store, properties andIdvResourceManager
protected void
initUserDirectory
(File directory) Initialize the McIDAS-V user directory (if it is not already initalized).private void
Removes disabledControlDescriptors
fromIntegratedDataViewer's
controlDescriptors
andcontrolDescriptorMap
fields.private void
setNoticeCached
(String notice) static int
versionToInteger
(String version) Turn version strings of the form#.#(a#)
, where # is one or two digits, a is one of alpha or beta, and () is optional, into an integer value...Methods inherited from class ucar.unidata.idv.StateManager
applyMacros, applyPreferences, fixIds, getBuildDate, getColorProperty, getDefaultHelpTarget, getDefaultHelpUrl, getHelpRoot, getNumberVersion, getPreference, getPreference, getPreferenceOrProperty, getPreferenceOrProperty, getPreferenceOrProperty, getPreferenceOrProperty, getPreferencePaths, getProperties, getProperty, getProperty, getProperty, getProperty, getRunningIsl, getShouldLoadBundlesSynchronously, getShowControlsInTree, getShowDashboardOnStart, getStore, getTitle, getUserName, getVersion, getVersionAbout, getVersionMajor, getVersionMinor, getVersionRevision, getViewSize, initNewUserDirectory, isLoadingXml, loadProperties, processPropertyTable, putPreference, putProperty, putProperty, setAlwaysLoadBundlesSynchronously, setRunningIsl, setViewSize, writePreference, writePreferences
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, waitUntilDisplaysAreDone
Methods 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
-
logger
Logging object. -
USERPATH_IS_BAD_MESSAGE
Error message shown when given userpath cannot be used.- See Also:
-
USERPATH_PICK
Message shown when asking the user to select a userpath.- See Also:
-
visadDate
Lazily-loaded VisAD build date. Value may benull
.- See Also:
-
visadVersion
Lazily-loaded VisAD revision number. Value may benull
.- See Also:
-
netcdfDate
Lazily-loadedncIdv.jar
build timestamp. Value may benull
.- See Also:
-
netcdfVersion
Lazily-loadedncIdv.jar
version. Value may benull
.- See Also:
-
version
Lazily-loadedmcidasv.jar
version. Value may benull
.- See Also:
-
-
Constructor Details
-
StateManager
-
-
Method Details
-
doMakeObjectStore
Override to set the right user directory.- Overrides:
doMakeObjectStore
in classStateManager
- Returns:
- Newly created object store.
-
initObjectStore
Initialize the given object store. This mostly initializes the user's "userpath" directory when it is first created.- Overrides:
initObjectStore
in classStateManager
- Parameters:
store
- Object store to initialize. Cannot benull
.
-
initUserDirectory
Initialize the McIDAS-V user directory (if it is not already initalized).Here, initialization means "the user directory exists, and contains a barebones version of mcidasv.rbi".
- Overrides:
initUserDirectory
in classStateManager
- Parameters:
directory
- McIDAS-V user directory. Cannot benull
.
-
initState
Description copied from class:ucar.unidata.idv.StateManager
Initialize the store, properties andIdvResourceManager
- Overrides:
initState
in classStateManager
- Parameters:
interactiveMode
- Is the idv in interactive mode (the default)
-
removeDisabledControlDescriptors
Removes disabledControlDescriptors
fromIntegratedDataViewer's
controlDescriptors
andcontrolDescriptorMap
fields. -
hyperlinkUpdate
Handle a change to a link.- Specified by:
hyperlinkUpdate
in interfaceHyperlinkListener
- Parameters:
e
- Link event. Cannot benull
.
-
click
Handle a click on a link.- Parameters:
url
- Link to visit.
-
getOSName
Get the name of the current operating system (via "os.name" system property).Note: all space characters will be replaced with underscores.
- Returns:
- Operating system name.
-
getMcIdasVersionAbout
-
getMcIdasVersion
-
getJythonVersion
Returns the current Jython version.- Overrides:
getJythonVersion
in classStateManager
- Returns:
- Jython's version information.
-
getProperty
Get a property.- Overrides:
getProperty
in classStateManager
- Parameters:
name
- Name of the property. Cannot benull
.- Returns:
- Value associated with
name
ornull
.
-
getPropertyOrPreference
Find the value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.- Parameters:
name
- Property or preference ID. Cannot benull
.- Returns:
- Either the value associated with
name
ornull
.
-
getPropertyOrPreference
Find theString
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.- Parameters:
name
- Property or preference ID. Cannot benull
.dflt
- Value to return if there is no property or preference associated withname
- Returns:
- Either the value associated with
name
ordflt
.
-
getPropertyOrPreference
Find theInteger
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.- Parameters:
name
- Property or preference ID. Cannot benull
.dflt
- Value to return if there is no property or preference associated withname
- Returns:
- Either the value associated with
name
ordflt
.
-
getPropertyOrPreference
Find theDouble
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.- Parameters:
name
- Property or preference ID. Cannot benull
.dflt
- Value to return if there is no property or preference associated withname
- Returns:
- Either the value associated with
name
ordflt
.
-
getPropertyOrPreference
Find theBoolean
value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.- Parameters:
name
- Property or preference ID. Cannot benull
.dflt
- Value to return if there is no property or preference associated withname
- Returns:
- Either the value associated with
name
ordflt
.
-
getVersionInfo
Returns information about the current version of McIDAS-V and the IDV, along with their respective build dates.- Returns:
Hashtable
containing versioning information.
-
getNetcdfDate
Return the timestamp from whenncIdv.jar
was created.- Returns:
String
representation of the creation timestamp.
-
getNetcdfVersion
Return the version information withinncIdv.jar
.- Returns:
- Version of
ncIdv.jar
shipped by McIDAS-V.
-
getVisadDate
Return the timestamp from when visad.jar was created.- Returns:
String
representation of the creation timestamp. Likely to change formatting over time.
-
getVisadVersion
Return the "version" of VisAD.- Returns:
- Currently returns whatever the SVN revision number was when visad.jar was built.
-
getIdvVersion
-
getStoreSystemName
Overridden to set default of McIDAS-V- Overrides:
getStoreSystemName
in classStateManager
- Returns:
- The system name
-
getStoreName
Overridden to get dir of the unnecessary second level directory.- Overrides:
getStoreName
in classStateManager
- Returns:
- The name of the store. This ends up being the name of the subdirectory of the ~/.unidata/idv base directory.
-
getMcIdasVersionStable
Connect to McIDAS-V website and look for latest stable version.- Returns:
- Latest stable version.
-
getMcIdasVersionPrerelease
Connect to McIDAS-V website and look for latest pre-release version.- Returns:
- Latest pre-release version.
-
getNoticeLatest
Connect to McIDAS website and look for latest notice.- Returns:
- Contents of notice. String may be empty.
-
compareVersions
Compare version strings.The logic is as follows.
0: thisVersion and thatVersion are equal. <0: thisVersion is greater. >0: thatVersion is greater.
- Parameters:
thisVersion
- First version string to compare.thatVersion
- Second version string to compare.- Returns:
- Value indicating which of
thisVersion
andthatVersion
is "greater".
-
versionToInteger
Turn version strings of the form#.#(a#)
, where # is one or two digits, a is one of alpha or beta, and () is optional, into an integer value... (empty) > beta > alpha.- Parameters:
version
- String representation of version number.- Returns:
- Integer representation of
version
.
-
getIsPrerelease
-
checkForNewerVersion
-
checkForNewerVersionStable
-
checkForNewerVersionPrerelease
-
checkForNotice
-
debugNotice
Debug a McIDAS-V "system notice" before sending it to all users!- Parameters:
noticeContents
- Contents of the notice.notifyDialog
- iftrue
, show notice even if already seen.disableCache
- Whether or notnoticeContents
will be cached.
-
getNoticePath
-
getNoticeCached
-
setNoticeCached
-