Class McIDASV
- All Implemented Interfaces:
ActionListener
,EventListener
,HyperlinkListener
,DataContext
,ControlContext
,IdvConstants
,IdvContext
,ViewContext
,LogUtil.DialogManager
,XmlPersistable
This is where the startup and shutdown processes are handled, as well as the initialization of the application's various "managers".
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Responsible for handling "idvresource" URLs.private static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionActions passed intohandleAction(String, Hashtable, boolean)
.private EntryStore
Reference to the ADDE server manager.protected McIdasChooserManager
Chooser managerprivate static boolean
Whether or not the previous session was able to exit as it should.private static long
Initialization duration.private static final org.slf4j.Logger
Logging object.private McIDASVMonitor
HTTP based monitor to dump stack traces and shutdown McIDAS-V.private final MonitorManager
MonitorManager
allows for relatively easy and efficient monitoring of various resources.private JCheckBox
Accessory in file save dialogprivate static Date
Date the previous session was started.static final IdvResourceManager.XmlIdvResource
Points to the adde image defaults.static final IdvResourceManager.XmlIdvResource
Points to the server definitions.private static String
Path to a "session" file--it's created upon McIDAS-V starting and removed when McIDAS-V exits cleanly.private static long
Initialization start time.private static McIDASV
Used to access McIDAS-V state in a static context.private TabbedAddeManager
GUI wrapper for ADDE server management.static boolean
Set to true only if "-forceaqua" was found in the command line.private final DirectoryWatchService
Directory monitoring service.Fields inherited from class ucar.unidata.idv.IntegratedDataViewer
controlDescriptorMap, controlDescriptors, displayControls
Fields inherited from class ucar.unidata.idv.IdvBase
aliasEditor, args, argsManager, autoDisplayEditor, collabManager, colorTableEditor, colorTableManager, dataManager, displayConventions, idv, imageGenerator, installManager, jythonManager, paramDefaultsEditor, paramGroupsEditor, persistenceManager, pluginManager, preferenceManager, projectionManager, publishManager, resourceManager, resourceViewer, stateManager, stationModelManager, testManager, uiManager, vmManager
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 TypeMethodDescriptionprotected void
void
addErrorButtons
(JDialog dialog, List buttonList, String msg, Throwable exc) Overridden so that the support form becomes non-modal if launched from an exception dialog.private static void
Useful for providing the startup manager with values other than the defaults...boolean
autoQuit()
This method is largely a copy ofIntegratedDataViewer.quit()
, but allows for some GUI testing.private static void
createSessionFile
(String path) Attempts to create a "session" file.private void
Determine if the last "exit" was clean--whether or notSESSION_FILE
was removed before the McIDAS-V process terminated.void
Called from the menu command to clear the default bundle.protected ArgsManager
doMakeArgsManager
(String[] args) Creates a McIDAS-V argument manager so that McV can handle some non-IDV command line things.protected CollabManager
Factory method to create a McIDAS-VCollaborationManager
.protected ColorTableManager
Make theMcIdasColorTableManager
.protected DataManager
Factory method to create theMcvDataManager
.protected IdvChooserManager
Factory method to create a McIDAS-VMcIdasChooserManager
.protected IdvUIManager
Factory method to create theIdvUIManager
.protected JythonManager
Factory method to create the McIDAS-V @link JythonManager}.protected IdvPersistenceManager
McIDAS-V (alpha 10+) needs to handle both IDV bundles without component groups and all bundles from prior McV alphas.protected PluginManager
Factory method to create theMcvPluginManager
.protected IdvPreferenceManager
Make theMcIdasPreferenceManager
.protected IdvResourceManager
Make the McIDAS-VResourceManager
.protected StateManager
Make the McIDAS-VStateManager
.protected VMManager
Create our own VMManager so that we can make the tabs play nice.void
private void
doOpenInThread
(String filename, boolean checkUserPreference, boolean andRemove) Have the user select a bundle.void
MakesPersistenceManager
save off a default "layout" bundle.static void
Log (TRACE level) the time spent in various discrete parts of McIDAS-V's startup process.protected void
exit
(int exitCode) Attempts a clean shutdown of McIDAS-V.void
exitMcIDASV
(int exitCode) Exposesexit(int)
to other classes.private static Date
extractDate
(String path) Attempts to extract a timestamp frompath
.Returns all of the actions used in this McIDAS-V session.ConvertsArgsManager.getOriginalArgs()
to aList
and returns.getControlDescriptors
(boolean includeTemplates) This returns the set ofControlDescriptors
that can be shown.getIdv()
Get McIDASV.static String
If McIDAS-V is running on Windows, this method will return aString
that looks like "C:" or "D:", etc.int
Get the maximum number of threads to be used when reading data.int
Get the maximum number of threads to be used when rendering in VisAD.Create, if needed, and return theMcIdasChooserManager
.Returns theMonitorManager
.Creates a new server manager (if needed) and returns it.static String
Returns the (current) path to the session file.long
Returns the time it took for McIDAS-V to start up.static McIDASV
Returns a reference to the current McIDAS-V object.Return the current "userpath".getUserFile
(String filename) Return the path to a file within "userpath".getViewManager
(ViewDescriptor viewDescriptor, boolean newWindow, String properties) Overridden so that McIDAS-V doesn't have to create an entire newIdvWindow
ifVMManager.findViewManager(ViewDescriptor)
can't find an appropriate ViewManager forviewDescriptor
.Returns McIDAS-V'sDirectoryWatchService
.private static boolean
hadCleanExit
(String path) Tries to determine whether or not the last McIDAS-V session ended "cleanly".boolean
handleAction
(String action, Hashtable properties, boolean checkForAlias) Captures the action passed tohandleAction
.protected boolean
handleFileOrUrlAction
(String action, Hashtable properties) This method checks if the given action is one of the following.private static void
handleWelcomeWindow
(String... args) Show the McIDAS-V "Welcome Window" for the first start up.boolean
Determines whether or not a default layout exists.void
initDone()
Called after the IDV has finished setting everything up after starting.protected void
initEncoder
(XmlEncoder encoder, boolean forRead) Initializes a XML encoder with McIDAS-V specific XML delegates.void
initPropertyFiles
(List files) Load the McV properties.static boolean
Check the value of themcidasv.darkmode
system property.static boolean
isLoopback
(String host) Attempts to determine if a given string is a "loopback address" (aka localhost).static boolean
isMac()
Are we on a Mac?static boolean
Queries theos.name
system property and if the result does not start with "Windows", the platform is assumed to be "unix-like".static boolean
Queries theos.name
system property and if the result starts with "Windows", the platform is assumed to be Windows.void
void
boolean
static void
Configure the logging and create the McIDAS-V object responsible for initializing the application session.makeHelpButton
(String helpId, String toolTip) Make a help button for a particular help topicvoid
Responds to events generated by the server manager's GUI.private void
This method is useful for storing commandline "properties" with the user's preferences.void
Generic registration with the macOS application menu.private static void
Register "adde" and "idvresource" URL protocols.boolean
removeAllData
(boolean showWarning) Handles removing all loaded data sources.void
Overridden so that McIDAS-V can prompt the user before removing, if necessary.void
Overridden so that McIDAS-V can prompt the user before removing, if necessary.boolean
removeAllLayers
(boolean showWarning) Handles removing all loaded layers ("displays" in IDV-land).void
Handles removing all loaded layers ("displays" in IDV-land) and data sources.private static void
removeSessionFile
(String path) Attempts to remove the file accessible viapath
.void
void
void
void
runPluginMainMethod
(String className) Invokes the main method for a given class.void
void
void
Show the new HYDRA DataBrowser GUI.void
Creates (if needed) the server manager GUI and displays it.private Set
<McIDASV.WarningResult> showWarningDialog
(String title, String message, String prefId, String prefLabel, String okLabel, String cancelLabel) Helper method for showing the removal warning dialog.protected void
Start up the McIDAS-V monitor server.void
Enable directory monitoring.void
Disable directory monitoring.void
watchDirectory
(String path, String glob, OnFileChangeListener listener) Register the givenlistener
so that changes to files matchingglob
inpath
can be handled.Methods inherited from class ucar.unidata.idv.IntegratedDataViewer
actionPerformed, addDisplayControl, addToHistoryList, addToHistoryList, applyPreferences, checkSystem, cleanup, clearCachedData, clearHistoryList, clearWaitCursor, closeCurrentWindow, controlHasBeenInitialized, createDataSelector, createDataSource, createDisplay, createDisplay, createImage, createNewWindow, dataSourceChanged, decodeObject, doImport, doMakeBackgroundImage, doMakeControl, doMakeControl, doMakeControl, doMakeControl, doMakeControl, doMakeControl, doMakeControl, doMakeControl, doMakeControl, doMakeControl, doMakeDataChoiceMenu, doOpen, doOpen, doOpenDefault, doSave, doSaveAs, doSaveAsDefault, encodeObject, encodeObject, evaluateAndSave, flushDataCache, getAllControlDescriptors, getAllDataSources, getAllDisplaysIntialized, getBackgroundImages, getChangeDataPathCbx, getChangeDataPaths, getControlDescriptor, getControlDescriptors, getDataSources, getDerivedDataChoices, getDisplayControls, getEncoder, getEncoder, getEncoderForRead, getEncoderForWrite, getHaveInitialized, getHistory, getInteractiveMode, getLocationList, getProjections, getServerMode, getStaticImage, getUseTimeDriver, getViewManager, getViewManager, getViewManagerProperties, handleAction, handleAction, hyperlinkUpdate, hyperlinkUpdate, init, initCacheManager, initInner, initPreferences, listApi, loadDataFiles, loadDataSource, loadRbiFile, logException, makeDataSource, makeDataSource, makeDataSource, makeDataSource, makeDataSourceFromXml, makeHelpButton, makeOneDataSource, moveHistoryToFront, okToShowWindows, printCache, printCacheStats, printDataCacheStats, processScript, quit, registerHelpKey, reloadAllDataSources, removeAllDisplays, removeDataSource, removeDisplayControl, runImageServer, saveInCache, saveInCache, saveInCache, saveInCache, selectDataChoice, selectDataChoices, selectDataType, selectDataType, selectUserChoices, showConsole, showNormalCursor, showWaitCursor, showWindow, toFront, waitLabelClicked, waitUntilDisplaysAreDone, writeHistoryList
Methods inherited from class ucar.unidata.idv.IdvBase
addPluginClass, createElement, doMakeAliasEditor, doMakeAutoDisplayEditor, doMakeColorTableEditor, doMakeDisplayConventions, doMakeIdvProjectionManager, doMakeImageGenerator, doMakeInstallManager, doMakeParamDefaultsEditor, doMakeParamGroupsEditor, doMakePublishManager, doMakeResourceViewer, doMakeStationModelManager, doMakeTestManager, getAliasEditor, getArgsManager, getAutoDisplayEditor, getCollabManager, getColorProperty, getColorTableEditor, getColorTableManager, getDataManager, getDisplayConventions, getIdvChooserManager, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getObjectStore, getParamDefaultsEditor, getParamGroupsEditor, getPersistenceManager, getPluginManager, getPreference, getPreference, getPreferenceManager, getProperty, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getResourceViewer, getStateManager, getStationModelManager, getStore, getTestManager, getVMManager, haveCollabManager, initFromXml, makeManager, showAliasEditor, showAutoDisplayEditor, showChooser, showChooserModal, showColorTableEditor, showColorTableEditor, showDefaultsEditor, showIdvProjectionManager, showParamGroupsEditor, showPreferenceManager, showResourceViewer, showStationModelEditor
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ucar.unidata.idv.ControlContext
getColorTableManager, getDisplayConventions, getObjectStore, getPersistenceManager, getPreferenceManager, getResourceManager, getStationModelManager
Methods inherited from interface ucar.unidata.data.DataContext
getJythonManager, getPreference
Methods inherited from interface ucar.unidata.idv.IdvContext
getColorProperty, getProperty, getProperty
-
Field Details
-
logger
Logging object. -
startTime
Initialization start time. This value is set at the beginning ofmain(String[])
, and is used to estimate the duration of the session's initialization phase. -
estimate
Initialization duration. Set at the end ofinitDone()
. -
SESSION_FILE
Path to a "session" file--it's created upon McIDAS-V starting and removed when McIDAS-V exits cleanly. This allows us to perform a primitive check to see if the current session has happened after a crash. -
cleanExit
Whether or not the previous session was able to exit as it should. Iffalse
, the previous session likely crashed. -
previousStart
Date the previous session was started. May benull
. -
useAquaLookAndFeel
Set to true only if "-forceaqua" was found in the command line. -
RSC_FRAMEDEFAULTS
Points to the adde image defaults. -
RSC_SERVERS
Points to the server definitions. -
staticMcv
Used to access McIDAS-V state in a static context. -
overwriteDataCbx
Accessory in file save dialog -
chooserManager
Chooser manager -
mcvMonitor
HTTP based monitor to dump stack traces and shutdown McIDAS-V. -
monitorManager
MonitorManager
allows for relatively easy and efficient monitoring of various resources. -
actions
Actions passed intohandleAction(String, Hashtable, boolean)
. -
addeEntries
Reference to the ADDE server manager. -
tabbedAddeManager
GUI wrapper for ADDE server management. Reference is kept due to some of the trickery used byAddePreferences
.Value may be
null
. -
watchService
Directory monitoring service.
-
-
Constructor Details
-
McIDASV
Create the McIDASV with the given command line arguments. This constructor callsIntegratedDataViewer.init()
- Parameters:
args
- Command line arguments
-
-
Method Details
-
registerForMacOSXEvents
Generic registration with the macOS application menu.Checks the platform, then attempts to register with Apple's "EAWT" stuff.
See
OSXAdapter.java
to learn how this is done without directly referencing any Apple APIs. -
MacOSXQuit
-
MacOSXAbout
-
MacOSXPreferences
-
getMaxRenderThreadCount
Get the maximum number of threads to be used when rendering in VisAD.- Overrides:
getMaxRenderThreadCount
in classIntegratedDataViewer
- Returns:
- Number of threads for rendering. Default value is the same as
Runtime.availableProcessors()
.
-
getMaxDataThreadCount
Get the maximum number of threads to be used when reading data.- Overrides:
getMaxDataThreadCount
in classIntegratedDataViewer
- Returns:
- Number of threads for reading data. Default value is
4
.
-
startMonitor
Start up the McIDAS-V monitor server.This is an HTTP server on the port defined by the property
idv.monitorport
. Default value is 8788.It is only accessible to 127.0.0.1 (localhost).
- Overrides:
startMonitor
in classIntegratedDataViewer
-
initEncoder
Initializes a XML encoder with McIDAS-V specific XML delegates.- Overrides:
initEncoder
in classIntegratedDataViewer
- Parameters:
encoder
- XML encoder that'll be dealing with persistence.forRead
- Not used as yet.
-
getActionHistory
Returns all of the actions used in this McIDAS-V session. This is possibly TMI and might be removed...- Returns:
- Actions executed thus far.
-
getCommandLineArgs
ConvertsArgsManager.getOriginalArgs()
to aList
and returns.- Returns:
- The command-line arguments used to start McIDAS-V, as an
ArrayList
.
-
handleAction
Captures the action passed tohandleAction
. The action is logged and additionally, if the action is a HTML link, we attempt to visit the link in the user's preferred browser.- Overrides:
handleAction
in classIntegratedDataViewer
-
handleFileOrUrlAction
This method checks if the given action is one of the following.- Jython code: starts with "jython:".
- Help link: starts with "help:".
- Resource bundle file: ends with ".rbi".
- Bundle file: ends with ".xidv".
- JNLP file: ends with ".jnlp".
It returns
true
if the action is one of these.false
otherwise.- Overrides:
handleFileOrUrlAction
in classIntegratedDataViewer
- Parameters:
action
- The string actionproperties
- any properties- Returns:
true
if the action was "handled";false
otherwise.
-
addControlDescriptor
Add a newControlDescriptor
into thecontrolDescriptor
list andcontrolDescriptorMap
.This method differs from the IDV's in that McIDAS-V overwrites existing
ControlDescriptor ControlDescriptors
ifControlDescriptor.getControlId()
matches.- Overrides:
addControlDescriptor
in classIntegratedDataViewer
- Parameters:
cd
- The ControlDescriptor to add.- Throws:
NullPointerException
- ifcd
isnull
.
-
getControlDescriptorMap
Get theHashtable
that mapsControlDescriptor
IDs to theControlDescriptor
instance.Mostly used as a convenient way to check if a given
ControlDescriptor
has already been processed.- Returns:
Hashtable
that mapsString
IDs to the correspondingControlDescriptor
.
-
showLayerVisibilityAnimator
-
removeAllData
Handles removing all loaded data sources.If
ArgsManager.getIsOffScreen()
istrue
, this method will ignore the user's preferences and remove all data sources.- Parameters:
showWarning
- Whether or not to display a warning message before removing all data sources. See the return details for more.- Returns:
- Either
true
if the user wants to continue showing the warning dialog, orfalse
if they've elected to stop showing the warning. IfshowWarning
isfalse
, this method will always returnfalse
, as the user isn't interested in seeing the warning.
-
removeAllLayers
Handles removing all loaded layers ("displays" in IDV-land).If
ArgsManager.getIsOffScreen()
istrue
, this method will ignore the user's preferences and remove all layers.- Parameters:
showWarning
- Whether or not to display a warning message before removing all layers. See the return details for more.- Returns:
- Either
true
if the user wants to continue showing the warning dialog, orfalse
if they've elected to stop showing the warning. IfshowWarning
isfalse
, this method will always returnfalse
, as the user isn't interested in seeing the warning.
-
removeAllDataSources
Overridden so that McIDAS-V can prompt the user before removing, if necessary.- Overrides:
removeAllDataSources
in classIntegratedDataViewer
-
removeAllDisplays
Overridden so that McIDAS-V can prompt the user before removing, if necessary.- Overrides:
removeAllDisplays
in classIntegratedDataViewer
-
removeAllLayersAndData
Handles removing all loaded layers ("displays" in IDV-land) and data sources.If
ArgsManager.getIsOffScreen()
istrue
, this method will ignore the user's preferences and remove all layers and data.- See Also:
-
showWarningDialog
private Set<McIDASV.WarningResult> showWarningDialog(String title, String message, String prefId, String prefLabel, String okLabel, String cancelLabel) Helper method for showing the removal warning dialog. Note that none of these parameters should benull
or empty.- Parameters:
title
- Title of the warning dialog.message
- Contents of the warning. May contain HTML, but you do not need to provide opening and closing "html" tags.prefId
- ID of the preference that controls whether or not the dialog should be displayed.prefLabel
- Brief description of the preference.okLabel
- Text of button that signals removal.cancelLabel
- Text of button that signals cancelling removal.- Returns:
- A
Set
ofWarningResults
that describes what the user opted to do. Should always contain only two elements. One for whether or not "ok" or "cancel" was clicked, and one for whether or not the warning should continue to be displayed.
-
removeTabData
-
removeTabLayers
-
removeTabLayersAndData
-
getViewManager
public ViewManager getViewManager(ViewDescriptor viewDescriptor, boolean newWindow, String properties) Overridden so that McIDAS-V doesn't have to create an entire newIdvWindow
ifVMManager.findViewManager(ViewDescriptor)
can't find an appropriate ViewManager forviewDescriptor
.Not doing the above causes McIDAS-V to get stuck in a window creation loop.
- Specified by:
getViewManager
in interfaceControlContext
- Overrides:
getViewManager
in classIntegratedDataViewer
-
getStaticMcv
Returns a reference to the current McIDAS-V object. Useful for working inside static methods. Always check for null when using this method.- Returns:
- Either the current McIDAS-V "god object" or
null
.
-
setIdv
-
initPropertyFiles
Load the McV properties. All other property files are disregarded.- Overrides:
initPropertyFiles
in classIntegratedDataViewer
- See Also:
-
doSaveAsDefaultLayout
MakesPersistenceManager
save off a default "layout" bundle. -
hasDefaultLayout
Determines whether or not a default layout exists.- Returns:
true
if there is a default layout,false
otherwise.
-
doClearDefaults
Called from the menu command to clear the default bundle. Overridden in McIDAS-V so that we reference the layout rather than the bundle.- Overrides:
doClearDefaults
in classIntegratedDataViewer
-
getStartupDuration
Returns the time it took for McIDAS-V to start up.- Returns:
- These results are created from subtracting the results of two
System.nanoTime()
calls against one another.
-
addErrorButtons
Overridden so that the support form becomes non-modal if launched from an exception dialog.
- Specified by:
addErrorButtons
in interfaceLogUtil.DialogManager
- Overrides:
addErrorButtons
in classIntegratedDataViewer
- See Also:
-
overridePreferences
This method is useful for storing commandline "properties" with the user's preferences. -
detectAndHandleCrash
Determine if the last "exit" was clean--whether or notSESSION_FILE
was removed before the McIDAS-V process terminated.If the exit was not clean, the user is prompted to submit a support request.
-
initDone
Called after the IDV has finished setting everything up after starting. McIDAS-V is currently only using this method to determine if the last "exit" was clean--whether or notSESSION_FILE
was removed before the McIDAS-V process terminated. Called after the IDV has finished setting everything up. McIDAS-V uses this method to handle:- Clearing out the automatic display creation arguments.
- Presence of certain properties on the commandline.
- Detection and handling of a crashed McIDAS-V session.
- Run action specified by
-doaction
flag (if any). - Allowing tooltips to remain visible for more than 4 seconds.
- Apply preferences
- Overrides:
initDone
in classIntegratedDataViewer
- See Also:
-
doOpen
- Overrides:
doOpen
in classIntegratedDataViewer
- See Also:
-
doOpenInThread
Have the user select a bundle. If andRemove is true then we remove all data sources and displays. Then we open the bundle and start doing unpersistence things.- Parameters:
filename
- The filename to opencheckUserPreference
- Should we show, if needed, the "open" dialogandRemove
- If true then first remove all data sources and displays
-
doMakeJythonManager
Factory method to create the McIDAS-V @link JythonManager}.- Overrides:
doMakeJythonManager
in classIdvBase
- Returns:
- New
JythonManager
.
-
doMakeCollabManager
Factory method to create a McIDAS-VCollaborationManager
.- Overrides:
doMakeCollabManager
in classIdvBase
- Returns:
- New
CollaborationManager
.
-
doMakeIdvChooserManager
Factory method to create a McIDAS-VMcIdasChooserManager
. Here we create our own manager so it can do things specific to McIDAS-V.- Overrides:
doMakeIdvChooserManager
in classIdvBase
- Returns:
McIdasChooserManager
indicated by the startup properties.- See Also:
-
doMakeIdvUIManager
Factory method to create theIdvUIManager
. Here we create our own UI manager so it can do things specific to McIDAS-V.- Overrides:
doMakeIdvUIManager
in classIdvBase
- Returns:
UIManager
indicated by the startup properties.- See Also:
-
doMakeVMManager
Create our own VMManager so that we can make the tabs play nice.- Overrides:
doMakeVMManager
in classIdvBase
- See Also:
-
doMakePreferenceManager
Make theMcIdasPreferenceManager
.- Overrides:
doMakePreferenceManager
in classIdvBase
- See Also:
-
doMakePersistenceManager
McIDAS-V (alpha 10+) needs to handle both IDV bundles without component groups and all bundles from prior McV alphas. You better believe we need to extend the persistence manager functionality!
- Overrides:
doMakePersistenceManager
in classIdvBase
- See Also:
-
getMcIdasChooserManager
Create, if needed, and return theMcIdasChooserManager
.- Returns:
- The Chooser manager
-
getMonitorManager
Returns theMonitorManager
.- Returns:
- McIDAS-V "monitor manager".
-
onServerManagerWindowEvent
Responds to events generated by the server manager's GUI. Currently limited toTabbedAddeManager.Event#CLOSED
.- Parameters:
evt
-TabbedAddeManager
event to respond to.
-
showServerManager
Creates (if needed) the server manager GUI and displays it. -
getServerManager
Creates a new server manager (if needed) and returns it.- Returns:
- The McIDAS-V ADDE server manager.
-
getMcvDataManager
-
getIdv
Get McIDASV.- Specified by:
getIdv
in interfaceControlContext
- Specified by:
getIdv
in interfaceDataContext
- Overrides:
getIdv
in classIdvBase
- See Also:
-
doMakeArgsManager
Creates a McIDAS-V argument manager so that McV can handle some non-IDV command line things.- Overrides:
doMakeArgsManager
in classIdvBase
- Parameters:
args
- The arguments from the command line.- See Also:
-
doMakeDataManager
Factory method to create theMcvDataManager
.- Overrides:
doMakeDataManager
in classIdvBase
- Returns:
- The data manager
- See Also:
-
doMakeStateManager
Make the McIDAS-VStateManager
.- Overrides:
doMakeStateManager
in classIdvBase
- See Also:
-
doMakeResourceManager
Make the McIDAS-VResourceManager
.- Overrides:
doMakeResourceManager
in classIdvBase
- See Also:
-
doMakeColorTableManager
Make theMcIdasColorTableManager
.- Overrides:
doMakeColorTableManager
in classIdvBase
- See Also:
-
doMakePluginManager
Factory method to create theMcvPluginManager
.- Overrides:
doMakePluginManager
in classIdvBase
- Returns:
- The McV plugin manager.
- See Also:
-
makeHelpButton
Make a help button for a particular help topic- Overrides:
makeHelpButton
in classIntegratedDataViewer
- Parameters:
helpId
- the topic idtoolTip
- the tooltip- Returns:
- the button
-
getUserDirectory
Return the current "userpath".- Returns:
- Path to the user's "McIDAS-V directory".
-
getUserFile
Return the path to a file within "userpath".- Parameters:
filename
- File within the userpath.- Returns:
- Path to a file within the user's "McIDAS-V directory". No path validation is performed, so please be aware that the returned path may not exist.
-
runPluginMainMethod
Invokes the main method for a given class.Note: this is rather limited so far as it doesn't pass in any arguments.
- Parameters:
className
- Class whose main method is to be invoked. Cannot benull
.
-
isLoopback
Attempts to determine if a given string is a "loopback address" (aka localhost).Strings are trimmed and converted to lowercase, and currently checked against:
127.0.0.1
::1
(for IPv6)- Strings starting with
localhost
.
- Parameters:
host
-String
to check. Should not benull
.- Returns:
true
ifhost
is a recognized loopback address.false
otherwise.- Throws:
NullPointerException
- ifhost
isnull
.
-
isMac
Are we on a Mac? Used to build the MRJ handlers, taken from TN2110.- Returns:
true
if this session is running on top of OS X,false
otherwise.- See Also:
-
isUnixLike
Queries theos.name
system property and if the result does not start with "Windows", the platform is assumed to be "unix-like".Given the McIDAS-V supported platforms (Windows, "Unix", and OS X), the above logic is safe.
- Returns:
true
if we're not running on Windows,false
otherwise.- Throws:
RuntimeException
- if there is no property associated withos.name
.
-
isWindows
Queries theos.name
system property and if the result starts with "Windows", the platform is assumed to be Windows. Duh.- Returns:
true
if we're running on Windows,false
otherwise.- Throws:
RuntimeException
- if there is no property associated withos.name
.
-
getJavaDriveLetter
If McIDAS-V is running on Windows, this method will return aString
that looks like "C:" or "D:", etc.If McIDAS-V is not running on Windows, this method will return an empty
String
.- Returns:
- Either the "drive letter" of the
java.home
property or an emptyString
if McIDAS-V isn't running on Windows. - Throws:
RuntimeException
- if there is no property associated withjava.home
.
-
createSessionFile
Attempts to create a "session" file. This method will create a "userpath" if it does not already exist.- Parameters:
path
- Path of the session file that should get created.null
values are not allowed, and sufficient priviledges are assumed.- Throws:
AssertionError
- if McIDAS-V couldn't write topath
.- See Also:
-
extractDate
Attempts to extract a timestamp frompath
.path
is expected to only contain a single line consisting of aLong
integer.- Parameters:
path
- Path to the file of interest.- Returns:
- Either a
Date
of the timestamp contained inpath
ornull
if the extraction failed.
-
removeSessionFile
Attempts to remove the file accessible viapath
.- Parameters:
path
- Path of the file that'll get removed. This should be non-null and point to an existing and writable filename (not a directory).- Throws:
AssertionError
- if the file atpath
could not be removed.- See Also:
-
hadCleanExit
Tries to determine whether or not the last McIDAS-V session ended "cleanly". Currently a simple check for a "session" file that is created upon starting and removed upon ending.- Parameters:
path
- Path to the session file to check. Can't benull
.- Returns:
- Either
true
if the file pointed at bypath
does NOT exist,false
if it does exist. - See Also:
-
getSessionFilePath
Returns the (current) path to the session file. Note that the location of the file may change arbitrarily.- Returns:
String
pointing to the session file.- See Also:
-
applyArgs
Useful for providing the startup manager with values other than the defaults... Note that this method attempts to update the value ofSESSION_FILE
.- Parameters:
args
- Likely the argument array coming from the main method.
-
getControlDescriptors
This returns the set ofControlDescriptors
that can be shown. The ordering of this list determines the "default" controls shown in the Field Selector, so we override here for control over the ordering.- Overrides:
getControlDescriptors
in classIntegratedDataViewer
- Parameters:
includeTemplates
- If true then include the display templates- Returns:
- re-ordered List of shown control descriptors
-
handleWelcomeWindow
Show the McIDAS-V "Welcome Window" for the first start up.- Parameters:
args
- Commandline arguments, used to handle autoquit stress testing.
-
registerProtocolHandlers
Register "adde" and "idvresource" URL protocols.This needs to be called pretty early in the McIDAS-V initialization process. They're currently being registered immediately after the session file is created.
-
showNewHydra
Show the new HYDRA DataBrowser GUI.Mostly for ease of use via a toolbar action.
-
isDarkMode
Check the value of themcidasv.darkmode
system property.- Returns:
true
if dark mode should be enabled,false
otherwise.
-
main
Configure the logging and create the McIDAS-V object responsible for initializing the application session.- Parameters:
args
- Command line arguments.- Throws:
Exception
- When something untoward happens.
-
elapsedStartup
Log (TRACE level) the time spent in various discrete parts of McIDAS-V's startup process.Currently tracking time spent:
- creating GUI components with
McIDASVXmlUi
- initialing Jython interpreters.
The elapsed times are merely a quick estimate. The only way to obtain accurate timing information with the JVM is using JMH.
- See Also:
- creating GUI components with
-
exit
Attempts a clean shutdown of McIDAS-V.Currently, this entails suppressing any error dialogs, explicitly killing the
addeEntries
, removingSESSION_FILE
, and disabling the directory monitors found in the file choosers.- Overrides:
exit
in classIntegratedDataViewer
- Parameters:
exitCode
- System exit code to use.- See Also:
-
autoQuit
This method is largely a copy ofIntegratedDataViewer.quit()
, but allows for some GUI testing. -
watchDirectory
public void watchDirectory(String path, String glob, OnFileChangeListener listener) throws IOException Register the givenlistener
so that changes to files matchingglob
inpath
can be handled.- Parameters:
path
- Directory to watch.glob
- Only respond to files matching this file mask.listener
- Listener that can handle file changes.- Throws:
IOException
- if there was a problem registeringlistener
.
-
getWatchService
Returns McIDAS-V'sDirectoryWatchService
.- Returns:
DirectoryWatchService
responsible for handling all of McIDAS-V's directory monitoring.
-
startWatchService
Enable directory monitoring. -
stopWatchService
Disable directory monitoring. -
exitMcIDASV
Exposesexit(int)
to other classes.- Parameters:
exitCode
- System exit code to use.- See Also:
-