Class XmlChooser

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, IdvConstants

public class XmlChooser extends IdvChooser implements ActionListener
This handles a variety of flavors of xml documents (e.g., thredds query capability, thredds catalogs, idv menus) to create data choosers from. It provides a combobox to enter urls to xml documents. It retrieves the xml and creates a XmlHandler based on the type of xml. Currently this class handles two types of xml: Thredds catalog and Web Map Server (WMS) capability documents. The XmlHandler does most of the work.

This class maintains the different xml docs the user has gone to coupled with the XmlHandler for each doc. It uses this list to support navigating back and forth through the history of documents.

Version:
$Revision: 1.80 $Date: 2007/07/09 22:59:58 $
Author:
IDV development team
See Also:
  • Field Details

    • PROP_CHOOSER_URL

      public static final String PROP_CHOOSER_URL
      _more_
      See Also:
    • TAG_ERROR

      public static final String TAG_ERROR
      If there was some error in loading the xml we construct and xml document with the error tag and popup the message in the GUI
      See Also:
    • ATTR_URL

      public static final String ATTR_URL
      The xml attr name for any initial url from the choosers.xml segment that created this chooser
      See Also:
    • timestamp

      protected int timestamp
      Keeps track of the outstanding url request
  • Constructor Details

    • XmlChooser

      public XmlChooser(IdvChooserManager mgr, Element root)
      Create the XmlChooser
      Parameters:
      mgr - The IdvChooserManager
      root - The xml root that defines this chooser
  • Method Details

    • setDataSource

      public void setDataSource(DataSource dataSource)
      _more_
      Overrides:
      setDataSource in class IdvChooser
      Parameters:
      dataSource - _more_
    • updateStatus

      protected void updateStatus()
      _more_
      Overrides:
      updateStatus in class IdvChooser
    • setHaveData

      public void setHaveData(boolean have)
      _more_
      Overrides:
      setHaveData in class ChooserPanel
      Parameters:
      have - _more_
    • shouldDoUpdateOnFirstDisplay

      protected boolean shouldDoUpdateOnFirstDisplay()
      Overwrite base class method to do the update on first display.
      Overrides:
      shouldDoUpdateOnFirstDisplay in class IdvChooser
      Returns:
      Return true. We do want to do an update on initial display.
    • actionPerformed

      public void actionPerformed(ActionEvent ae)
      Handle any Gui actions.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class ChooserPanel
      Parameters:
      ae - The ActionEvent.
    • initSubProperties

      public void initSubProperties(Hashtable properties)
      _more_
      Parameters:
      properties - _more_
    • makeDataSource

      protected boolean makeDataSource(Object definingObject, String dataType, Hashtable properties)
      _more_
      Overrides:
      makeDataSource in class IdvChooser
      Parameters:
      definingObject - _more_
      dataType - _more_
      properties - _more_
      Returns:
      _more_
    • doMakeContents

      protected JComponent doMakeContents()
      Create and return the Gui contents.
      Overrides:
      doMakeContents in class ChooserPanel
      Returns:
      The gui contents.
    • makeUiFromPath

      public boolean makeUiFromPath(String xmlPath)
      Load the xml defined by the given xmlPath. Try to create a display from it.
      Parameters:
      xmlPath - The url pointing to the xml to display.
      Returns:
      Was this successful
    • makeUiFromPath

      public boolean makeUiFromPath(String xmlPath, int myTimestamp)
      Load the xml defined by the given xmlPath. Try to create a display from it.
      Parameters:
      xmlPath - The url pointing to the xml to display.
      myTimestamp - Keeps track of which request this is.
      Returns:
      Was this successful
    • makeUi

      protected void makeUi(Document doc, Element xmlRoot, String path)
      Generate a user interface from the given xml document (derived from the given path). The xml can be a thredds query capability, any verion of a thredds catalog or an IDV menus xml file.
      Parameters:
      doc - the xml document
      xmlRoot - The root of the xml document to create a display for.
      path - The url path we got the xml from.
    • goBack

      public void goBack()
      Go back and display the previous document.
    • goForward

      public void goForward()
      Go forward and display the next document in the history list.
    • handleAction

      protected void handleAction(String action)
      A wrapper around @see{handleAction}, passing in an empty properties table.
      Parameters:
      action - The String action (Url, Idv command, etc.) to handle.
    • handleAction

      protected void handleAction(String action, Hashtable properties)
      Process the given action (e.g., url, idv command) with the given properties. This just creates a new PropertiedAction, adds it to a list and turns around and calls the handleActions method.
      Parameters:
      action - The String action (Url, Idv command, etc.) to handle.
      properties - The properties for this action.
    • handleActions

      protected void handleActions(List actions)
      Process the given list of XmlChooser.PropertiedActions.
      Parameters:
      actions - The list of actions to process
    • handleActionsInThread

      protected void handleActionsInThread(List actions)
      Actually does the work of handling the actions
      Parameters:
      actions - List of PropertiedActions
    • doUpdate

      public void doUpdate()
      Reload the current xml and update the display.
      Overrides:
      doUpdate in class ChooserPanel
    • doUpdateInner

      public void doUpdateInner()
      Reload the current xml and update the display.
    • doLoadInThread

      public void doLoadInThread()
      Load the currently selected xml element.
      Overrides:
      doLoadInThread in class ChooserPanel
    • getXml

      public String getXml()
      Get the xml
      Returns:
      The xml
    • getDocument

      public Document getDocument()
      Get the xml doc
      Returns:
      The xml doc