ucar.unidata.idv
Class IntegratedDataViewer

java.lang.Object
  extended by ucar.unidata.idv.IdvBase
      extended by ucar.unidata.idv.IntegratedDataViewer
All Implemented Interfaces:
ActionListener, EventListener, HyperlinkListener, DataContext, ControlContext, IdvConstants, IdvContext, ViewContext, LogUtil.DialogManager, XmlPersistable
Direct Known Subclasses:
DefaultIdv, MultiPaneIdv

public class IntegratedDataViewer
extends IdvBase
implements ControlContext, ViewContext, DataContext, ActionListener, HyperlinkListener, LogUtil.DialogManager

This is the central class for IDV applications. It is abstract and needs a concrete derived class to overwrite the doMakeContents method. (e.g., DefaultIdv). This class serves as the nexus of a collection of editors and managers (e.g., IdvUIManager, VMManager, etc.) Its base class, IdvBase, holds these editors and managers and uses a set of factory methods (e.g., doMakeStationModelManager) for creating them. One can override, in a derived class, one of these factory methods to create special purpose components or handlers.

To run the IDV you:

Author:
IDV development team

Field Summary
protected  Hashtable controlDescriptorMap
          Mapping from control descriptor id to ControlDescriptor
protected  List controlDescriptors
          List of the ControlDescriptors defined in the controls.xml file
protected  List displayControls
          List of all of the DisplayControls currently active
 
Fields inherited from class ucar.unidata.idv.IdvBase
aliasEditor, args, argsManager, autoDisplayEditor, chooserManager, collabManager, colorTableEditor, colorTableManager, dataManager, displayConventions, idv, imageGenerator, jythonManager, paramDefaultsEditor, paramGroupsEditor, persistenceManager, pluginManager, preferenceManager, projectionManager, publishManager, resourceManager, stateManager, stationModelManager, testManager, uiManager, vmManager
 
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, 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_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, FILE_VMSTATE, 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_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_HISTORY, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, 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_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, 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_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, 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
IntegratedDataViewer()
          Parameterless constructor.
IntegratedDataViewer(boolean interactiveMode)
          Ctor for when some other code is calling us.
IntegratedDataViewer(String[] args)
          The main constructor.
IntegratedDataViewer(String[] args, boolean interactiveMode)
          ctor
 
Method Summary
 void actionPerformed(ActionEvent event)
          Implementation of the ActionListener interface.
protected  void addControlDescriptor(ControlDescriptor cd)
          Add a new ControlDescriptor into the controlDescriptor list and controlDescriptorMap hashtable.
 void addDisplayControl(DisplayControl control)
          Add the given DisplayControl into the list of display controls.
 void addErrorButtons(JDialog dialog, List buttonList, String msg, Throwable exc)
          Implement the LogUtil.DialogManager interface to add buttons to the dialog.
 void addToHistoryList(History newHistory)
          Add the given History object into the history list.
 void addToHistoryList(String filename)
          Add the given file to the history list.
 void applyPreferences()
          Apply preferences.
protected  void checkSystem()
          Check whether the system has the necessary components (ex: Java 3D).
 void cleanup()
           
protected  void clearCachedData()
          This is called when the CacheManager detects the need ot clear memory.
 void clearHistoryList()
          Empty the history list and write it out.
 void clearWaitCursor()
          Pass through to IdvUIManager.clearWaitCursor()
 void closeCurrentWindow()
          close current window
 void controlHasBeenInitialized(DisplayControl control)
          Called by the given DisplayControl when it has been fully initialized.
 DataSelector createDataSelector()
          Create a DataSelector window.
 DataSourceResults createDataSource(Object definingObject, String dataType, Hashtable properties, boolean checkAlias)
          Create the data source (or data sources) defined by the given definingObject.
 DisplayControl createDisplay(String dataSourceName, String paramName, String displayName, String properties)
          Create a display from the given datasource/paramname pair.
 DisplayControl createDisplay(String dataSourceName, String paramName, String displayName, String properties, boolean initDisplayInThread)
          Create a display from the given datasource/paramname pair.
 void createImage(String imageName, String dataSourceName, String paramName, String displayName)
          This method loads in the data, creates the display from the given paramName and writes out a screen image.
 void createNewWindow()
          Create a new window containing a new MapViewManager
 void dataSourceChanged(DataSource source)
          Implementation of the DataContext method.
 Object decodeObject(String xml)
          Create and return the Object defined by the given xml.
 void doClearDefaults()
          Called from the menu command to clear the default bundle
 void doImport()
          Have the user select an xidv bundle file and then unpersist the bundle.
 void doMakeBackgroundImage()
          Make the background wms image
 DisplayControl doMakeControl(DataChoice dataChoice, ControlDescriptor descriptor, String properties)
          Create the DisplayControl, identified by the given ControlDescriptor for the given DataChoice
 DisplayControl doMakeControl(DataChoice dataChoice, ControlDescriptor descriptor, String properties, DataSelection dataSelection)
          Create the DisplayControl, identified by the given ControlDescriptor for the given DataChoice
 DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor)
          Create the DisplayControl, identified by the given ControlDescriptor for the given list of DataChoices
 DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor, Hashtable properties, DataSelection dataSelection)
          Create the DisplayControl, identified by the given ControlDescriptor for the given list of DataChoices
 DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor, Hashtable properties, DataSelection dataSelection, boolean initDisplayInThread)
          Finally, we really create the DisplayControl, identified by the given * ControlDescriptor using the given list of DataChoices
 DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor, String propertiesString, DataSelection dataSelection)
          Create the DisplayControl, identified by the given ControlDescriptor for the given list of DataChoices
 DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor, String propertiesString, DataSelection dataSelection, boolean initDisplayInThread)
          Finally, we really create the DisplayControl, identified by the given ControlDescriptor using the given list of DataChoices
 DisplayControl doMakeControl(String controlName)
          This method is called by the helptips, passing in the name of the display control (from controls.xml).
 DisplayControl doMakeControl(String controlName, DataChoice dataChoice)
          make a control
 DisplayControl doMakeControl(String controlName, List dataChoices)
          make a control
 JMenu doMakeDataChoiceMenu(DataChoice dataChoice)
          Make and return the menu of commands that can be applied to the given DataChoice.
 void doOpen()
          Have the user select an xidv bundle file, remove all data sources and displays, and then unpersist the bundle.
 void doOpen(String bundleUri)
          Load in the given bundle.
 void doOpen(String filename, boolean checkUserPreference, boolean andRemove)
          Have the user select an xidv file.
 void doOpenDefault()
          Called from the menu command to open the default bundle
 void doSave()
          Save the current state off to the current xidv filename
 void doSaveAs()
          Have the user select an xidv filename and write the current application state to it.
 void doSaveAsDefault()
          Called from the menu command to save the current state as the default bundle
 String encodeObject(Object object, boolean prettyPrint)
          Return the xml representation of the given object.
 void evaluateAndSave(DataChoice dataChoice)
          Evalute the data choice and then save it off in a CacheDataSource
protected  void exit(int exitCode)
          Exit the application.
 List getAllControlDescriptors()
          Return all the ControlDescriptors
 List getAllDataSources()
          Gets all of the data sources.
 ControlDescriptor getControlDescriptor(String name)
          Return the ControlDescriptor with the given name, or null if not found.
 List getControlDescriptors()
          This returns the set of ControlDescriptors that can be shown.
 List getControlDescriptors(boolean includeTemplates)
          This returns the set of ControlDescriptors that can be shown.
 List getDataSources()
          Wrapper method around DataManager.getDataSources().
 List getDerivedDataChoices(DataSource dataSource, List dataChoices)
          Get the list of derived data choices
 List getDisplayControls()
          Return the list of DisplayControls currently active
protected  XmlEncoder getEncoder(boolean forRead)
          Create an XmlEncoder and initialize it with the VisADPersistence delegates.
 XmlEncoder getEncoderForRead()
          Create a new XmlEncoder for doing unpersisting.
 XmlEncoder getEncoderForWrite()
          Create a new XmlEncoder for doing persisting.
 boolean getHaveInitialized()
          Has this IDV been fully initialized
 List getHistory()
          Create, if needed, and return the history list.
 boolean getInteractiveMode()
          Are we interactive
 List getLocationList()
          Create (if null) and return the list NamedStationTable-s defined by the locationResources XmlResourceCollection.
protected  List getProjections()
          Return the list of Projections
protected  byte[] getStaticImage(String bundle)
          Get image
 ViewManager getViewManager()
          Create, if needed, and return the default 3d view manager
 ViewManager getViewManager(ViewDescriptor viewDescriptor)
          Implementation of the ControlContext interface call.
 ViewManager getViewManager(ViewDescriptor viewDescriptor, boolean newWindow, String properties)
          Creates, if needed, and returns the ViewManager that is specified by the given ViewDescriptor
 String getViewManagerProperties()
          Return a String of semi-colon separated name=value pairs that define the default properties for ViewManagers.
 boolean handleAction(String action)
          handle action
 boolean handleAction(String action, Hashtable properties)
          This method tries to handle the given action.
 boolean handleAction(String action, Hashtable properties, boolean checkForAlias)
          This method tries to handle the given action.
protected  boolean handleFileOrUrlAction(String action, Hashtable properties)
          This method checks if the given action is one of the following.
 void hyperlinkUpdate(HyperlinkEvent e)
          Implement the hyperlinklistener interface.
 void hyperlinkUpdate(HyperlinkEvent e, Hashtable properties)
          Handle the click
protected  void init()
          This is a wrapper that calls initInner within a thread.
 void initCacheManager()
          Set the state in the cache manager
 void initDone()
          Gets called when all initialization is finished.
protected  void initEncoder(XmlEncoder encoder, boolean forRead)
          A hook so derived classes can add their own initialization to the given encoder.
protected  void initInner()
          Build the gui, process bundles, etc.
protected  void initPreferences(IdvPreferenceManager preferenceManager)
          Add into the IdvPreferenceManager the different gui components/preference managers
 void initPropertyFiles(List files)
          A hook to allow derived classes to add in their own property files.
 String listApi(Object o)
          Utility to list the public api of the given object
protected  void loadDataFiles(List files)
          Load in a datasource for each file/url in the given files list.
 boolean loadDataSource(DataSource dataSource)
          Load in a DataSource.
 void loadRbiFile(String filename)
          Sometime we will be able to dynamically load in a rbi file (resource bundle)
 void logException(String msg, Throwable exc)
          Helper method that calls LogUtil.printException
static void main(String[] args)
          Default main implementation.
 boolean makeDataSource(Object definingObject, String dataType, Hashtable properties)
          Create the datasource, identified by the given dataType if non-null, with the given definingObject and properties.
 boolean makeDataSource(Object definingObject, String dataType, Hashtable properties, boolean checkAlias)
          Create the datasource, identified by the given dataType if non-null, with the given definingObject and properties.
 boolean makeDataSource(Object definingObject, String dataType, Hashtable properties, boolean checkAlias, String displayType)
          Create the datasource, identified by the given dataType if non-null, with the given definingObject and properties.
 DataSourceResults makeDataSourceFromXml(String dataSourceXml)
          This creates a new data source from the xml encoded representation of a persisted data source.
 JComponent makeHelpButton(String helpId)
          Make a help button for a particular help topic
 JComponent makeHelpButton(String helpId, String toolTip)
          Make a help button for a particular help topic
 DataSource makeOneDataSource(Object definingObject, String dataType, Hashtable properties)
          A helper method that will create a data source from the given defining object (e.g., url, filename, collection of images, etc.) and dataType, will show any errors, and, if a data source was created will return it.
 void moveHistoryToFront(History history)
          Move a history to the front of the list
 boolean okToShowWindows()
          Is it ok to show any windows.
 void printCacheStats()
          Print cache statistics
static void processScript(String scriptFile)
          Get the image from the given isl script.
 void publishToThredds()
          For now a hack for John's demo
 boolean quit()
          Called to end execution of this process.
 void registerHelpKey(JComponent comp, String helpId)
          Register a help key for a component
 void reloadAllDataSources()
          reload all data sources
 void removeAllDataSources()
          Remove all current data sources.
 void removeAllDisplays()
          Remove all of the displays.
 void removeAllDisplays(boolean payAttentionToCanDoRemoveAll)
          remove all displays
 void removeDataSource(DataSource dataSource)
          Remove the data source from the DataManager and from any DataTree-s.
 void removeDisplayControl(DisplayControl control)
          Remove the given DisplayControl from the list of display controls.
protected  void runImageServer(int port, String propertyFile)
          startup and run the image server
 void saveInCache(DataChoice dataChoice, Data data)
          Clone the data choice and then save it off in a CacheDataSource
 void saveInCache(DataChoice dataChoice, Data data, DataSelection dataSelection)
          Save the given data in the CacheDataSource
 void saveInCache(DataChoice dataChoice, Data data, DataSelection dataSelection, String name)
          Clone the data choice and then save it off in a CacheDataSource
 void saveInCache(DataChoice dataChoice, Data data, String name)
          Clone the data choice and then save it off in a CacheDataSource
 DataChoice selectDataChoice(ControlDescriptor descriptor)
          Popup a dialog containing a DataTree showing the DataChoices that are applicable to the given ControlDescriptor.
 List selectDataChoices(List fullParamNames)
          Popup a dialog containing a DataTree for each operand in the given fullParamNames list Return a List of DataChoice's the user selects or null if they canceled.
 String selectDataType(Object definingObject)
          Ask the user to select a data type for the given defining object
 String selectDataType(Object definingObject, String message)
          Ask the user what data type to use
 List selectUserChoices(String msg, List userChoices)
          Popup a JTextField containing dialog that allows the user to enter text values, one for each name in the userChoices List.
 void showConsole()
          Show the error message console.
 void showNormalCursor()
          Pass through to IdvUIManager.showNormalCursor()
 void showWaitCursor()
          Pass through to IdvUIManager.showWaitCursor()
 void showWindow(DisplayControl control, IdvWindow window)
          Implementation of the ControlContext method.
 void toFront(DisplayControl control)
          Move the given display control to the front.
 void waitLabelClicked()
          The user clicked on the wait label
 void waitUntilDisplaysAreDone()
          Wait until the displays have been rendered
 void writeHistoryList()
          Persist the history list into its own file.
 
Methods inherited from class ucar.unidata.idv.IdvBase
addPluginClass, createElement, doMakeAliasEditor, doMakeArgsManager, doMakeAutoDisplayEditor, doMakeCollabManager, doMakeColorTableEditor, doMakeColorTableManager, doMakeDataManager, doMakeDisplayConventions, doMakeIdvChooserManager, doMakeIdvProjectionManager, doMakeIdvUIManager, doMakeImageGenerator, doMakeJythonManager, doMakeParamDefaultsEditor, doMakeParamGroupsEditor, doMakePersistenceManager, doMakePluginManager, doMakePreferenceManager, doMakePublishManager, doMakeResourceManager, doMakeStateManager, doMakeStationModelManager, doMakeTestManager, doMakeVMManager, getAliasEditor, getArgsManager, getAutoDisplayEditor, getCollabManager, getColorProperty, getColorTableEditor, getColorTableManager, getDataManager, getDisplayConventions, getIdv, getIdvChooserManager, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getJythonManager, getObjectStore, getParamDefaultsEditor, getParamGroupsEditor, getPersistenceManager, getPluginManager, getPreference, getPreference, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getTestManager, getVMManager, haveCollabManager, initFromXml, makeManager, setIdv, showAliasEditor, showAutoDisplayEditor, showChooser, showChooserModal, showColorTableEditor, showColorTableEditor, showDefaultsEditor, showIdvProjectionManager, showParamGroupsEditor, showPreferenceManager, showStationModelEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

displayControls

protected List displayControls
List of all of the DisplayControls currently active


controlDescriptors

protected List controlDescriptors
List of the ControlDescriptors defined in the controls.xml file


controlDescriptorMap

protected Hashtable controlDescriptorMap
Mapping from control descriptor id to ControlDescriptor

Constructor Detail

IntegratedDataViewer

public IntegratedDataViewer()
                     throws VisADException,
                            RemoteException
Parameterless constructor. Not sure if this is needed. Perhaps it is needed for the XmlEncoder encoding?

Throws:
VisADException - from construction of VisAd objects
RemoteException - from construction of VisAD objects

IntegratedDataViewer

public IntegratedDataViewer(String[] args)
                     throws VisADException,
                            RemoteException
The main constructor. After the dervied class is created then the init() method should be called. We have the derived class call init so that the object has been fully instantiated when init is called.

Parameters:
args - The command line arguments
Throws:
VisADException - from construction of VisAd objects
RemoteException - from construction of VisAD objects

IntegratedDataViewer

public IntegratedDataViewer(boolean interactiveMode)
                     throws VisADException,
                            RemoteException
Ctor for when some other code is calling us. eg: creating an image

Parameters:
interactiveMode - Is interactive
Throws:
RemoteException - On badness
VisADException - On badness

IntegratedDataViewer

public IntegratedDataViewer(String[] args,
                            boolean interactiveMode)
                     throws VisADException,
                            RemoteException
ctor

Parameters:
args - cmd line args
interactiveMode - Are we interactive mode. Normally we are, including when running an isl. However, we use this flag when code from some jvm calls us directly. eg: when generating an image.
Throws:
RemoteException - On badness
VisADException - On badness
Method Detail

getInteractiveMode

public boolean getInteractiveMode()
Are we interactive

Returns:
is interactive

checkSystem

protected void checkSystem()
Check whether the system has the necessary components (ex: Java 3D). Subclasses can override.


waitUntilDisplaysAreDone

public void waitUntilDisplaysAreDone()
Wait until the displays have been rendered


init

protected final void init()
This is a wrapper that calls initInner within a thread.