Package edu.wisc.ssec.mcidasv
Class ArgumentManager
java.lang.Object
ucar.unidata.ui.WindowHolder
ucar.unidata.idv.IdvManager
ucar.unidata.idv.ArgsManager
edu.wisc.ssec.mcidasv.ArgumentManager
- All Implemented Interfaces:
ActionListener,EventListener,IdvConstants
McIDAS-V needs to handle a few command line flags/options that the IDV does
not. Only the ability to force the Aqua look and feel currently exists.
- Author:
- McIDAS-V Developers
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringFlag that allows users to automatically run an action after startup.static final StringMcIDAS-V flag that signifies everything that follows is a Jython argument.static final StringFlag used to set the path to mcidasv.log.(package private) StringGiven by the "-user" argument.private static final org.slf4j.Loggerprivate List<org.python.core.PyString> Jython arguments, if any.private StringJython script to execute, or "<none>" if one was not given.static final String"__name__" to use when no Jython/Python script has been provided at startup.private StringHolds the ID of an action to automatically run after starting McV.static final StringUsage message.Fields inherited from class ucar.unidata.idv.ArgsManager
argDisplayB64Xml, argXidvFiles, b64Bundles, fileMappingFiles, fileMappingIds, initDisplays, initParams, installPlugins, islOptionalArgs, jythonCode, listResources, noGui, persistentCommandLineArgs, plugins, printJnlpBundles, RUNNABLE_MAX_TRIES, scriptingFiles, testArchive, testDir, testEval, testModeFields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, windowFields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_APPEARANCEMODE, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK_DASH, PROP_SHOWCLOCK_VIEW, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_DISPLAYAREA, PROP_USE_TIMEDRIVER, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV -
Constructor Summary
ConstructorsConstructorDescriptionArgumentManager(IntegratedDataViewer idv, String[] args) Just bubblin' on up the inheritance hierarchy. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClears out the automatic display creation arguments by settingArgsManager.initParamsandArgsManager.initDisplaystoCollections.emptyList().private static List<org.python.core.PyString> extractJythonArgs(int index, String... args) getBundleFilters(boolean fromOpen) Returns a list ofPatternFileFilters that can be used to determine if a file is a bundle.List<org.python.core.PyString> Returns Jython arguments.Returns the name of the Jython script the user has provided.private static JComponentgetMessageComponent(String msg, boolean breakLines) Get theJComponentthat displays the given message.protected StringAppend some McIDAS-V specific command line options to the default IDV usage message.booleanDetermine whether or not the user has provided any arguments for a Jython script.static booleanTestsnameto see if it has a known bundle extension.booleanisXidvFile(String name) static booleanisXmlBundle(String name) Tests to see ifnamehas a known XML bundle extension.booleanisZidvFile(String name) static booleanisZippedBundle(String name) Tests to see ifnamehas a known zipped bundle extension.protected StringFormat a line in the "usage message" output.protected intCurrently we're only handling the-forceaquaflag so we can mitigate some overlay issues we've been seeing on OS X Leopard.protected voidGets called by the IDV to process the set of initial files, e.g., default bundles, command line bundles, jnlp files, etc.voidRuns the action ID stored instartupAction.voidPrint out the command line usage message and exitstatic voiduserErrorMessage(String msg, boolean breakLines) Show a dialog containing an error message.static voiduserMessage(String msg, boolean breakLines) Show a dialog containing a message.Methods inherited from class ucar.unidata.idv.ArgsManager
checkArg, getCollabHostName, getCollabPort, getDoCollabServer, getFixedTimeString, getInitCatalogs, getIslInteractive, getIsOffScreen, getNoGui, getOptionalArgs, getOriginalArgs, initDone, isBundleFile, isDisplayXmlFile, isIslFile, isJnlpFile, isRbiFile, isScriptingMode, parseArgs, parseArgs, preprocessArgs, processInstanceArgs, setIsOffScreenMethods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDoneMethods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
-
Field Details
-
helpLogger
-
ARG_JYTHONARGS
McIDAS-V flag that signifies everything that follows is a Jython argument.- See Also:
-
ARG_LOGPATH
Flag used to set the path to mcidasv.log.- See Also:
-
ARG_DOACTION
Flag that allows users to automatically run an action after startup.- See Also:
-
USAGE_MESSAGE
Usage message.- See Also:
-
NO_PYTHON_MODULE
"__name__" to use when no Jython/Python script has been provided at startup.- See Also:
-
jythonArguments
Jython arguments, if any. -
jythonScript
Jython script to execute, or "<none>" if one was not given. -
startupAction
Holds the ID of an action to automatically run after starting McV. Value may be null. -
defaultUserDirectory
Given by the "-user" argument. Alternative user path for bundles, resources, etc.
-
-
Constructor Details
-
ArgumentManager
Just bubblin' on up the inheritance hierarchy.- Parameters:
idv- The IDV instance.args- The command line arguments that were given.
-
-
Method Details
-
extractJythonArgs
-
parseArg
Currently we're only handling the-forceaquaflag so we can mitigate some overlay issues we've been seeing on OS X Leopard.- Overrides:
parseArgin classArgsManager- Parameters:
arg- The current argument we're examining.args- The actual array of arguments.idx- The index ofargwithinargs.- Returns:
- The idx of the last value in the args array we look at. i.e., if the flag arg does not require any further values in the args array then don't increment idx. If arg requires one more value then increment idx by one. etc.
- Throws:
Exception- Throw bad things off to something that can handle 'em!
-
runStartupAction
Runs the action ID stored instartupAction. Calling this method will result in the contents ofstartupActionbeing deleted. -
getMessageComponent
Get theJComponentthat displays the given message.- Parameters:
msg- Message to display.breakLines- Whether or not "long" lines should be broken up.- Returns:
JComponentthat displaysmsg.
-
userMessage
Show a dialog containing a message.- Parameters:
msg- Message to display.breakLines- Iftrue, long lines are split.
-
userErrorMessage
Show a dialog containing an error message.- Parameters:
msg- Error message to display.breakLines- Iftrue, long lines are split.
-
usage
Print out the command line usage message and exit- Overrides:
usagein classArgsManager- Parameters:
err- The usage message
-
msg
Format a line in the "usage message" output. The chief difference between this method andArgsManager.msg(String, String)is that this method prefixes each line with four "space" characters, rather than a single "tab" character.- Overrides:
msgin classArgsManager- Parameters:
arg- Commandline argument.desc- Description of the argument.- Returns:
- Formatted line (suitable for
getUsageMessage().
-
getUsageMessage
Append some McIDAS-V specific command line options to the default IDV usage message.- Overrides:
getUsageMessagein classArgsManager- Returns:
- Usage message.
-
hasJythonArguments
Determine whether or not the user has provided any arguments for a Jython script.- Returns:
trueif the user has provided Jython arguments,falseotherwise.
-
getJythonArguments
Returns Jython arguments. Note: this does not include the Jython script that will be executed. -
getJythonScript
Returns the name of the Jython script the user has provided.- Returns:
- Either the path to a Jython file or "<none>" if the user did not provide a script.
-
processInitialBundles
Gets called by the IDV to process the set of initial files, e.g., default bundles, command line bundles, jnlp files, etc.Overridden by McIDAS-V to remove bundle file paths that are zero characters long. This was happening because
runMcV.batwas always passing '-bundle ""' on the command line (for Windows).- Overrides:
processInitialBundlesin classArgsManager- Throws:
VisADException- When something untoward happensRemoteException- When something untoward happens
-
getBundleFileFilters
- Overrides:
getBundleFileFiltersin classArgsManager- See Also:
-
getBundleFilters
Returns a list ofPatternFileFilters that can be used to determine if a file is a bundle.If
fromOpenistrue, the returned list will containPatternFileFilters for bundles as well as ISL files. Iffalse, the returned list will only contain filters for XML and zipped bundles.- Parameters:
fromOpen- Whether or not this has been called from an "open file" dialog.- Returns:
- Filters for bundles.
-
getXidvFileFilter
- Overrides:
getXidvFileFilterin classArgsManager- See Also:
-
getZidvFileFilter
- Overrides:
getZidvFileFilterin classArgsManager- See Also:
-
getXidvZidvFileFilter
- Overrides:
getXidvZidvFileFilterin classArgsManager- See Also:
-
isZidvFile
- Overrides:
isZidvFilein classArgsManager
-
isXidvFile
- Overrides:
isXidvFilein classArgsManager
-
isXmlBundle
Tests to see ifnamehas a known XML bundle extension.- Parameters:
name- Name of the bundle.- Returns:
- Whether or not
namehas an XML bundle suffix.
-
isZippedBundle
Tests to see ifnamehas a known zipped bundle extension.- Parameters:
name- Name of the bundle.- Returns:
- Whether or not
namehas zipped bundle suffix.
-
isBundle
Testsnameto see if it has a known bundle extension.- Parameters:
name- Name of the bundle.- Returns:
- Whether or not
namehas a bundle suffix.
-
clearAutomaticDisplayArgs
Clears out the automatic display creation arguments by settingArgsManager.initParamsandArgsManager.initDisplaystoCollections.emptyList().
-