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 classResponsible for handling "idvresource" URLs.private static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionActions passed intohandleAction(String, Hashtable, boolean).private EntryStoreReference to the ADDE server manager.protected McIdasChooserManagerChooser managerprivate static booleanWhether or not the previous session was able to exit as it should.private static longInitialization duration.private static final org.slf4j.LoggerLogging object.private McIDASVMonitorHTTP based monitor to dump stack traces and shutdown McIDAS-V.private final MonitorManagerMonitorManagerallows for relatively easy and efficient monitoring of various resources.private JCheckBoxAccessory in file save dialogprivate static DateDate the previous session was started.static final IdvResourceManager.XmlIdvResourcePoints to the adde image defaults.static final IdvResourceManager.XmlIdvResourcePoints to the server definitions.private static StringPath to a "session" file--it's created upon McIDAS-V starting and removed when McIDAS-V exits cleanly.private static longInitialization start time.private static McIDASVUsed to access McIDAS-V state in a static context.private TabbedAddeManagerGUI wrapper for ADDE server management.static booleanSet to true only if "-forceaqua" was found in the command line.private final DirectoryWatchServiceDirectory monitoring service.Fields inherited from class ucar.unidata.idv.IntegratedDataViewer
controlDescriptorMap, controlDescriptors, displayControlsFields 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, vmManagerFields 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 voidvoidaddErrorButtons(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 voidUseful for providing the startup manager with values other than the defaults...booleanautoQuit()This method is largely a copy ofIntegratedDataViewer.quit(), but allows for some GUI testing.private static voidcreateSessionFile(String path) Attempts to create a "session" file.private voidDetermine if the last "exit" was clean--whether or notSESSION_FILEwas removed before the McIDAS-V process terminated.voidCalled from the menu command to clear the default bundle.protected ArgsManagerdoMakeArgsManager(String[] args) Creates a McIDAS-V argument manager so that McV can handle some non-IDV command line things.protected CollabManagerFactory method to create a McIDAS-VCollaborationManager.protected ColorTableManagerMake theMcIdasColorTableManager.protected DataManagerFactory method to create theMcvDataManager.protected IdvChooserManagerFactory method to create a McIDAS-VMcIdasChooserManager.protected IdvUIManagerFactory method to create theIdvUIManager.protected JythonManagerFactory method to create the McIDAS-V @link JythonManager}.protected IdvPersistenceManagerMcIDAS-V (alpha 10+) needs to handle both IDV bundles without component groups and all bundles from prior McV alphas.protected PluginManagerFactory method to create theMcvPluginManager.protected IdvPreferenceManagerMake theMcIdasPreferenceManager.protected IdvResourceManagerMake the McIDAS-VResourceManager.protected StateManagerMake the McIDAS-VStateManager.protected VMManagerCreate our own VMManager so that we can make the tabs play nice.voidprivate voiddoOpenInThread(String filename, boolean checkUserPreference, boolean andRemove) Have the user select a bundle.voidMakesPersistenceManagersave off a default "layout" bundle.static voidLog (TRACE level) the time spent in various discrete parts of McIDAS-V's startup process.protected voidexit(int exitCode) Attempts a clean shutdown of McIDAS-V.voidexitMcIDASV(int exitCode) Exposesexit(int)to other classes.private static DateextractDate(String path) Attempts to extract a timestamp frompath.Returns all of the actions used in this McIDAS-V session.ConvertsArgsManager.getOriginalArgs()to aListand returns.getControlDescriptors(boolean includeTemplates) This returns the set ofControlDescriptorsthat can be shown.getIdv()Get McIDASV.static StringIf McIDAS-V is running on Windows, this method will return aStringthat looks like "C:" or "D:", etc.intGet the maximum number of threads to be used when reading data.intGet 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 StringReturns the (current) path to the session file.longReturns the time it took for McIDAS-V to start up.static McIDASVReturns 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 newIdvWindowifVMManager.findViewManager(ViewDescriptor)can't find an appropriate ViewManager forviewDescriptor.Returns McIDAS-V'sDirectoryWatchService.private static booleanhadCleanExit(String path) Tries to determine whether or not the last McIDAS-V session ended "cleanly".booleanhandleAction(String action, Hashtable properties, boolean checkForAlias) Captures the action passed tohandleAction.protected booleanhandleFileOrUrlAction(String action, Hashtable properties) This method checks if the given action is one of the following.private static voidhandleWelcomeWindow(String... args) Show the McIDAS-V "Welcome Window" for the first start up.booleanDetermines whether or not a default layout exists.voidinitDone()Called after the IDV has finished setting everything up after starting.protected voidinitEncoder(XmlEncoder encoder, boolean forRead) Initializes a XML encoder with McIDAS-V specific XML delegates.voidinitPropertyFiles(List files) Load the McV properties.static booleanCheck the value of themcidasv.darkmodesystem property.static booleanisLoopback(String host) Attempts to determine if a given string is a "loopback address" (aka localhost).static booleanisMac()Are we on a Mac?static booleanQueries theos.namesystem property and if the result does not start with "Windows", the platform is assumed to be "unix-like".static booleanQueries theos.namesystem property and if the result starts with "Windows", the platform is assumed to be Windows.voidvoidbooleanstatic voidConfigure 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 topicvoidResponds to events generated by the server manager's GUI.private voidThis method is useful for storing commandline "properties" with the user's preferences.voidGeneric registration with the macOS application menu.private static voidRegister "adde" and "idvresource" URL protocols.booleanremoveAllData(boolean showWarning) Handles removing all loaded data sources.voidOverridden so that McIDAS-V can prompt the user before removing, if necessary.voidOverridden so that McIDAS-V can prompt the user before removing, if necessary.booleanremoveAllLayers(boolean showWarning) Handles removing all loaded layers ("displays" in IDV-land).voidHandles removing all loaded layers ("displays" in IDV-land) and data sources.private static voidremoveSessionFile(String path) Attempts to remove the file accessible viapath.voidvoidvoidvoidrunPluginMainMethod(String className) Invokes the main method for a given class.voidvoidvoidShow the new HYDRA DataBrowser GUI.voidCreates (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 voidStart up the McIDAS-V monitor server.voidEnable directory monitoring.voidDisable directory monitoring.voidwatchDirectory(String path, String glob, OnFileChangeListener listener) Register the givenlistenerso that changes to files matchingglobinpathcan 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, writeHistoryListMethods 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, showStationModelEditorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ucar.unidata.idv.ControlContext
getColorTableManager, getDisplayConventions, getObjectStore, getPersistenceManager, getPreferenceManager, getResourceManager, getStationModelManagerMethods inherited from interface ucar.unidata.data.DataContext
getJythonManager, getPreferenceMethods 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
MonitorManagerallows 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.javato 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:
getMaxRenderThreadCountin 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:
getMaxDataThreadCountin 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:
startMonitorin classIntegratedDataViewer
-
initEncoder
Initializes a XML encoder with McIDAS-V specific XML delegates.- Overrides:
initEncoderin 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 aListand 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:
handleActionin 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
trueif the action is one of these.falseotherwise.- Overrides:
handleFileOrUrlActionin classIntegratedDataViewer- Parameters:
action- The string actionproperties- any properties- Returns:
trueif the action was "handled";falseotherwise.
-
addControlDescriptor
Add a newControlDescriptorinto thecontrolDescriptorlist andcontrolDescriptorMap.This method differs from the IDV's in that McIDAS-V overwrites existing
ControlDescriptor ControlDescriptorsifControlDescriptor.getControlId()matches.- Overrides:
addControlDescriptorin classIntegratedDataViewer- Parameters:
cd- The ControlDescriptor to add.- Throws:
NullPointerException- ifcdisnull.
-
getControlDescriptorMap
Get theHashtablethat mapsControlDescriptorIDs to theControlDescriptorinstance.Mostly used as a convenient way to check if a given
ControlDescriptorhas already been processed.- Returns:
Hashtablethat mapsStringIDs 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
trueif the user wants to continue showing the warning dialog, orfalseif they've elected to stop showing the warning. IfshowWarningisfalse, 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
trueif the user wants to continue showing the warning dialog, orfalseif they've elected to stop showing the warning. IfshowWarningisfalse, 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:
removeAllDataSourcesin classIntegratedDataViewer
-
removeAllDisplays
Overridden so that McIDAS-V can prompt the user before removing, if necessary.- Overrides:
removeAllDisplaysin 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 benullor 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
SetofWarningResultsthat 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 newIdvWindowifVMManager.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:
getViewManagerin interfaceControlContext- Overrides:
getViewManagerin 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:
initPropertyFilesin classIntegratedDataViewer- See Also:
-
doSaveAsDefaultLayout
MakesPersistenceManagersave off a default "layout" bundle. -
hasDefaultLayout
Determines whether or not a default layout exists.- Returns:
trueif there is a default layout,falseotherwise.
-
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:
doClearDefaultsin 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:
addErrorButtonsin interfaceLogUtil.DialogManager- Overrides:
addErrorButtonsin 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_FILEwas 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_FILEwas 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
-doactionflag (if any). - Allowing tooltips to remain visible for more than 4 seconds.
- Apply preferences
- Overrides:
initDonein classIntegratedDataViewer- See Also:
-
doOpen
- Overrides:
doOpenin 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:
doMakeJythonManagerin classIdvBase- Returns:
- New
JythonManager.
-
doMakeCollabManager
Factory method to create a McIDAS-VCollaborationManager.- Overrides:
doMakeCollabManagerin 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:
doMakeIdvChooserManagerin classIdvBase- Returns:
McIdasChooserManagerindicated 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:
doMakeIdvUIManagerin classIdvBase- Returns:
UIManagerindicated by the startup properties.- See Also:
-
doMakeVMManager
Create our own VMManager so that we can make the tabs play nice.- Overrides:
doMakeVMManagerin classIdvBase- See Also:
-
doMakePreferenceManager
Make theMcIdasPreferenceManager.- Overrides:
doMakePreferenceManagerin 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:
doMakePersistenceManagerin 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-TabbedAddeManagerevent 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:
getIdvin interfaceControlContext- Specified by:
getIdvin interfaceDataContext- Overrides:
getIdvin classIdvBase- See Also:
-
doMakeArgsManager
Creates a McIDAS-V argument manager so that McV can handle some non-IDV command line things.- Overrides:
doMakeArgsManagerin classIdvBase- Parameters:
args- The arguments from the command line.- See Also:
-
doMakeDataManager
Factory method to create theMcvDataManager.- Overrides:
doMakeDataManagerin classIdvBase- Returns:
- The data manager
- See Also:
-
doMakeStateManager
Make the McIDAS-VStateManager.- Overrides:
doMakeStateManagerin classIdvBase- See Also:
-
doMakeResourceManager
Make the McIDAS-VResourceManager.- Overrides:
doMakeResourceManagerin classIdvBase- See Also:
-
doMakeColorTableManager
Make theMcIdasColorTableManager.- Overrides:
doMakeColorTableManagerin classIdvBase- See Also:
-
doMakePluginManager
Factory method to create theMcvPluginManager.- Overrides:
doMakePluginManagerin classIdvBase- Returns:
- The McV plugin manager.
- See Also:
-
makeHelpButton
Make a help button for a particular help topic- Overrides:
makeHelpButtonin 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-Stringto check. Should not benull.- Returns:
trueifhostis a recognized loopback address.falseotherwise.- Throws:
NullPointerException- ifhostisnull.
-
isMac
Are we on a Mac? Used to build the MRJ handlers, taken from TN2110.- Returns:
trueif this session is running on top of OS X,falseotherwise.- See Also:
-
isUnixLike
Queries theos.namesystem 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:
trueif we're not running on Windows,falseotherwise.- Throws:
RuntimeException- if there is no property associated withos.name.
-
isWindows
Queries theos.namesystem property and if the result starts with "Windows", the platform is assumed to be Windows. Duh.- Returns:
trueif we're running on Windows,falseotherwise.- Throws:
RuntimeException- if there is no property associated withos.name.
-
getJavaDriveLetter
If McIDAS-V is running on Windows, this method will return aStringthat 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.homeproperty or an emptyStringif 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.nullvalues 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.pathis expected to only contain a single line consisting of aLonginteger.- Parameters:
path- Path to the file of interest.- Returns:
- Either a
Dateof the timestamp contained inpathornullif 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 atpathcould 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
trueif the file pointed at bypathdoes NOT exist,falseif 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:
Stringpointing 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 ofControlDescriptorsthat 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:
getControlDescriptorsin 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.darkmodesystem property.- Returns:
trueif dark mode should be enabled,falseotherwise.
-
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:
exitin 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 givenlistenerso that changes to files matchingglobinpathcan 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:
DirectoryWatchServiceresponsible 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:
-