Class AddeChooser

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ucar.unidata.ui.ChooserPanel
ucar.unidata.idv.chooser.IdvChooser
ucar.unidata.idv.chooser.TimesChooser
ucar.unidata.idv.chooser.adde.AddeChooser
edu.wisc.ssec.mcidasv.chooser.adde.AddeChooser
All Implemented Interfaces:
Constants, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ucar.unidata.idv.IdvConstants
Direct Known Subclasses:
AddeFrontChooser, AddeImageChooser, AddePointDataChooser, PolarOrbitTrackChooser

public class AddeChooser extends ucar.unidata.idv.chooser.adde.AddeChooser implements Constants
Version:
$Revision$
See Also:
  • Field Details

  • Constructor Details

    • AddeChooser

      public AddeChooser(ucar.unidata.idv.chooser.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()
      Force a reload of the available servers and groups.
      Overrides:
      updateServerList in class ucar.unidata.idv.chooser.adde.AddeChooser
    • getAccounting

      protected Map<String,String> getAccounting(String server, String group)
      Returns a Map containing user and proj keys for the given server/group combination.

      The values are either the specific ADDE account details for server/group or DEFAULT_ACCOUNT values.

      Parameters:
      server - Server name. Should not be null.
      group - Group name on name. Should not be null.
      Returns:
      Map containing the accounting details for server/group.
    • getAccounting

      protected Map<String,String> getAccounting(ucar.unidata.idv.chooser.adde.AddeServer server, String group)
      Returns a Map containing user and proj keys for the given server/group combination.

      The values are either the specific ADDE account details for server/group or DEFAULT_ACCOUNT values.

      Parameters:
      server - Server name. Should not be null.
      group - Group name on name. Should not be null.
      Returns:
      Map containing the accounting details for server/group.
    • getManagedServers

      private List<ucar.unidata.idv.chooser.adde.AddeServer> getManagedServers(String type)
    • getFormatFromDescriptor

      Query the server manager to determine the "format" used by a given descriptor.
      Parameters:
      descriptor - Local ADDE descriptor to check. Value can be null.
      Returns:
      Either the format associated with the given descriptor or LocalAddeEntry.AddeFormat.INVALID.
    • formatRequiresAbsolute

      Determine whether or not the specified format requires use of the absolute times tab.

      Thus far, only LocalAddeEntry.AddeFormat.SCMI needs this treatment.

      Parameters:
      format - Local ADDE "format" to check.
      Returns:
      Whether or not format should use only the absolute times tab.
    • updateServers

      public void updateServers()
    • containsServerName

      protected static boolean containsServerName(List<ucar.unidata.idv.chooser.adde.AddeServer> servers, Object server)
      Searches the given List of AddeServers for server.
      Parameters:
      servers - Servers to search. null is permitted.
      server - Server to search for within servers. null is permitted.
      Returns:
      true if servers contains server or false otherwise.
    • containsGroupName

      protected static boolean containsGroupName(List<ucar.unidata.idv.chooser.adde.AddeServer.Group> groups, Object group)
      Searches the given List of Groups for group.
      Parameters:
      groups - Groups to search. null is permitted.
      group - Group to search for within group. null is permitted.
      Returns:
      true if groups contains group or false otherwise.
    • updateGroups

      public void updateGroups()
      Sort the groups alphabetically
    • loadServerState

      protected void loadServerState()
      Load any saved server state
      Overrides:
      loadServerState in class ucar.unidata.idv.chooser.adde.AddeChooser
    • isSeparator

      protected static boolean isSeparator(ucar.unidata.idv.chooser.adde.AddeServer checkServer)
      Decide if the server you're asking about is actually a separator
    • isLocalServer

      protected boolean isLocalServer()
      Decide if the server you're asking about is local
    • isLocalServer

      protected static boolean isLocalServer(ucar.unidata.idv.chooser.adde.AddeServer checkServer)
    • setBadServer

      private void setBadServer(String name, String group)
    • isBadServer

      private boolean isBadServer(String name, String group)
    • setLastServer

      private void setLastServer(String name, String group, ucar.unidata.idv.chooser.adde.AddeServer server)
    • isLastServer

      private boolean isLastServer(String name, String group)
    • onServerManagerDataEvent

    • onServerManagerWindowEvent

    • getSelectorIndex

      protected static int getSelectorIndex(Object needle, JComboBox haystack)
      Search a given JComboBox for the index of a given object. Mostly useful for searching serverSelector or AddeChooser.groupSelector.
      Parameters:
      needle - An object. null values are permitted.
      haystack - JComboBox to search. null values are permitted, but return -1.
      Returns:
      Either the index of needle within haystack, or -1 if needle could not be found (or haystack is null).
    • getAddeServer

      protected ucar.unidata.idv.chooser.adde.AddeServer getAddeServer()
      Get the selected AddeServer
      Returns:
      the server or null
    • addDescComp

      protected JComponent addDescComp(JComponent comp)
      A utility to add a component to the list of components that need the descriptor
      Parameters:
      comp - The component
      Returns:
      The component
    • setSelectString

      protected void setSelectString(String string)
      Set LABEL_SELECT from elsewhere
    • resetDescriptorBox

      protected void resetDescriptorBox()
      Reset the descriptor stuff
    • handleConnect

      public void handleConnect() throws Exception
      Handle when the user presses the connect button
      Overrides:
      handleConnect in class ucar.unidata.idv.chooser.adde.AddeChooser
      Throws:
      Exception - On badness
    • handleConnectionError

      protected void handleConnectionError(Exception e)
      Show the user a descriptive error message in a dialog (if in foreground mode) depending on the state of e.
      Overrides:
      handleConnectionError in class ucar.unidata.idv.chooser.adde.AddeChooser
      Parameters:
      e - Exception to handle. Cannot be null.
      Throws:
      NullPointerException - if e is null.
      See Also:
    • handleConnectionError

      protected void handleConnectionError(String details, Exception e)
      Show the user a descriptive error message (with optional details) in a dialog.
      Parameters:
      details - Details about the context of e. null will be treated as an empty String.
      e - Exception to handle. Cannot be null.
      Throws:
      NullPointerException - if e is null.
    • handleUnknownDataSetError

      protected void handleUnknownDataSetError()
      Handle unknown data set error
      Overrides:
      handleUnknownDataSetError in class ucar.unidata.idv.chooser.adde.AddeChooser
    • actionPerformed

      public void actionPerformed(ActionEvent ae)
      Handle the event
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class ucar.unidata.idv.chooser.adde.AddeChooser
      Parameters:
      ae - The event
    • doManager

      public void doManager()
      Go directly to the Server Manager
    • doParameters

      public void doParameters()
      Show the parameter restore tree
    • getPopupSubMenuForParameterSet

    • makeMenuRecursive

      private JMenu makeMenuRecursive(JMenu rootMenu, List<String> menuNames)
      Make a new recursive menu
      Parameters:
      rootMenu - The root menu to add items to
      menuNames - List of string names for submenus
      Returns:
      A new JMenu representing the leaf
    • mergeMenuNames

      private JMenu mergeMenuNames(JMenu thisMenu, List<String> menuNames)
      Recurse into a menu, returning either a pointer to the designated names path or a pointer to the leaf menu added by merging new names
      Parameters:
      thisMenu - The root menu to merge
      menuNames - List of string names to look for
      Returns:
      A new JMenu representing the leaf matched by menuNames
    • getParameterSetType

      Return the parameter type associated with this chooser. Override!
    • showParameterSetDialog

      private void showParameterSetDialog(String parameterSetType)
      Show the parameter set manager.
    • clearParameterSet

      protected void clearParameterSet()
      Clear the selected parameter set.
    • restoreParameterSet

      protected boolean restoreParameterSet(Element restoreElement)
      Restore the selected parameter set using element attributes.
      Parameters:
      restoreElement - Element with the desired attributes. null values are permitted.
      Returns:
      true if the parameter set was restored, false otherwise.
    • setAbsoluteTimes

      protected void setAbsoluteTimes(List times)
      Set the absolute times list. The times list can contain any of the object types that makeDatedObjects knows how to handle, i.e., Date, visad.DateTime, DatedThing, AddeImageDescriptor, etc.
      Overrides:
      setAbsoluteTimes in class ucar.unidata.idv.chooser.TimesChooser
      Parameters:
      times - List of thinggs to put into absolute times list
    • restoreAbsoluteTimes

      protected void restoreAbsoluteTimes()
    • showParameterButton

      public void showParameterButton()
      show/hide the parameter restore button
    • hideParameterButton

      public void hideParameterButton()
    • setHaveData

      public void setHaveData(boolean have)
      Override and simulate clicking Add Source if requested
      Overrides:
      setHaveData in class ucar.unidata.ui.ChooserPanel
    • doClickLoad

      public void doClickLoad()
    • showServers

      public void showServers()
    • getStateString

      protected String getStateString()
    • updateStatus

      protected void updateStatus()
      Disable/enable any components that depend on the server. Try to update the status label with what we know here.
      Overrides:
      updateStatus in class ucar.unidata.idv.chooser.adde.AddeChooser
    • getDataType

      public String getDataType()
      Get the data type ID
      Overrides:
      getDataType in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      the data type
    • checkIfServerIsOk

      protected int checkIfServerIsOk()
      Check if the server is ok
      Overrides:
      checkIfServerIsOk in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      status code
    • canAccessServer

      public boolean canAccessServer()
      Description copied from class: ucar.unidata.idv.chooser.adde.AddeChooser
      This method checks if the current server is valid. If it is valid then it checks if there is authentication required
      Overrides:
      canAccessServer in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      true if the server exists and can be accessed
    • getAccountingInfo

    • saveServerState

      public void saveServerState()
      Saves the currently selected server and group to a chooser-specific preference. Preference ID is PREF_SERVERSTATE+'.'+getId().
      Overrides:
      saveServerState in class ucar.unidata.idv.chooser.adde.AddeChooser
    • connectToServer

      protected void connectToServer()
      Connect to the server.
    • readFromServer

      protected void readFromServer()
      Do server connection stuff... override this with type-specific methods
    • readDescriptors

      protected void readDescriptors()
      Generate a list of image descriptors for the descriptor list.
    • setDescriptors

      protected void setDescriptors(String[] names)
      Initialize the descriptor list from a list of names
      Parameters:
      names - list of names
    • descriptorChanged

      protected void descriptorChanged()
      Respond to a change in the descriptor list.
    • haveDescriptorSelected

      protected boolean haveDescriptorSelected()
      Check if a descriptor (image type) has been chosen
      Returns:
      true if an image type has been chosen
    • getDescriptor

      protected String getDescriptor()
      Get the selected descriptor.
      Returns:
      the currently selected descriptor.
    • getDescriptorFromSelection

      protected String getDescriptorFromSelection(String selection)
      Get the descriptor relating to the selection.
      Parameters:
      selection - String name from the widget. Can be null.
      Returns:
      Either the descriptor associated with selection or null if descriptorTable or selection is null.
    • getSelectedDescriptor

      Get the selected descriptor.
      Returns:
      the selected descriptor
    • getSelectedIndex

      public int getSelectedIndex()
    • setBoxAtIndex

      public void setBoxAtIndex(int idx)
    • getDescriptorTable

      Get the descriptor table for this chooser
      Returns:
      a Hashtable of descriptors and names
    • appendMiscKeyValues

      protected void appendMiscKeyValues(StringBuffer buff)
      Get any extra key=value pairs that are appended to all requests.
      Overrides:
      appendMiscKeyValues in class ucar.unidata.idv.chooser.adde.AddeChooser
      Parameters:
      buff - The buffer to append onto
    • getPort

      protected String getPort()
      Return the ADDE port to use.

      Overridden by McIDAS-V because "local ADDE" requires us to use essentially arbitrary port numbers, so for local ADDE connections we need to use EntryStore.getLocalPort().

      Overrides:
      getPort in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      ADDE port to use.
    • getLastAddedUser

    • getLastAddedProj

    • showGroups

      public void showGroups()
      Show the groups dialog. This method is not meant to be called but is public by reason of implementation (or insanity).
    • getServer

      public String getServer()
      return the String id of the chosen server name
      Overrides:
      getServer in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      the server name
    • getGroup

      protected String getGroup()
      Description copied from class: ucar.unidata.idv.chooser.adde.AddeChooser
      Get the image group from the gui.
      Overrides:
      getGroup in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      The iamge group.
    • isGroupEditable

      protected boolean isGroupEditable()
      Is the group selector editable?
      Returns:
      Always returns true.
    • getGroup

      protected String getGroup(boolean fromGetServer)
      Get the image group from the GUI.
      Returns:
      The image group.
    • getServerSelector

      Get the server selector
      Overrides:
      getServerSelector in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      The server selector
    • enableWidgets

      protected void enableWidgets()
      Enable or disable the GUI widgets based on what has been selected.
      Overrides:
      enableWidgets in class ucar.unidata.idv.chooser.adde.AddeChooser
    • clearOnChange

      protected void clearOnChange(JComboBox box)
      Add a listener to the given combobox that will set the state to unconnected
      Overrides:
      clearOnChange in class ucar.unidata.idv.chooser.adde.AddeChooser
      Parameters:
      box - The box to listen to.
    • getDescriptorLabel

      Get the descriptor widget label
      Returns:
      label for the descriptor widget
    • getNumTimesToSelect

      protected int getNumTimesToSelect()
      Description copied from class: ucar.unidata.idv.chooser.TimesChooser
      Get the number of times to select
      Overrides:
      getNumTimesToSelect in class ucar.unidata.idv.chooser.TimesChooser
      Returns:
      the number
    • getDefaultRelativeTimeIndex

      protected int getDefaultRelativeTimeIndex()
      Get the default selected index for the relative times list.
      Overrides:
      getDefaultRelativeTimeIndex in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      default index
    • checkTimesLists

      protected void checkTimesLists()
      Check the times lists
      Overrides:
      checkTimesLists in class ucar.unidata.idv.chooser.TimesChooser
    • makeTimesPanel

      protected JPanel makeTimesPanel(JComponent relativeCard, JComponent absoluteCard)
      Set the relative and absolute extra components.
    • setStatus

      public void setStatus(String statusString, String foo)
      Super setStatus() takes a second string to enable "simple" mode which highlights the required component. We don't really care about that feature, and we don't want getStatusLabel() to change the label background color.
      Overrides:
      setStatus in class ucar.unidata.ui.ChooserPanel
    • setInnerPanel

      protected void setInnerPanel(JPanel newInnerPanel)
    • getRelativeTimesChooser

      Create the widget responsible for handling relative time selection.
      Overrides:
      getRelativeTimesChooser in class ucar.unidata.idv.chooser.TimesChooser
      Returns:
      GUI widget.
    • validateRelativeTimeInput

      private void validateRelativeTimeInput(String text)
      Validate the contents of the relative times text field.

      This method overwrites relativeTimes if text is an integer greater than zero.

      Parameters:
      text - Contents of the text field.
    • handleRelativeTimeChange

      Handle DocumentListener events for the JTextField created by getRelativeTimesChooser().
      Parameters:
      event - Event to handle. Cannot be null.
    • getRelativeTimeIndices

      public int[] getRelativeTimeIndices()
      Get the relative time indices
      Overrides:
      getRelativeTimeIndices in class ucar.unidata.idv.chooser.TimesChooser
      Returns:
      an array of indices
    • doMakeContents

      Make the UI for this selector. Thank you NetBeans for helping with the layout!
      Overrides:
      doMakeContents in class ucar.unidata.ui.ChooserPanel
      Returns:
      The GUI.