edu.wisc.ssec.mcidasv
Class McIDASV

java.lang.Object
  extended by ucar.unidata.idv.IdvBase
      extended by ucar.unidata.idv.IntegratedDataViewer
          extended by edu.wisc.ssec.mcidasv.McIDASV
All Implemented Interfaces:
ActionListener, EventListener, HyperlinkListener, DataContext, ControlContext, IdvConstants, IdvContext, ViewContext, LogUtil.DialogManager, XmlPersistable

public class McIDASV
extends IntegratedDataViewer


Nested Class Summary
private static class McIDASV.WarningResult
           
 
Field Summary
private  List<String> actions
          Actions passed into handleAction(String, Hashtable, boolean).
private  EntryStore addeEntries
           
protected  McIdasChooserManager chooserManager
          The chooser manager
private static boolean cleanExit
           
private static org.slf4j.Logger logger
           
private  McIDASVMonitor mcvMonitor
          The http based monitor to dump stack traces and shutdown the IDV
private  MonitorManager monitorManager
          MonitorManager allows for relatively easy and efficient monitoring of various resources.
private  JCheckBox overwriteDataCbx
          Accessory in file save dialog
private static Date previousStart
           
static IdvResourceManager.XmlIdvResource RSC_FRAMEDEFAULTS
          Points to the adde image defaults.
static IdvResourceManager.XmlIdvResource RSC_SERVERS
          Points to the server definitions.
private static String SESSION_FILE
          Path to a "session" file--it's created upon McIDAS-V starting and removed when McIDAS-V exits cleanly.
private static McIDASV staticMcv
          Used to access McIDAS-V state in a static context.
private  TabbedAddeManager tabbedAddeManager
           
static boolean useAquaLookAndFeel
          Set to true only if "-forceaqua" was found in the command line.
 
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_MAX_PERMGENSIZE, 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_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_MAX_PERMGENSIZE, 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, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, 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
McIDASV(String[] args)
          Create the McIDASV with the given command line arguments.
 
Method Summary
protected  void addControlDescriptor(ControlDescriptor cd)
          Add a new ControlDescriptor into the controlDescriptor list and controlDescriptorMap.
 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 applyArgs(String[] args)
          Useful for providing the startup manager with values other than the defaults...
private static void createSessionFile(String path)
          Attempts to create a "session" file.
 void doClearDefaults()
          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  ColorTableManager doMakeColorTableManager()
          Make the McIdasColorTableManager.
protected  DataManager doMakeDataManager()
          Factory method to create the McvDataManager.
protected  IdvChooserManager doMakeIdvChooserManager()
          Factory method to create the IdvUIManager.
protected  IdvUIManager doMakeIdvUIManager()
          Factory method to create the IdvUIManager.
protected  JythonManager doMakeJythonManager()
          Make edu.wisc.ssec.mcidasv.JythonManager Factory method to create the JythonManager
protected  IdvPersistenceManager doMakePersistenceManager()
          McIDAS-V (alpha 10+) needs to handle both IDV bundles without component groups and all bundles from prior McV alphas.
protected  PluginManager doMakePluginManager()
          Factory method to create the McvPluginManager.
protected  IdvPreferenceManager doMakePreferenceManager()
          Make the McIdasPreferenceManager.
protected  IdvResourceManager doMakeResourceManager()
          Make the McIDAS-V ResourceManager.
protected  StateManager doMakeStateManager()
          Make the McIDAS-V StateManager.
protected  VMManager doMakeVMManager()
          Create our own VMManager so that we can make the tabs play nice.
 void doOpen(String filename, boolean checkUserPreference, boolean andRemove)
           
private  void doOpenInThread(String filename, boolean checkUserPreference, boolean andRemove)
          Have the user select an xidv file.
 void doSaveAsDefaultLayout()
          Makes PersistenceManager save off a default "layout" bundle.
protected  void exit(int exitCode)
          Attempts a clean shutdown of McIDAS-V.
 void exitMcIDASV(int exitCode)
          Exposes exit(int) to other classes.
private static Date extractDate(String path)
          Attempts to extract a timestamp from path.
 List<String> getActionHistory()
          Returns all of the actions used in this McIDAS-V session.
 List<String> getCommandLineArgs()
          Converts ArgsManager.getOriginalArgs() to a List and returns.
 List getControlDescriptors(boolean includeTemplates)
          This returns the set of ControlDescriptors that can be shown.
 IntegratedDataViewer getIdv()
          Get McIDASV.
static String getJavaDriveLetter()
          If McIDAS-V is running on Windows, this method will return a String that looks like "C:" or "D:", etc.
 McIdasChooserManager getMcIdasChooserManager()
          Create, if needed, and return the McIdasChooserManager.
 McvDataManager getMcvDataManager()
           
 MonitorManager getMonitorManager()
          Returns the MonitorManager.
 EntryStore getServerManager()
          Creates a new server manager (if needed) and returns it.
static String getSessionFilePath()
          Returns the (current) path to the session file.
static McIDASV getStaticMcv()
          Returns a reference to the current McIDAS-V object.
 String getUserDirectory()
          Return the current "userpath".
 String getUserFile(String filename)
          Return the path to a file within "userpath".
 ViewManager getViewManager(ViewDescriptor viewDescriptor, boolean newWindow, String properties)
          Overridden so that McIDAS-V doesn't have to create an entire new IdvWindow if VMManager.findViewManager(ViewDescriptor) can't find an appropriate ViewManager for viewDescriptor.
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 to handleAction.
protected  boolean handleFileOrUrlAction(String action, Hashtable properties)
          This method checks if the given action is one of the following.
 boolean hasDefaultLayout()
          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 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 isUnixLike()
          Queries the os.name system property and if the result does not start with "Windows", the platform is assumed to be "unix-like".
static boolean isWindows()
          Queries the os.name system property and if the result starts with "Windows", the platform is assumed to be Windows.
 void MacOSXAbout()
           
 void MacOSXPreferences()
           
 boolean MacOSXQuit()
           
static void main(String[] args)
          The main.
 JComponent makeHelpButton(String helpId, String toolTip)
          Make a help button for a particular help topic
 void onServerManagerWindowEvent(TabbedAddeManager.Event evt)
          Responds to events generated by the server manager's GUI.
 void registerForMacOSXEvents()
           
 boolean removeAllData(boolean showWarning)
          Handles removing all loaded data sources.
 void removeAllDataSources()
          Overridden so that McIDAS-V can prompt the user before removing, if necessary.
 void removeAllDisplays()
          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 removeAllLayersAndData()
          Handles removing all loaded layers ("displays" in IDV-land) and data sources.
private static void removeSessionFile(String path)
          Attempts to remove the file accessible via path.
 void removeTabData()
           
 void removeTabLayers()
           
 void removeTabLayersAndData()
           
 void runPluginMainMethod(String className)
          Invokes the main method for a given class.
 void setIdv(IntegratedDataViewer idv)
           
 void showLayerVisibilityAnimator()
           
 void showServerManager()
          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 startMonitor()
          Start up the McIDAS-V monitor server.
 
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, evaluateAndSave, flushDataCache, getAllControlDescriptors, getAllDataSources, getAllDisplaysIntialized, getBackgroundImages, getChangeDataPathCbx, getChangeDataPaths, getControlDescriptor, getControlDescriptors, getDataSources, getDerivedDataChoices, getDisplayControls, getEncoder, getEncoder, getEncoderForRead, getEncoderForWrite, getHaveInitialized, getHistory, getInteractiveMode, getLocationList, getMaxDataThreadCount, getMaxPermGenSize, getMaxRenderThreadCount, 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, doMakeCollabManager, 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 Detail

logger

private static final org.slf4j.Logger logger

SESSION_FILE

private static String 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

private static boolean cleanExit

previousStart

private static Date previousStart

useAquaLookAndFeel

public static boolean useAquaLookAndFeel
Set to true only if "-forceaqua" was found in the command line.


RSC_FRAMEDEFAULTS

public static final IdvResourceManager.XmlIdvResource RSC_FRAMEDEFAULTS
Points to the adde image defaults.


RSC_SERVERS

public static final IdvResourceManager.XmlIdvResource RSC_SERVERS
Points to the server definitions.


staticMcv

private static McIDASV staticMcv
Used to access McIDAS-V state in a static context.


overwriteDataCbx

private JCheckBox overwriteDataCbx
Accessory in file save dialog


chooserManager

protected McIdasChooserManager chooserManager
The chooser manager


mcvMonitor

private McIDASVMonitor mcvMonitor
The http based monitor to dump stack traces and shutdown the IDV


monitorManager

private final MonitorManager monitorManager
MonitorManager allows for relatively easy and efficient monitoring of various resources.


actions

private final List<String> actions
Actions passed into handleAction(String, Hashtable, boolean).


addeEntries

private EntryStore addeEntries

tabbedAddeManager

private TabbedAddeManager tabbedAddeManager
Constructor Detail

McIDASV

public McIDASV(String[] args)
        throws VisADException,
               RemoteException
Create the McIDASV with the given command line arguments. This constructor calls IntegratedDataViewer.init()

Parameters:
args - Command line arguments
Throws:
VisADException - from construction of VisAd objects
RemoteException - from construction of VisAD objects
Method Detail

registerForMacOSXEvents

public void registerForMacOSXEvents()

MacOSXQuit

public boolean MacOSXQuit()

MacOSXAbout

public void MacOSXAbout()

MacOSXPreferences

public void MacOSXPreferences()

startMonitor

protected void startMonitor()
Start up the McIDAS-V monitor server. This is an http server on the port defined by the property idv.monitorport (8788). It is only accessible to 127.0.0.1 (localhost)

Overrides:
startMonitor in class IntegratedDataViewer

initEncoder

protected void initEncoder(XmlEncoder encoder,
                           boolean forRead)
Initializes a XML encoder with McIDAS-V specific XML delegates.

Overrides:
initEncoder in class IntegratedDataViewer
Parameters:
encoder - XML encoder that'll be dealing with persistence.
forRead - Not used as of yet.

getActionHistory

public List<String> 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

public List<String> getCommandLineArgs()
Converts ArgsManager.getOriginalArgs() to a List and returns.

Returns:
The command-line arguments used to start McIDAS-V, as an ArrayList.

handleAction

public boolean handleAction(String action,
                            Hashtable properties,
                            boolean checkForAlias)
Captures the action passed to handleAction. 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 class IntegratedDataViewer

handleFileOrUrlAction

protected boolean handleFileOrUrlAction(String action,
                                        Hashtable properties)
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 class IntegratedDataViewer
    Parameters:
    action - The string action
    properties - any properties
    Returns:
    Was this action handled

  • addControlDescriptor

    protected void addControlDescriptor(ControlDescriptor cd)
    Add a new ControlDescriptor into the controlDescriptor list and controlDescriptorMap.

    This method differs from the IDV's in that McIDAS-V overwrites existing ControlDescriptors if ControlDescriptor.getControlId() matches.

    Overrides:
    addControlDescriptor in class IntegratedDataViewer
    Parameters:
    cd - The ControlDescriptor to add.
    Throws:
    NullPointerException - if cd is null.

    showLayerVisibilityAnimator

    public void showLayerVisibilityAnimator()

    removeAllData

    public boolean removeAllData(boolean showWarning)
    Handles removing all loaded data sources.

    If ArgsManager.getIsOffScreen() is true, 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, or false if they've elected to stop showing the warning. If showWarning is false, this method will always return false, as the user isn't interested in seeing the warning.

    removeAllLayers

    public boolean removeAllLayers(boolean showWarning)
    Handles removing all loaded layers ("displays" in IDV-land).

    If ArgsManager.getIsOffScreen() is true, 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, or false if they've elected to stop showing the warning. If showWarning is false, this method will always return false, as the user isn't interested in seeing the warning.

    removeAllDataSources

    public void removeAllDataSources()
    Overridden so that McIDAS-V can prompt the user before removing, if necessary.

    Overrides:
    removeAllDataSources in class IntegratedDataViewer

    removeAllDisplays

    public void removeAllDisplays()
    Overridden so that McIDAS-V can prompt the user before removing, if necessary.

    Overrides:
    removeAllDisplays in class IntegratedDataViewer

    removeAllLayersAndData

    public void removeAllLayersAndData()
    Handles removing all loaded layers ("displays" in IDV-land) and data sources.

    If ArgsManager.getIsOffScreen() is true, this method will ignore the user's preferences and remove all layers and data.

    See Also:
    removeAllData(boolean), removeAllLayers(boolean)

    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 be null 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 of McIDASV.WarningResults 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

    public void removeTabData()

    removeTabLayers

    public void removeTabLayers()

    removeTabLayersAndData

    public void removeTabLayersAndData()

    getViewManager

    public ViewManager getViewManager(ViewDescriptor viewDescriptor,
                                      boolean newWindow,
                                      String properties)
    Overridden so that McIDAS-V doesn't have to create an entire new IdvWindow if VMManager.findViewManager(ViewDescriptor) can't find an appropriate ViewManager for viewDescriptor.

    Not doing the above causes McIDAS-V to get stuck in a window creation loop.

    Specified by:
    getViewManager in interface ControlContext
    Overrides:
    getViewManager in class IntegratedDataViewer

    getStaticMcv

    public static McIDASV 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

    public void setIdv(IntegratedDataViewer idv)
    Overrides:
    setIdv in class IdvBase
    See Also:
    IdvBase.setIdv(ucar.unidata.idv.IntegratedDataViewer)

    initPropertyFiles

    public void initPropertyFiles(List files)
    Load the McV properties. All other property files are disregarded.

    Overrides:
    initPropertyFiles in class IntegratedDataViewer
    See Also:
    IntegratedDataViewer.initPropertyFiles(java.util.List)

    doSaveAsDefaultLayout

    public void doSaveAsDefaultLayout()
    Makes PersistenceManager save off a default "layout" bundle.


    hasDefaultLayout

    public boolean hasDefaultLayout()
    Determines whether or not a default layout exists.

    Returns:
    true if there is a default layout, false otherwise.

    doClearDefaults

    public void 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 class IntegratedDataViewer

    addErrorButtons

    public 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.

    Specified by:
    addErrorButtons in interface LogUtil.DialogManager
    Overrides:
    addErrorButtons in class IntegratedDataViewer
    See Also:
    IntegratedDataViewer.addErrorButtons(JDialog, List, String, Throwable)

    initDone

    public void 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 not SESSION_FILE was removed before the McIDAS-V process terminated.

    Overrides:
    initDone in class IntegratedDataViewer

    doOpen

    public void doOpen(String filename,
                       boolean checkUserPreference,
                       boolean andRemove)
    Overrides:
    doOpen in class IntegratedDataViewer
    See Also:
    IntegratedDataViewer.doOpen(String, boolean, boolean)

    doOpenInThread

    private void doOpenInThread(String filename,
                                boolean checkUserPreference,
                                boolean andRemove)
    Have the user select an xidv file. If andRemove is true then we remove all data sources and displays. Then we open the unpersist the bundle in the xidv file

    Parameters:
    filename - The filename to open
    checkUserPreference - Should we show, if needed, the Open dialog
    andRemove - If true then first remove all data sources and displays

    doMakeJythonManager

    protected JythonManager doMakeJythonManager()
    Make edu.wisc.ssec.mcidasv.JythonManager Factory method to create the JythonManager

    Overrides:
    doMakeJythonManager in class IdvBase
    Returns:
    The jython manager

    doMakeIdvChooserManager

    protected IdvChooserManager doMakeIdvChooserManager()
    Factory method to create the IdvUIManager. Here we create our own UI manager so it can do McV specific things.

    Overrides:
    doMakeIdvChooserManager in class IdvBase
    Returns:
    The UI manager indicated by the startup properties.
    See Also:
    IdvBase.doMakeIdvUIManager()

    doMakeIdvUIManager

    protected IdvUIManager doMakeIdvUIManager()
    Factory method to create the IdvUIManager. Here we create our own UI manager so it can do McV specific things.

    Overrides:
    doMakeIdvUIManager in class IdvBase
    Returns:
    The UI manager indicated by the startup properties.
    See Also:
    IdvBase.doMakeIdvUIManager()

    doMakeVMManager

    protected VMManager doMakeVMManager()
    Create our own VMManager so that we can make the tabs play nice.

    Overrides:
    doMakeVMManager in class IdvBase
    See Also:
    IdvBase.doMakeVMManager()

    doMakePreferenceManager

    protected IdvPreferenceManager doMakePreferenceManager()
    Make the McIdasPreferenceManager.

    Overrides:
    doMakePreferenceManager in class IdvBase
    See Also:
    IdvBase.doMakePreferenceManager()

    doMakePersistenceManager

    protected IdvPersistenceManager 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 class IdvBase
    See Also:
    IdvBase.doMakePersistenceManager()

    getMcIdasChooserManager

    public McIdasChooserManager getMcIdasChooserManager()
    Create, if needed, and return the McIdasChooserManager.

    Returns:
    The Chooser manager

    getMonitorManager

    public MonitorManager getMonitorManager()
    Returns the MonitorManager.


    onServerManagerWindowEvent

    public void onServerManagerWindowEvent(TabbedAddeManager.Event evt)
    Responds to events generated by the server manager's GUI. Currently limited to TabbedAddeManager.Event#CLOSED.


    showServerManager

    public void showServerManager()
    Creates (if needed) the server manager GUI and displays it.


    getServerManager

    public EntryStore getServerManager()
    Creates a new server manager (if needed) and returns it.


    getMcvDataManager

    public McvDataManager getMcvDataManager()

    getIdv

    public IntegratedDataViewer getIdv()
    Get McIDASV.

    Specified by:
    getIdv in interface DataContext
    Specified by:
    getIdv in interface ControlContext
    Overrides:
    getIdv in class IdvBase
    See Also:
    IdvBase.getIdv()

    doMakeArgsManager

    protected ArgsManager doMakeArgsManager(String[] args)
    Creates a McIDAS-V argument manager so that McV can handle some non-IDV command line things.

    Overrides:
    doMakeArgsManager in class IdvBase
    Parameters:
    args - The arguments from the command line.
    See Also:
    IdvBase.doMakeArgsManager(java.lang.String[])

    doMakeDataManager

    protected DataManager doMakeDataManager()
    Factory method to create the McvDataManager.

    Overrides:
    doMakeDataManager in class IdvBase
    Returns:
    The data manager
    See Also:
    IdvBase.doMakeDataManager()

    doMakeStateManager

    protected StateManager doMakeStateManager()
    Make the McIDAS-V StateManager.

    Overrides:
    doMakeStateManager in class IdvBase
    See Also:
    IdvBase.doMakeStateManager()

    doMakeResourceManager

    protected IdvResourceManager doMakeResourceManager()
    Make the McIDAS-V ResourceManager.

    Overrides:
    doMakeResourceManager in class IdvBase
    See Also:
    IdvBase.doMakeResourceManager()

    doMakeColorTableManager

    protected ColorTableManager doMakeColorTableManager()
    Make the McIdasColorTableManager.

    Overrides:
    doMakeColorTableManager in class IdvBase
    See Also:
    IdvBase.doMakeColorTableManager()

    doMakePluginManager

    protected PluginManager doMakePluginManager()
    Factory method to create the McvPluginManager.

    Overrides:
    doMakePluginManager in class IdvBase
    Returns:
    The McV plugin manager.
    See Also:
    IdvBase.doMakePluginManager()

    makeHelpButton

    public JComponent makeHelpButton(String helpId,
                                     String toolTip)
    Make a help button for a particular help topic

    Overrides:
    makeHelpButton in class IntegratedDataViewer
    Parameters:
    helpId - the topic id
    toolTip - the tooltip
    Returns:
    the button

    getUserDirectory

    public String getUserDirectory()
    Return the current "userpath".

    Returns:
    Path to the user's "McIDAS-V directory".

    getUserFile

    public String getUserFile(String filename)
    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

    public void runPluginMainMethod(String className)
    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 be null.

    isLoopback

    public static boolean isLoopback(String host)
    Attempts to determine if a given string is a "loopback address" (aka localhost).

    Strings are trimmed and converted to lowercase, and currently checked against:

    Parameters:
    host - String to check. Should not be null.
    Returns:
    true if host is a recognized loopback address. false otherwise.
    Throws:
    NullPointerException - if host is null.

    isMac

    public static boolean 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:
    TN2110

    isUnixLike

    public static boolean isUnixLike()
    Queries the os.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 with os.name.

    isWindows

    public static boolean isWindows()
    Queries the os.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 with os.name.

    getJavaDriveLetter

    public static String getJavaDriveLetter()
    If McIDAS-V is running on Windows, this method will return a String 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 empty String if McIDAS-V isn't running on Windows.
    Throws:
    RuntimeException - if there is no property associated with java.home.

    createSessionFile

    private static void createSessionFile(String path)
    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 to path.
    See Also:
    SESSION_FILE, hadCleanExit(String), removeSessionFile(String)

    extractDate

    private static Date extractDate(String path)
    Attempts to extract a timestamp from path. path is expected to only contain a single line consisting of a Long integer.

    Parameters:
    path - Path to the file of interest.
    Returns:
    Either a Date of the timestamp contained in path or null if the extraction failed.

    removeSessionFile

    private static void removeSessionFile(String path)
    Attempts to remove the file accessible via path.

    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 at path could not be removed.
    See Also:
    SESSION_FILE, createSessionFile(String), hadCleanExit(String)

    hadCleanExit

    private static boolean hadCleanExit(String path)
    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 be null.
    Returns:
    Either true if the file pointed at by path does NOT exist, false if it does exist.
    See Also:
    SESSION_FILE, createSessionFile(String), removeSessionFile(String)

    getSessionFilePath

    public static String 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:
    SESSION_FILE

    applyArgs

    private static void applyArgs(String[] args)
    Useful for providing the startup manager with values other than the defaults... Note that this method attempts to update the value of SESSION_FILE.

    Parameters:
    args - Likely the argument array coming from the main method.

    getControlDescriptors

    public List getControlDescriptors(boolean includeTemplates)
    This returns the set of ControlDescriptors 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 class IntegratedDataViewer
    Parameters:
    includeTemplates - If true then include the display templates
    Returns:
    re-ordered List of shown control descriptors

    main

    public static void main(String[] args)
                     throws Exception
    The main. Configure the logging and create the McIdasV

    Parameters:
    args - Command line arguments
    Throws:
    Exception - When something untoward happens

    exit

    protected void exit(int exitCode)
    Attempts a clean shutdown of McIDAS-V. Currently this entails suppressing any error dialogs, explicitly killing the addeEntries, and removing SESSION_FILE.

    Overrides:
    exit in class IntegratedDataViewer
    Parameters:
    exitCode - System exit code to use
    See Also:
    IntegratedDataViewer.quit()

    exitMcIDASV

    public void exitMcIDASV(int exitCode)
    Exposes exit(int) to other classes.

    Parameters:
    exitCode -
    See Also:
    exit(int)