Class AddeChooser

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, IdvConstants
Direct Known Subclasses:
AddeFrontChooser, AddeImageChooser, AddePointDataChooser, AddeProfilerDataChooser

public class AddeChooser extends TimesChooser
Version:
$Revision: 1.8 $
Author:
Unidata IDV Development Team
See Also:
  • Field Details

  • Constructor Details

    • AddeChooser

      public AddeChooser(IdvChooserManager mgr, Element root)
      Create an AddeChooser associated with an IdvChooser
      Parameters:
      mgr - The chooser manager
      root - The chooser.xml node
  • Method Details

    • updateServerList

      public void updateServerList()
      Reload the list of servers if they have changed
    • getGroupType

      protected String getGroupType()
      get the adde server grup type to use
      Returns:
      group type
    • removeGroup

      public void removeGroup(AddeServer.Group group)
      Remove the group from the global list
      Parameters:
      group - the group
    • removeServer

      public void removeServer(AddeServer server)
      Remove the server
      Parameters:
      server - server to remove
    • setGroups

      protected void setGroups()
      Set the group list
    • clearOnChange

      protected void clearOnChange(JComboBox box)
      Add a listener to the given combobox that will set the state to unconnected
      Parameters:
      box - The box to listen to.
    • handleConnect

      public void handleConnect() throws Exception
      Handle when the user presses the connect button
      Throws:
      Exception - On badness
    • handleUpdate

      public void handleUpdate() throws Exception
      Handle when the user presses the update button
      Throws:
      Exception - On badness
    • handleConnectFromThread

      public void handleConnectFromThread()
      Handle when the user presses the connect button.
    • handleUpdateFromThread

      public void handleUpdateFromThread()
      Handle when the user presses the update button
    • doConnect

      protected final void doConnect()
      Connect to the server. Call handleConnect in a thread
    • doUpdate

      public final void doUpdate()
      Update the selector. Call handleUpdate in a thread
      Overrides:
      doUpdate in class ChooserPanel
    • actionPerformed

      public void actionPerformed(ActionEvent ae)
      Handle the event
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class ChooserPanel
      Parameters:
      ae - The event
    • getDefaultServerSelection

      protected String[] getDefaultServerSelection()
      Return either the user's last selected server and group for a given ADDE chooser, or check idv.properties if no selection exists.
      Returns:
      Array of two strings. First value is the server, and the second is the group. null signifies that there was no "last" selection as well as no default selection.
    • loadServerState

      protected void loadServerState()
      Load any saved server state
    • saveServerState

      public void saveServerState()
      Save the server state
    • addTopComponents

      protected void addTopComponents(List comps, String label, JComponent extra)
      Add to the given comps list all the status line and server components.
      Parameters:
      comps - List of comps to add to
      label - The label to add after the server selector
      extra - The component to add after the label (usually a combobox)
    • addTopComponents

      protected void addTopComponents(List comps, Component extra)
      Add to the given comps list all the status line and server components.
      Parameters:
      comps - List of comps to add to
      extra - The components after the server box if non-null.
    • updateStatus

      protected void updateStatus()
      Disable/enable any components that depend on the server. Try to update the status labelwith what we know here.
      Overrides:
      updateStatus in class TimesChooser
    • getDataName

      public String getDataName()
      This allows derived classes to provide their own name for labeling, etc.
      Returns:
      the dataset name
    • getDataSetName

      public String getDataSetName()
      This allows derived classes to provide their own name for the dataset.
      Returns:
      the dataset name
    • getDataType

      public String getDataType()
      Get the data type ID
      Returns:
      the data type
    • getLoadToolTip

      protected String getLoadToolTip()
      Get the tooltip for the load button
      Overrides:
      getLoadToolTip in class ChooserPanel
      Returns:
      The tooltip for the load button
    • getServer

      public String getServer()
      return the String id of the chosen server name
      Returns:
      the server name
    • getGroup

      protected String getGroup()
      Get the image group from the gui.
      Returns:
      The iamge group.
    • getServerSelector

      public JComboBox getServerSelector()
      Get the server selector
      Returns:
      The server selector
    • readTextLines

      protected List readTextLines(String url)
      Read the adde text url and return the lines of text. If unsuccessful return null.
      Parameters:
      url - adde url to a text file
      Returns:
      List of lines or null if in error
    • readGroups

      protected List readGroups()
      Read the groups from the public.srv file on the server
      Returns:
      List of groups
    • handleUnknownDataSetError

      protected void handleUnknownDataSetError()
      Handle unknown data set error
    • handleConnectionError

      protected void handleConnectionError(Exception excp)
      Show the given error to the user. If it was an Adde exception that was a bad server error then print out a nice message.
      Parameters:
      excp - The exception
    • setState

      protected void setState(int newState)
      Set the current state. This also triggers a status update
      Parameters:
      newState - The new state
    • getState

      protected int getState()
      Get the state
      Returns:
      The state
    • addServerComp

      protected JComponent addServerComp(JComponent comp)
      Add the given component to the list of components that depend on a connection.
      Parameters:
      comp - The component
      Returns:
      The same component
    • canDoCancel

      public boolean canDoCancel()
      Can we do a cancel
      Returns:
      true if we can
    • getConnectButton

      protected JComponent getConnectButton()
      Create the 'Connect' button.
      Returns:
      The connect button.
    • readTimes

      public void readTimes()
      Do what needs to be done to read in the times. Subclasses need to implement this.
      Overrides:
      readTimes in class TimesChooser
    • getGoodToGo

      protected boolean getGoodToGo()
      Are we all set to load data.
      Returns:
      All set to load.
    • appendKeyValue

      protected void appendKeyValue(StringBuffer buf, String name, String value)
      A utility method to make a name=value part of the adde request string
      Parameters:
      buf - The buffer to append to
      name - The property name
      value - The value
    • checkIfServerIsOk

      protected int checkIfServerIsOk()
      Check if the server is ok
      Returns:
      status code
    • canAccessServer

      protected boolean canAccessServer()
      This method checks if the current server is valid. If it is valid then it checks if there is authentication required
      Returns:
      true if the server exists and can be accessed
    • getUrl

      protected StringBuffer getUrl(String requestType)
      Create the first part of the ADDE request URL
      Parameters:
      requestType - type of request
      Returns:
      ADDE URL prefix
    • getGroupUrl

      protected StringBuffer getGroupUrl(String requestType, String group)
      Create the first part of the ADDE request url and append the group argument to it
      Parameters:
      requestType - request type
      group - image group
      Returns:
      ADDE URL prefix
    • getPort

      protected String getPort()
      Get the port to use. Check the IDV for an adde.port property. If not null then use the IDV property. Else use DEFAULT_PORT
      Returns:
      the port to use
    • appendMiscKeyValues

      protected void appendMiscKeyValues(StringBuffer buff)
      Get any extra key=value pairs that are appended to all requests.
      Parameters:
      buff - The buffer to append onto
    • getMiscKeyProps

      protected String[] getMiscKeyProps()
      Get the list of properties for the miscellaneous keywords
      Returns:
      list of properties
    • getMiscKeywords

      public String getMiscKeywords()
      Get the miscellaneous URL keywords
      Returns:
      the key value pairs
    • getDefaultRelativeTimeIndex

      protected int getDefaultRelativeTimeIndex()
      Get the default selected index for the relative times list.
      Overrides:
      getDefaultRelativeTimeIndex in class TimesChooser
      Returns:
      default index
    • enableWidgets

      protected void enableWidgets()
      Enable or disable the GUI widgets based on what has been selected.
      Overrides:
      enableWidgets in class TimesChooser