|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucar.unidata.idv.IdvBase
ucar.unidata.idv.IntegratedDataViewer
edu.wisc.ssec.mcidasv.McIDASV
public class McIDASV
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 |
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 ControlDescriptor s
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 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 |
---|
private static final org.slf4j.Logger logger
private static String SESSION_FILE
private static boolean cleanExit
private static Date previousStart
public static boolean useAquaLookAndFeel
public static final IdvResourceManager.XmlIdvResource RSC_FRAMEDEFAULTS
public static final IdvResourceManager.XmlIdvResource RSC_SERVERS
private static McIDASV staticMcv
private JCheckBox overwriteDataCbx
protected McIdasChooserManager chooserManager
private McIDASVMonitor mcvMonitor
private final MonitorManager monitorManager
MonitorManager
allows for relatively easy and efficient monitoring of various resources.
private final List<String> actions
handleAction(String, Hashtable, boolean)
.
private EntryStore addeEntries
private TabbedAddeManager tabbedAddeManager
Constructor Detail |
---|
public McIDASV(String[] args) throws VisADException, RemoteException
IntegratedDataViewer.init()
args
- Command line arguments
VisADException
- from construction of VisAd objects
RemoteException
- from construction of VisAD objectsMethod Detail |
---|
public void registerForMacOSXEvents()
public boolean MacOSXQuit()
public void MacOSXAbout()
public void MacOSXPreferences()
protected void startMonitor()
startMonitor
in class IntegratedDataViewer
protected void initEncoder(XmlEncoder encoder, boolean forRead)
initEncoder
in class IntegratedDataViewer
encoder
- XML encoder that'll be dealing with persistence.forRead
- Not used as of yet.public List<String> getActionHistory()
public List<String> getCommandLineArgs()
ArgsManager.getOriginalArgs()
to a List
and
returns.
ArrayList
.public boolean handleAction(String action, Hashtable properties, boolean checkForAlias)
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.
handleAction
in class IntegratedDataViewer
protected boolean handleFileOrUrlAction(String action, Hashtable properties)
handleFileOrUrlAction
in class IntegratedDataViewer
action
- The string actionproperties
- any properties
protected void addControlDescriptor(ControlDescriptor cd)
ControlDescriptor
into the controlDescriptor
list and controlDescriptorMap
.
This method differs from the IDV's in that McIDAS-V overwrites
existing ControlDescriptor
s if
ControlDescriptor.getControlId()
matches.
addControlDescriptor
in class IntegratedDataViewer
cd
- The ControlDescriptor to add.
NullPointerException
- if cd
is null
.public void showLayerVisibilityAnimator()
public boolean removeAllData(boolean showWarning)
If ArgsManager.getIsOffScreen()
is true
, this method
will ignore the user's preferences and remove all data sources.
showWarning
- Whether or not to display a warning message before
removing all data sources. See the return details for more.
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.public boolean removeAllLayers(boolean showWarning)
If ArgsManager.getIsOffScreen()
is true
, this method
will ignore the user's preferences and remove all layers.
showWarning
- Whether or not to display a warning message before
removing all layers. See the return details for more.
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.public void removeAllDataSources()
removeAllDataSources
in class IntegratedDataViewer
public void removeAllDisplays()
removeAllDisplays
in class IntegratedDataViewer
public void removeAllLayersAndData()
If ArgsManager.getIsOffScreen()
is true
, this method
will ignore the user's preferences and remove all layers and data.
removeAllData(boolean)
,
removeAllLayers(boolean)
private Set<McIDASV.WarningResult> showWarningDialog(String title, String message, String prefId, String prefLabel, String okLabel, String cancelLabel)
null
or empty.
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.
Set
of McIDASV.WarningResult
s 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.public void removeTabData()
public void removeTabLayers()
public void removeTabLayersAndData()
public ViewManager getViewManager(ViewDescriptor viewDescriptor, boolean newWindow, String properties)
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.
getViewManager
in interface ControlContext
getViewManager
in class IntegratedDataViewer
public static McIDASV getStaticMcv()
null
.public void setIdv(IntegratedDataViewer idv)
setIdv
in class IdvBase
IdvBase.setIdv(ucar.unidata.idv.IntegratedDataViewer)
public void initPropertyFiles(List files)
initPropertyFiles
in class IntegratedDataViewer
IntegratedDataViewer.initPropertyFiles(java.util.List)
public void doSaveAsDefaultLayout()
PersistenceManager
save off a default "layout"
bundle.
public boolean hasDefaultLayout()
true
if there is a default layout, false
otherwise.public void doClearDefaults()
doClearDefaults
in class IntegratedDataViewer
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.
addErrorButtons
in interface LogUtil.DialogManager
addErrorButtons
in class IntegratedDataViewer
IntegratedDataViewer.addErrorButtons(JDialog, List, String, Throwable)
public void initDone()
SESSION_FILE
was
removed before the McIDAS-V process terminated.
initDone
in class IntegratedDataViewer
public void doOpen(String filename, boolean checkUserPreference, boolean andRemove)
doOpen
in class IntegratedDataViewer
IntegratedDataViewer.doOpen(String, boolean, boolean)
private void doOpenInThread(String filename, boolean checkUserPreference, boolean andRemove)
filename
- The filename to opencheckUserPreference
- Should we show, if needed, the Open dialogandRemove
- If true then first remove all data sources and displaysprotected JythonManager doMakeJythonManager()
JythonManager
doMakeJythonManager
in class IdvBase
protected IdvChooserManager doMakeIdvChooserManager()
IdvUIManager
. Here we create our
own UI manager so it can do McV specific things.
doMakeIdvChooserManager
in class IdvBase
IdvBase.doMakeIdvUIManager()
protected IdvUIManager doMakeIdvUIManager()
IdvUIManager
. Here we create our
own UI manager so it can do McV specific things.
doMakeIdvUIManager
in class IdvBase
IdvBase.doMakeIdvUIManager()
protected VMManager doMakeVMManager()
doMakeVMManager
in class IdvBase
IdvBase.doMakeVMManager()
protected IdvPreferenceManager doMakePreferenceManager()
McIdasPreferenceManager
.
doMakePreferenceManager
in class IdvBase
IdvBase.doMakePreferenceManager()
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!
doMakePersistenceManager
in class IdvBase
IdvBase.doMakePersistenceManager()
public McIdasChooserManager getMcIdasChooserManager()
McIdasChooserManager
.
public MonitorManager getMonitorManager()
MonitorManager
.
public void onServerManagerWindowEvent(TabbedAddeManager.Event evt)
TabbedAddeManager.Event#CLOSED
.
public void showServerManager()
public EntryStore getServerManager()
public McvDataManager getMcvDataManager()
public IntegratedDataViewer getIdv()
getIdv
in interface DataContext
getIdv
in interface ControlContext
getIdv
in class IdvBase
IdvBase.getIdv()
protected ArgsManager doMakeArgsManager(String[] args)
doMakeArgsManager
in class IdvBase
args
- The arguments from the command line.IdvBase.doMakeArgsManager(java.lang.String[])
protected DataManager doMakeDataManager()
McvDataManager
.
doMakeDataManager
in class IdvBase
IdvBase.doMakeDataManager()
protected StateManager doMakeStateManager()
StateManager
.
doMakeStateManager
in class IdvBase
IdvBase.doMakeStateManager()
protected IdvResourceManager doMakeResourceManager()
ResourceManager
.
doMakeResourceManager
in class IdvBase
IdvBase.doMakeResourceManager()
protected ColorTableManager doMakeColorTableManager()
McIdasColorTableManager
.
doMakeColorTableManager
in class IdvBase
IdvBase.doMakeColorTableManager()
protected PluginManager doMakePluginManager()
McvPluginManager
.
doMakePluginManager
in class IdvBase
IdvBase.doMakePluginManager()
public JComponent makeHelpButton(String helpId, String toolTip)
makeHelpButton
in class IntegratedDataViewer
helpId
- the topic idtoolTip
- the tooltip
public String getUserDirectory()
public String getUserFile(String filename)
filename
- File within the userpath.
public void runPluginMainMethod(String className)
Note: this is rather limited so far as it doesn't pass in any arguments.
className
- Class whose main method is to be invoked. Cannot be null
.public static boolean isLoopback(String host)
Strings are trimmed and converted to lowercase, and currently checked against:
127.0.0.1
::1
(for IPv6)localhost
.
host
- String
to check. Should not be null
.
true
if host
is a recognized loopback address.
false
otherwise.
NullPointerException
- if host
is null
.public static boolean isMac()
true
if this session is running on top of OS X, false
otherwise.public static boolean isUnixLike()
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.
true
if we're not running on Windows, false
otherwise.
RuntimeException
- if there is no property associated with
os.name
.public static boolean isWindows()
os.name
system property and if the result starts
with "Windows", the platform is assumed to be Windows. Duh.
true
if we're running on Windows, false
otherwise.
RuntimeException
- if there is no property associated with
os.name
.public static String getJavaDriveLetter()
String
that looks like "C:" or "D:", etc.
If McIDAS-V is not running on Windows, this method will return an
empty String
.
java.home
property or an empty String
if McIDAS-V isn't running on Windows.
RuntimeException
- if there is no property associated with
java.home
.private static void createSessionFile(String path)
path
- Path of the session file that should get created.
null
values are not allowed, and sufficient priviledges are
assumed.
AssertionError
- if McIDAS-V couldn't write to path
.SESSION_FILE
,
hadCleanExit(String)
,
removeSessionFile(String)
private static Date extractDate(String path)
path
. path
is
expected to only contain a single line consisting of a
Long
integer.
path
- Path to the file of interest.
Date
of the timestamp contained in
path
or null
if the extraction failed.private static void removeSessionFile(String path)
path
.
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).
AssertionError
- if the file at path
could not be
removed.SESSION_FILE
,
createSessionFile(String)
,
hadCleanExit(String)
private static boolean hadCleanExit(String path)
path
- Path to the session file to check. Can't be null
.
true
if the file pointed at by path
does
NOT exist, false
if it does exist.SESSION_FILE
,
createSessionFile(String)
,
removeSessionFile(String)
public static String getSessionFilePath()
String
pointing to the session file.SESSION_FILE
private static void applyArgs(String[] args)
SESSION_FILE
.
args
- Likely the argument array coming from the main method.public List getControlDescriptors(boolean includeTemplates)
ControlDescriptor
s
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.
getControlDescriptors
in class IntegratedDataViewer
includeTemplates
- If true then include the display templates
public static void main(String[] args) throws Exception
args
- Command line arguments
Exception
- When something untoward happensprotected void exit(int exitCode)
addeEntries
, and removing SESSION_FILE
.
exit
in class IntegratedDataViewer
exitCode
- System exit code to useIntegratedDataViewer.quit()
public void exitMcIDASV(int exitCode)
exit(int)
to other classes.
exitCode
- exit(int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |