Class IntegratedDataViewer

java.lang.Object
ucar.unidata.idv.IdvBase
ucar.unidata.idv.IntegratedDataViewer
All Implemented Interfaces:
ActionListener, EventListener, HyperlinkListener, DataContext, ControlContext, IdvConstants, IdvContext, ViewContext, LogUtil.DialogManager, XmlPersistable
Direct Known Subclasses:
DefaultIdv, IdvServer.MyIdv, 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:

  • Create the instance of the IDV (e.g., DefaultIdv.main(String[]))
  • The IDV, in its constructor, initializes the property files and command line arguments:
    • Constucts the ArgsManager.
    • Adds the default property file to the ArgsManager list of propertyFiles
    • Calls initPropertyFiles(List) to add in any application specific property file. Properties in files at the end of the list will overwrite properties from files that are in the beginning of the list.
    • Call ArgsManager.parseArgs(). This parses the command line arguments. If your IDV app needs to have its own command line arguments then override the doMakeArgsManager (String[]args) to create your own ArgsManager.
    • Call StateManager.loadProperties() to load in the property files.
  • The derived IDV class calls init, either from its constructor or form the main. We have the derived class call init (as opposed to this class) so that its state is fully initialized when init is called.
Author:
IDV development team
  • Field Details

    • 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 Details

    • 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 Details

    • getServerMode

      public boolean getServerMode()
      See if we are in server mode or not
      Returns:
      true if in server mode
    • 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. That way the gui can get built and displayed, etc.
    • loadDataFiles

      protected void loadDataFiles(List files)
      Load in a datasource for each file/url in the given files list.
      Parameters:
      files - String file or urls
    • initInner

      protected void initInner() throws VisADException, RemoteException
      Build the gui, process bundles, etc.
      Throws:
      VisADException - the VisAD exception
      RemoteException - the remote exception
    • initDone

      public void initDone()
      Gets called when all initialization is finished.
    • startMonitor

      protected void startMonitor()
      Start up the IDV montior server. This is an http server on the port defined by the property idv.monitorport (8788). It provides 2 urls only accessible from localhost: http://localhost:8788/stack.html http://localhost:8788/shutdown.html
    • initCacheManager

      public void initCacheManager()
      Set the state in the cache manager
    • clearCachedData

      protected void clearCachedData()
      This is called when the CacheManager detects the need ot clear memory.
    • getHaveInitialized

      public boolean getHaveInitialized()
      Has this IDV been fully initialized
      Returns:
      Has this idv been initialized
    • okToShowWindows

      public boolean okToShowWindows()
      Is it ok to show any windows. This returns false if we have not been initialized yet or if we are in offscreen mode
      Returns:
      Ok to show windows
    • initPropertyFiles

      public void initPropertyFiles(List files)
      A hook to allow derived classes to add in their own property files.
      Parameters:
      files - A list of file names or urls (String) that point to the property files that are to be loaded in. Properties from later files in the list overwrite properties from earlier files.
    • registerHelpKey

      public void registerHelpKey(JComponent comp, String helpId)
      Register a help key for a component
      Parameters:
      comp - component
      helpId - the help id for that component
    • makeHelpButton

      public JComponent makeHelpButton(String helpId)
      Make a help button for a particular help topic
      Parameters:
      helpId - the id of the topic
      Returns:
      the component
    • makeHelpButton

      public JComponent makeHelpButton(String helpId, String toolTip)
      Make a help button for a particular help topic
      Parameters:
      helpId - the topic id
      toolTip - the tooltip
      Returns:
      the button
    • loadRbiFile

      public void loadRbiFile(String filename)
      Sometime we will be able to dynamically load in a rbi file (resource bundle)
      Parameters:
      filename - The rbi file.
    • getLocationList

      public List getLocationList()
      Create (if null) and return the list NamedStationTable-s defined by the locationResources XmlResourceCollection.
      Specified by:
      getLocationList in interface ControlContext
      Returns:
      The list of NamedStationTables
    • getProjections

      protected List getProjections()
      Return the list of Projections
      Returns:
      The list of Projections
    • addControlDescriptor

      protected void addControlDescriptor(ControlDescriptor cd)
      Add a new ControlDescriptor into the controlDescriptor list and controlDescriptorMap hashtable. Only add this in if we do not already have one loaded with the same id
      Parameters:
      cd - The ControlDescriptor to add
    • initPreferences

      protected void initPreferences(IdvPreferenceManager preferenceManager)
      Add into the IdvPreferenceManager the different gui components/preference managers
      Parameters:
      preferenceManager - The preferenceManager to initialize
    • createDataSelector

      public DataSelector createDataSelector()
      Create a DataSelector window.
      Returns:
      the new DataSelector window.
    • selectDataChoice

      public DataChoice selectDataChoice(ControlDescriptor descriptor)
      Popup a dialog containing a DataTree showing the DataChoices that are applicable to the given ControlDescriptor. Return the select data choice.
      Parameters:
      descriptor - The ControlDescriptor to select a DataChoice for.
      Returns:
      The selected DataChoice or null if none selected.
    • selectDataChoices

      public 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.
      Specified by:
      selectDataChoices in interface DataContext
      Parameters:
      fullParamNames - List of String names representing the operands or parameters that are to be chosen.
      Returns:
      List of selected DataChoices
    • selectUserChoices

      public 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. This is a pass through to (String,List)
      Specified by:
      selectUserChoices in interface DataContext
      Parameters:
      msg - The message to display in the GUI
      userChoices - List of Strings, one for each value
      Returns:
      List of Strings the user entered or null if they cancelled
    • dataSourceChanged

      public void dataSourceChanged(DataSource source)
      Implementation of the DataContext method. This method gets called when something changed in the data source. It just acts as a pass through to the IdvUIManager that updates any user interfaces.
      Specified by:
      dataSourceChanged in interface DataContext
      Parameters:
      source - The data source that changed
    • evaluateAndSave

      public void evaluateAndSave(DataChoice dataChoice)
      Evalute the data choice and then save it off in a CacheDataSource
      Parameters:
      dataChoice - The data chocie to evaluate
    • saveInCache

      public void saveInCache(DataChoice dataChoice, Data data)
      Clone the data choice and then save it off in a CacheDataSource
      Parameters:
      dataChoice - The data choice to save
      data - The data
    • saveInCache

      public void saveInCache(DataChoice dataChoice, Data data, DataSelection dataSelection)
      Save the given data in the CacheDataSource
      Parameters:
      dataChoice - data choice
      data - data
      dataSelection - data selection
    • saveInCache

      public void saveInCache(DataChoice dataChoice, Data data, String name)
      Clone the data choice and then save it off in a CacheDataSource
      Parameters:
      dataChoice - The data choice to save
      data - The data
      name - The name to use
    • saveInCache

      public void saveInCache(DataChoice dataChoice, Data data, DataSelection dataSelection, String name)
      Clone the data choice and then save it off in a CacheDataSource
      Parameters:
      dataChoice - The data choice to save
      data - The data
      dataSelection - data selection
      name - The name to use
    • getDerivedDataChoices

      public List getDerivedDataChoices(DataSource dataSource, List dataChoices)
      Get the list of derived data choices
      Parameters:
      dataSource - data source
      dataChoices - data choices
      Returns:
      derived data choices
    • doMakeDataChoiceMenu

      public JMenu doMakeDataChoiceMenu(DataChoice dataChoice)
      Make and return the menu of commands that can be applied to the given DataChoice. Just a pass through to the IdvUIManager.doMakeDataChoiceMenu(DataChoice)
      Specified by:
      doMakeDataChoiceMenu in interface ControlContext
      Parameters:
      dataChoice - The data choice to make the menu for
      Returns:
      The menu
    • getViewManagerProperties

      public String getViewManagerProperties()
      Return a String of semi-colon separated name=value pairs that define the default properties for ViewManagers.
      Returns:
      Propery string for when we create a ViewManager
    • createNewWindow

      public void createNewWindow()
      Create a new window containing a new MapViewManager
    • getViewManager

      public ViewManager getViewManager()
      Create, if needed, and return the default 3d view manager
      Returns:
      The view manager
    • getViewManager

      public ViewManager getViewManager(ViewDescriptor viewDescriptor)
      Implementation of the ControlContext interface call. Creates, if needed, and returns the ViewManager that is specified by the given ViewDescriptor
      Specified by:
      getViewManager in interface ControlContext
      Parameters:
      viewDescriptor - Defines the name and type of the ViewManager that is to be found or created.
      Returns:
      Either the existing ViewManager or a new one
    • getViewManager

      public ViewManager getViewManager(ViewDescriptor viewDescriptor, boolean newWindow, String properties)
      Creates, if needed, and returns the ViewManager that is specified by the given ViewDescriptor
      Specified by:
      getViewManager in interface ControlContext
      Parameters:
      viewDescriptor - Defines the name and type of the ViewManager that is to be found or created.
      newWindow - If true we create a new window and add the ViewManager into it
      properties - The properties to pass through to the ViewManager if we are creating a new one.
      Returns:
      Either the existing ViewManager or a new one
    • getAllControlDescriptors

      public List getAllControlDescriptors()
      Return all the ControlDescriptors
      Returns:
      List of ControlDescriptor-s
    • getControlDescriptors

      public List getControlDescriptors()
      This returns the set of ControlDescriptors that can be shown. That is, the control descriptors that the user has chosen to show through the user preferences.
      Returns:
      List of shown control descriptors.
    • getControlDescriptors

      public List getControlDescriptors(boolean includeTemplates)
      This returns the set of ControlDescriptors that can be shown. That is, the control descriptors that the user has chosen to show through the user preferences.
      Parameters:
      includeTemplates - If true then include the display templates
      Returns:
      List of shown control descriptors.
    • getControlDescriptor

      public ControlDescriptor getControlDescriptor(String name)
      Return the ControlDescriptor with the given name, or null if not found.
      Parameters:
      name - ControlDescriptor name to look up
      Returns:
      The ControlDescriptor with the given name or null
    • getDisplayControls

      public List getDisplayControls()
      Return the list of DisplayControls currently active
      Returns:
      List of display controls
    • getAllDisplaysIntialized

      public boolean getAllDisplaysIntialized()
      Have all of the displays been initialixed
      Returns:
      all displays initialized
    • toFront

      public void toFront(DisplayControl control)
      Move the given display control to the front. We simply move the control to the end of the list of display controls.
      Parameters:
      control - The display control
    • controlHasBeenInitialized

      public void controlHasBeenInitialized(DisplayControl control)
      Called by the given DisplayControl when it has been fully initialized.
      Parameters:
      control - The initialized DisplayControl
    • addDisplayControl

      public void addDisplayControl(DisplayControl control)
      Add the given DisplayControl into the list of display controls. Update the user interfaces.
      Specified by:
      addDisplayControl in interface ControlContext
      Parameters:
      control - The new display control
    • removeDisplayControl

      public void removeDisplayControl(DisplayControl control)
      Remove the given DisplayControl from the list of display controls. Update the user interfaces.
      Specified by:
      removeDisplayControl in interface ControlContext
      Parameters:
      control - The removed display control
    • removeAllDisplays

      public void removeAllDisplays()
      Remove all of the displays.
    • removeAllDisplays

      public void removeAllDisplays(boolean payAttentionToCanDoRemoveAll)
      remove all displays
      Parameters:
      payAttentionToCanDoRemoveAll - Remove all
    • hyperlinkUpdate

      public void hyperlinkUpdate(HyperlinkEvent e)
      Implement the hyperlinklistener interface. This gets called code that handles html. It gets the URL from the event and calls handleAction(String,Hashtable).
      Specified by:
      hyperlinkUpdate in interface HyperlinkListener
      Parameters:
      e - The HyperlinkEvent event
    • hyperlinkUpdate

      public void hyperlinkUpdate(HyperlinkEvent e, Hashtable properties)
      Handle the click
      Parameters:
      e - event
      properties - any properties
    • 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.
    • Parameters:
      action - The string action
      properties - any properties
      Returns:
      Was this action handled
    • handleAction

      public boolean handleAction(String action)
      handle action
      Parameters:
      action - action
      Returns:
      handled action
    • handleAction

      public boolean handleAction(String action, Hashtable properties)
      This method tries to handle the given action. The action may be a normal gui action (e.g., jython: or help:) or it may be a description of a datasource. The properties table is used to provide further information about this action.
      Specified by:
      handleAction in interface ControlContext
      Parameters:
      action - The action (file, data source url, etc.)
      properties - Properties to pass to the data source creation
      Returns:
      Was this action handled by this method.
    • handleAction

      public boolean handleAction(String action, Hashtable properties, boolean checkForAlias)
      This method tries to handle the given action. The action may be a normal gui action (e.g., jython: or help:), a file (e.g., test.xidv) or it may be a description of a datasource. The properties table is used to provide further information about this action.
      Parameters:
      action - The action (file, data source url, etc.)
      properties - Properties to pass to the data source creation
      checkForAlias - Data sources can have aliases, (e.g., ETA means a dods url pointing to the latest eta run on a remote server). This flag, if true, has this routine check if the given action is indeed an alias.
      Returns:
      Was this action handled by this method.
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Implementation of the ActionListener interface. This passes the the action command from the given ActionEvent off to the handleAction method.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - The ActionEvent
    • removeDataSource

      public void removeDataSource(DataSource dataSource)
      Remove the data source from the DataManager and from any DataTree-s. Update the data menu in all menu bars.
      Parameters:
      dataSource - The data source to remove
    • removeAllDataSources

      public void removeAllDataSources()
      Remove all current data sources. Update the GUI.
    • reloadAllDataSources

      public void reloadAllDataSources()
      reload all data sources
    • getDataSources

      public List getDataSources()
      Wrapper method around DataManager.getDataSources(). Returns the list of DataSource-s currently being used in the application.
      Specified by:
      getDataSources in interface DataContext
      Returns:
      List of current data sources.
    • getAllDataSources

      public List getAllDataSources()
      Gets all of the data sources. Normally, the method getDataSources, only returns the data sources held by the DataManager. This method also adds the Formula data source into the list.
      Specified by:
      getAllDataSources in interface DataContext
      Returns:
      List of all current data sources.
    • makeOneDataSource

      public 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.
      Parameters:
      definingObject - Defines the data source. e.g., filename, url, list of images
      dataType - Defines the data source type id. From datasources.xml. If null then the data source type is found by checking for a pattern match on the defining object from the patterns in datasources.xml
      properties - Optional properties to pass to the data source. May also contain the data source type id.
      Returns:
      The newly create data source or null if there was a failure.
    • makeDataSource

      public 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.
      Parameters:
      definingObject - Defines the data source. e.g., filename, url, list of images
      dataType - Defines the data source type id. From datasources.xml. If null then the data source type is found by checking for a pattern match on the defining object from the patterns in datasources.xml
      properties - Optional properties to pass to the data source. May also contain the data source type id.
      Returns:
      Was the creation successfull.
    • makeDataSource

      public void makeDataSource(DataSourceDescriptor descriptor)
      Make the data source. This is a data source that does not need urls or files
      Parameters:
      descriptor - descriptor
    • makeDataSource

      public 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.
      Parameters:
      definingObject - Defines the data source. e.g., filename, url, list of images
      dataType - Defines the data source type id. From datasources.xml. If null then the data source type is found by checking for a pattern match on the defining object from the patterns in datasources.xml
      properties - Optional properties to pass to the data source. May also contain the data source type id.
      checkAlias - If true then see if the given definineObject is a data source alias name.
      Returns:
      Was the creation successfull.
    • makeDataSource

      public 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.
      Parameters:
      definingObject - Defines the data source. e.g., filename, url, list of images
      dataType - Defines the data source type id. From datasources.xml. If null then the data source type is found by checking for a pattern match on the defining object from the patterns in datasources.xml
      properties - Optional properties to pass to the data source. May also contain the data source type id.
      checkAlias - If true then see if the given definineObject is a data source alias name.
      displayType - If non-null hten also create this display
      Returns:
      Was the creation successfull.
    • moveHistoryToFront

      public void moveHistoryToFront(History history)
      Move a history to the front of the list
      Parameters:
      history - the history item to move
    • makeDataSourceFromXml

      public DataSourceResults makeDataSourceFromXml(String dataSourceXml)
      This creates a new data source from the xml encoded representation of a persisted data source. It is used in the data source history mechanism.
      Parameters:
      dataSourceXml - The xml encoded data source representation
      Returns:
      The results that hold the new data source.
    • createDataSource

      public DataSourceResults createDataSource(Object definingObject, String dataType, Hashtable properties, boolean checkAlias)
      Create the data source (or data sources) defined by the given definingObject.
      Parameters:
      definingObject - Defines the data source. e.g., filename, url, list of images
      dataType - Defines the data source type id. From datasources.xml. If null then the data source type is found by checking for a pattern match on the defining object from the patterns in datasources.xml
      properties - Optional properties to pass to the data source. May also contain the data source type id.
      checkAlias - If true then see if the given definineObject is a data source alias name.
      Returns:
      List of DataSourceResults that hold the results of this method.
    • selectDataType

      public String selectDataType(Object definingObject)
      Ask the user to select a data type for the given defining object
      Specified by:
      selectDataType in interface DataContext
      Parameters:
      definingObject - The defining object for the data source
      Returns:
      The data type name or null
    • selectDataType

      public String selectDataType(Object definingObject, String message)
      Popup a dialog to allows the user to select data source type
      Specified by:
      selectDataType in interface DataContext
      Parameters:
      definingObject - the object to create the data source with
      message - message to show the user
      Returns:
      Selected data source type or null
    • loadDataSource

      public boolean loadDataSource(DataSource dataSource)
      Load in a DataSource. Called from the DataManager when a new data source has been created or unpersisted.
      Specified by:
      loadDataSource in interface DataContext
      Parameters:
      dataSource - Data source to load in.
      Returns:
      If true then signals that the given data source should be kept around in the list of data sources. False says to not keep it around in the list.
    • getMaxRenderThreadCount

      public int getMaxRenderThreadCount()
      Get the max number of threads to be used when rendering in visad
      Returns:
      max threads for rendering
    • getMaxDataThreadCount

      public int getMaxDataThreadCount()
      Get the max number of threads to be used when reading data
      Returns:
      max threads for reading data
    • getUseTimeDriver

      public boolean getUseTimeDriver()
      Get whether we are using the time driver facility
      Returns:
      true if using time matching
    • createImage

      public 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.
      Parameters:
      imageName - The file name of the image
      dataSourceName - The data source to load (e.g., a filename or url)
      paramName - The parameter to create the display with.
      displayName - The id of the display. From controls.xml
    • createDisplay

      public DisplayControl createDisplay(String dataSourceName, String paramName, String displayName, String properties)
      Create a display from the given datasource/paramname pair.
      Parameters:
      dataSourceName - The data source to load (e.g., a filename or url)
      paramName - The parameter to create the display with.
      displayName - The id of the display. From controls.xml
      properties - Semi-color delimited list of name=value properties to pass to the display.
      Returns:
      The newly created DisplayControl
    • createDisplay

      public DisplayControl createDisplay(String dataSourceName, String paramName, String displayName, String properties, boolean initDisplayInThread)
      Create a display from the given datasource/paramname pair.
      Specified by:
      createDisplay in interface ControlContext
      Parameters:
      dataSourceName - The data source to load (e.g., a filename or url)
      paramName - The parameter to create the display with.
      displayName - The id of the display. From controls.xml
      properties - Semi-color delimited list of name=value properties to pass to the display.
      initDisplayInThread - If true then initialize the display in a separate thread
      Returns:
      The newly created DisplayControl
    • showWindow

      public void showWindow(DisplayControl control, IdvWindow window)
      Implementation of the ControlContext method. If the idv has been initialized then this simply shows the window. If not yet fully initialized then we place this window in a list of windows to be displayed after initialization is done.
      Specified by:
      showWindow in interface ControlContext
      Parameters:
      control - The DisplayControl whose window we should show.
      window - The window
    • getBackgroundImages

      public List getBackgroundImages()
      Get the background images resource
      Returns:
      the resource
    • doMakeBackgroundImage

      public void doMakeBackgroundImage()
      Make the background wms image
    • doMakeControl

      public DisplayControl doMakeControl(DataChoice dataChoice, ControlDescriptor descriptor, String properties)
      Create the DisplayControl, identified by the given ControlDescriptor for the given DataChoice
      Parameters:
      dataChoice - The data choice.
      descriptor - Defines the control to create.
      properties - Semi-colon delimited list of name=value properties to pass to the control.
      Returns:
      The newly create display control or null if it fails.
    • doMakeControl

      public DisplayControl doMakeControl(String controlName)
      This method is called by the helptips, passing in the name of the display control (from controls.xml). It creates DisplayControl without any data.
      Parameters:
      controlName - Id of the display control
      Returns:
      The newly created display control.
    • doMakeControl

      public DisplayControl doMakeControl(String controlName, DataChoice dataChoice)
      make a control
      Parameters:
      controlName - name of control
      dataChoice - with data choice
      Returns:
      control
    • doMakeControl

      public DisplayControl doMakeControl(String controlName, List dataChoices)
      make a control
      Parameters:
      controlName - name of control
      dataChoices - list of data choices
      Returns:
      control
    • doMakeControl

      public DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor)
      Create the DisplayControl, identified by the given ControlDescriptor for the given list of DataChoices
      Parameters:
      dataChoices - The list of data choices.
      descriptor - Defines the control to create.
      Returns:
      The newly create display control or null if it fails.
    • doMakeControl

      public DisplayControl doMakeControl(DataChoice dataChoice, ControlDescriptor descriptor, String properties, DataSelection dataSelection)
      Create the DisplayControl, identified by the given ControlDescriptor for the given DataChoice
      Parameters:
      dataChoice - The data choice.
      descriptor - Defines the control to create.
      properties - Semi-colon delimited list of name=value properties to pass to the control.
      dataSelection - Holds any user specified subsetting of data (e.g., times list).
      Returns:
      The newly create display control or null if it fails.
    • doMakeControl

      public DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor, String propertiesString, DataSelection dataSelection)
      Create the DisplayControl, identified by the given ControlDescriptor for the given list of DataChoices
      Parameters:
      dataChoices - List of data choices.
      descriptor - Defines the control to create.
      propertiesString - Semi-colon delimited list of name=value properties to pass to the control.
      dataSelection - Holds any user specified subsetting of data (e.g., times list).
      Returns:
      The newly create display control or null if it fails.
    • doMakeControl

      public DisplayControl doMakeControl(List dataChoices, ControlDescriptor descriptor, Hashtable properties, DataSelection dataSelection)
      Create the DisplayControl, identified by the given ControlDescriptor for the given list of DataChoices
      Parameters:
      dataChoices - List of data choices.
      descriptor - Defines the control to create.
      properties - Hashtable of properties
      dataSelection - Holds any user specified subsetting of data (e.g., times list).
      Returns:
      The newly create display control or null if it fails.
    • doMakeControl

      public 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
      Parameters:
      dataChoices - List of data choices.
      descriptor - Defines the control to create.
      propertiesString - Semi-colon delimited list of name=value properties to pass to the control.
      dataSelection - Holds any user specified subsetting of data (e.g., times list).
      initDisplayInThread - If true then do the display control initialization in a thread.
      Returns:
      The newly create display control or null if it fails.
    • doMakeControl

      public 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
      Parameters:
      dataChoices - List of data choices.
      descriptor - Defines the control to create.
      properties - Hashtable of properties
      dataSelection - Holds any user specified subsetting of data (e.g., times list).
      initDisplayInThread - If true then do the display control initialization in a thread.
      Returns:
      The newly create display control or null if it fails.
    • encodeObject

      public String encodeObject(Object object, boolean prettyPrint)
      Return the xml representation of the given object. If prettyPrint is true then format the xml with tabs, etc.
      Parameters:
      object - The object to xmlize
      prettyPrint - Should the string xml be formatted
      Returns:
      Xml representation of the given object
    • encodeObject

      public String encodeObject(Object object, boolean prettyPrint, boolean withHeader)
      Return the xml representation of the given object. If prettyPrint is true then format the xml with tabs, etc.
      Parameters:
      object - The object to xmlize
      prettyPrint - Should the string xml be formatted
      withHeader - should we add the XML header
      Returns:
      Xml representation of the given object
    • decodeObject

      public Object decodeObject(String xml) throws Exception
      Create and return the Object defined by the given xml.
      Parameters:
      xml - The xml representation of an object
      Returns:
      The Object
      Throws:
      Exception
    • clearHistoryList

      public void clearHistoryList()
      Empty the history list and write it out.
    • getHistory

      public List getHistory()
      Create, if needed, and return the history list. This is the list of History objects that that define the files and data sources the user has loaded in the past.
      Returns:
      History list
    • addToHistoryList

      public void addToHistoryList(String filename)
      Add the given file to the history list.
      Parameters:
      filename - The file name to add
    • writeHistoryList

      public void writeHistoryList()
      Persist the history list into its own file.
    • addToHistoryList

      public void addToHistoryList(History newHistory)
      Add the given History object into the history list. This also writes out the history list.
      Parameters:
      newHistory - The History object to add.
    • doSaveAs

      public void doSaveAs()
      Have the user select an xidv filename and write the current application state to it. This also sets the current file name and adds the file to the history list.
    • doSave

      public void doSave()
      Save the current state off to the current xidv filename
    • doSaveAsDefault

      public void doSaveAsDefault()
      Called from the menu command to save the current state as the default bundle
    • doOpenDefault

      public void doOpenDefault()
      Called from the menu command to open the default bundle
    • doOpen

      public void doOpen(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
    • getChangeDataPaths

      public boolean getChangeDataPaths()
      Did the user select to change the data paths when loading in a bundle
      Returns:
      change data in loaded bundles
    • getChangeDataPathCbx

      public JCheckBox getChangeDataPathCbx()
      Get the checkbox to show to change data
      Returns:
      change data cbx
    • doOpen

      public void doOpen()
      Have the user select an xidv bundle file, remove all data sources and displays, and then unpersist the bundle.
    • doOpen

      public void doOpen(String bundleUri)
      Load in the given bundle. Check to see if we should also remove the current state.
      Parameters:
      bundleUri - The filename or url of the bundle
    • doImport

      public void doImport()
      Have the user select an xidv bundle file and then unpersist the bundle. This does not remove the existing data sources and displays.
    • doClearDefaults

      public void doClearDefaults()
      Called from the menu command to clear the default bundle
    • getEncoderForRead

      public XmlEncoder getEncoderForRead()
      Create a new XmlEncoder for doing unpersisting.
      Returns:
      The encoder used for reading xml encoded objects
    • getEncoderForWrite

      public XmlEncoder getEncoderForWrite()
      Create a new XmlEncoder for doing persisting.
      Returns:
      The encoder used for writing xml encoded objects
    • getEncoder

      protected XmlEncoder getEncoder()
      Get the XmlEncoder for this instance
      Overrides:
      getEncoder in class IdvBase
      Returns:
      the encoder
    • getEncoder

      protected XmlEncoder getEncoder(boolean forRead)
      Create an XmlEncoder and initialize it with the VisADPersistence delegates.
      Parameters:
      forRead - If true then we initialize the encoder for reading the xml
      Returns:
      The new encoder
    • initEncoder

      protected void initEncoder(XmlEncoder encoder, boolean forRead)
      A hook so derived classes can add their own initialization to the given encoder.
      Parameters:
      encoder - The encoder to initialize
      forRead - If true then we initialize the encoder for reading the xml
    • quit

      public boolean quit()
      Called to end execution of this process. This method must be evoked from the event-dispatching thread. (why?)
      Returns:
      Did the user really want to quit. Of course, if the user did quit then we exit the app and never return true anyway.
    • exit

      protected void exit(int exitCode)
      Exit the application. By default this calls System.exit. However, a custom application could override this method.
      Parameters:
      exitCode - System exit code to use
    • showConsole

      public void showConsole()
      Show the error message console. We have this as a method so it can be called via jython.
    • logException

      public void logException(String msg, Throwable exc)
      Helper method that calls LogUtil.printException
      Parameters:
      msg - The error message
      exc - The exception
    • showWaitCursor

      public void showWaitCursor()
      Specified by:
      showWaitCursor in interface ControlContext
    • showNormalCursor

      public void showNormalCursor()
      Specified by:
      showNormalCursor in interface ControlContext
    • clearWaitCursor

      public void clearWaitCursor()
    • closeCurrentWindow

      public void closeCurrentWindow()
      close current window
    • waitLabelClicked

      public void waitLabelClicked()
      The user clicked on the wait label
    • main

      public static void main(String[] args) throws Exception
      Default main implementation. Just turn around and call DefaultIdv.main.
      Parameters:
      args - Command line arguments.
      Throws:
      Exception - When something bad happends
    • processScript

      public static void processScript(String scriptFile) throws Exception
      Get the image from the given isl script. This is called by other code directly and runs the idv in non-interactive mode
      Parameters:
      scriptFile - The path to the isl script
      Throws:
      Exception - On badness
    • cleanup

      public void cleanup()
      Remove all state, etc.
    • printCache

      public void printCache()
      Call CacheManager.printStats
    • getStaticImage

      protected byte[] getStaticImage(String bundle) throws Exception
      Get image
      Parameters:
      bundle - bundle
      Returns:
      image
      Throws:
      Exception - On badness
    • printCacheStats

      public void printCacheStats()
      Print cache statistics
    • printDataCacheStats

      public void printDataCacheStats()
      Print the data cache stats
    • flushDataCache

      public void flushDataCache()
      Flush the data cache
    • applyPreferences

      public void applyPreferences()
      Apply preferences.
    • runImageServer

      protected void runImageServer(int port, String propertyFile)
      startup and run the image server
      Parameters:
      port - what port to listen on
      propertyFile - properties - may be null
    • addErrorButtons

      public void addErrorButtons(JDialog dialog, List buttonList, String msg, Throwable exc)
      Implement the LogUtil.DialogManager interface to add buttons to the dialog. This adds the 'Support Form' button.
      Specified by:
      addErrorButtons in interface LogUtil.DialogManager
      Parameters:
      dialog - The dialog to add to.
      buttonList - The list of buttons to add my button into.
      msg - The error message
      exc - The exception that had been thrown.
    • listApi

      public String listApi(Object o)
      Utility to list the public api of the given object
      Parameters:
      o - object
      Returns:
      api