Class AddeImageChooser

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
edu.wisc.ssec.mcidasv.chooser.adde.AddeImageChooser
All Implemented Interfaces:
Constants, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ucar.unidata.idv.IdvConstants, ucar.unidata.ui.imagery.ImageSelector
Direct Known Subclasses:
AddeBasicImageChooser, AddeImageParameterChooser, AddeRadarChooser, ImageChooser

public class AddeImageChooser extends AddeChooser implements ucar.unidata.ui.imagery.ImageSelector
Widget to select images from a remote ADDE server Displays a list of the descriptors (names) of the image datasets available for a particular ADDE group on the remote server.
Author:
Don Murray
See Also:
  • Field Details

  • Constructor Details

    • AddeImageChooser

      public AddeImageChooser(ucar.unidata.idv.chooser.IdvChooserManager mgr, Element root)
      Construct an Adde image selection widget
      Parameters:
      mgr - The chooser manager
      root - The chooser.xml node
  • Method Details

    • parseImageCount

      private int parseImageCount()
      Number of absolute times to list in the chooser. Must be a positive integer, or the word "ALL". Will throw up a dialog for invalid entries.
      Returns:
      0 for valid entries, -1 for invalid
    • getImageDefaults

      protected ucar.unidata.xml.XmlResourceCollection getImageDefaults()
      Get the xml resource collection that defines the image default xml
      Returns:
      Image defaults resources
    • updateStatus

      protected void updateStatus()
      Update labels, enable widgets, etc.
      Overrides:
      updateStatus in class AddeChooser
    • timesOk

      public boolean timesOk()
      Do we have times selected. Either we are doing absolute times and there are some selected in the list. Or we are doing relative times and we have done a connect to the server
      Returns:
      Do we have times
    • getAdvancedProps

      protected String[] getAdvancedProps()
      Get the list of advanced property names
      Returns:
      array of advanced property names
    • getAdvancedLabels

      protected String[] getAdvancedLabels()
      Get the list of advanced property labels
      Returns:
      list of advanced property labels
    • logException

      public void logException(String msg, Exception exc)
      Convenience method for lazy people who don't want to call LogUtil.logException(String, Throwable).
      Overrides:
      logException in class ucar.unidata.idv.chooser.IdvChooser
      Parameters:
      msg - log message
      exc - Exception to log
    • getDataName

      public String getDataName()
      This allows derived classes to provide their own name for labeling, etc.
      Overrides:
      getDataName in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      the dataset name
    • getDescriptorLabel

      Get the descriptor widget label
      Overrides:
      getDescriptorLabel in class AddeChooser
      Returns:
      label for the descriptor widget
    • checkSetNav

      protected void checkSetNav()
      Respond to a change in the descriptor list.
    • getDatasetName

      Get the name of the dataset.
      Returns:
      descriptive name of the dataset.
    • canReadTimes

      protected boolean canReadTimes()
      Check if we are ready to read times
      Returns:
      true if times can be read
    • handleUpdate

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

      protected void readFromServer()
      Do server connection stuff... override this with type-specific methods
      Overrides:
      readFromServer in class AddeChooser
    • clearTimesList

      protected void clearTimesList()
      Overwrite base class method to clear out the lastAD member here.
      Overrides:
      clearTimesList in class ucar.unidata.idv.chooser.TimesChooser
    • getArchiveDay

      public void getArchiveDay()
      Show the day and time range dialog. This method is not meant to be called but is public by reason of implementation (or insanity).
    • getBottomComponents

      protected void getBottomComponents(List bottomComps)
      Add the bottom advanced gui panel to the list
      Parameters:
      bottomComps - the bottom components
    • getLockButton

      Get the "lock" button
      Returns:
      the lock button
    • setToFullResolution

      public void setToFullResolution()
      Set to full resolution
    • cyclePlace

      public void cyclePlace()
      Cycle the place
    • changePlace

      public void changePlace(String newPlace)
      Change the place
      Parameters:
      newPlace - new place
    • elementMagSliderChanged

      protected void elementMagSliderChanged(boolean recomputeLineEleRatio)
      _more_
      Parameters:
      recomputeLineEleRatio - _more_
    • lineMagSliderChanged

      protected void lineMagSliderChanged(boolean autoSetSize)
      Handle the line mag slider changed event
      Parameters:
      autoSetSize - _more_
    • getLineMagValue

      protected int getLineMagValue()
      Get the value of the line magnification slider.
      Returns:
      The magnification value for the line
    • getElementMagValue

      protected int getElementMagValue()
      Get the value of the element magnification slider.
      Returns:
      The magnification value for the element
    • absoluteTimesSelectionChanged

      Handle the absolute time selection changing
      Overrides:
      absoluteTimesSelectionChanged in class ucar.unidata.idv.chooser.TimesChooser
    • makeTimesPanel

      protected JPanel makeTimesPanel()
      Set the relative and absolute extra components.
      Overrides:
      makeTimesPanel in class ucar.unidata.idv.chooser.TimesChooser
      Returns:
      the image list panel
    • addPropComp

      protected JComponent addPropComp(String propId, JComponent comp)
      Associates the given JComponent with the PROP_ property identified by the given propId
      Parameters:
      propId - The property
      comp - The gui component that allows the user to set the property
      Returns:
      Just returns the given comp
    • usePropFromUser

      protected boolean usePropFromUser(String propId)
      Should we use the user supplied property
      Parameters:
      propId - The property
      Returns:
      Should use the value from the advanced widget
    • getASelectedTime

      Get one of the selected times.
      Returns:
      One of the selected times.
    • enableWidgets

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

      protected boolean useLatLon()
      Check if we are using the lat/lon widget
      Returns:
      true if we are using the lat/lon widget
    • checkCenterEnabled

      protected void checkCenterEnabled()
      Enable or disable the center lat/lon and line/element widgets
    • getSelectedUnit

      protected String getSelectedUnit()
      Get the selected calibration unit.
      Returns:
      the selected calibration unit
    • getDataType

      public String getDataType()
      Get the data type for this chooser
      Overrides:
      getDataType in class AddeChooser
      Returns:
      the data type
    • getDatasetDescription

      Deprecated.
      use #getDatasetName()
      Get a description of the currently selected dataset
      Returns:
      a description of the currently selected dataset
    • readTimes

      public void readTimes()
      Read the set of image times available for the current server/group/type This method is a wrapper, setting the wait cursor and wrapping the call to readTimesInner(boolean); in a try/catch block
      Overrides:
      readTimes in class ucar.unidata.idv.chooser.adde.AddeChooser
    • readTimes

      public void readTimes(boolean forceAll)
    • doCancel

      public void doCancel()
      _more_
      Overrides:
      doCancel in class ucar.unidata.idv.chooser.IdvChooser
    • readTimesInner

      protected void readTimesInner(boolean forceAll)
      Set the list of dates/times based on the image selection
    • setSelectedTimes

      protected void setSelectedTimes(DateTime[] times)
      Set the selected times in the times list based on the input times
      Overrides:
      setSelectedTimes in class ucar.unidata.idv.chooser.TimesChooser
      Parameters:
      times - Input times.
    • setCenterLocation

      protected void setCenterLocation(ucar.unidata.data.imagery.AddeImageDescriptor aid)
      Set the center location portion of the request. If the input from the widget is null, use the centerpoint from the image descriptor.
      Parameters:
      aid - Image descriptor for the image.
    • getGroupType

      protected String getGroupType()
      get the adde server grup type to use
      Overrides:
      getGroupType in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      group type
    • getGoodToGo

      protected boolean getGoodToGo()
      Does this selector have all of its state set to load in data
      Overrides:
      getGoodToGo in class ucar.unidata.idv.chooser.adde.AddeChooser
      Returns:
      Has the user chosen everything they need to choose to load data
    • getImageList

      public List getImageList()
      Returns a list of the images to load or null if none have been selected.
      Specified by:
      getImageList in interface ucar.unidata.ui.imagery.ImageSelector
      Returns:
      list get the list of image descriptors
    • initializeAddeDefaults

      protected void initializeAddeDefaults()
      Process the image defaults resources
    • getDefault

      protected String getDefault(String property, String dflt)
      Get the default value for a key
      Parameters:
      property - property (key type)
      dflt - default value
      Returns:
      value for key or dflt if not found
    • getSizeString

      Get the image size string from the directory and defaults
      Parameters:
      ad - image directory
      Returns:
      request size
    • checkForValidValues

      protected boolean checkForValidValues()
      Check for valid lat/lon values
      Returns:
      true if values are valid
    • getBaseUrlProps

      protected String[] getBaseUrlProps()
      Get the list of properties for the base URL
      Returns:
      list of properties
    • makeProps

      protected String makeProps(String[] props, AreaDirectory ad)
      A utility that creates the url argument line for the given set of properties.
      Parameters:
      props - The PROP_ properties to make the request string for
      ad - The area directory.
      Returns:
      The adde request string
    • getPropValue

      protected String getPropValue(String prop, AreaDirectory ad)
      Get the value for the given property. This can either be the value supplied by the end user through the advanced GUI or is the default
      Parameters:
      prop - The property
      ad - The AreaDirectory
      Returns:
      The value of the property to use in the request string
    • getUserPropValue

      Get the user supplied property value for the adde request string
      Parameters:
      prop - The property
      ad - The AreaDirectory
      Returns:
      The value, supplied by the user, of the property to use in the request string
    • getDefaultPropValue

      protected String getDefaultPropValue(String prop, AreaDirectory ad, boolean forDisplay)
      Get the default property value for the adde request string
      Parameters:
      prop - The property
      ad - The AreaDirectory
      forDisplay - Is this to display to the user in the gui
      Returns:
      The default of the property to use in the request string
    • setImageInfoProps

      protected void setImageInfoProps(ucar.unidata.data.imagery.AddeImageInfo aii, String[] props, AreaDirectory ad)
      Set the properties on the AddeImageInfo from the list of properties
      Parameters:
      aii - The AddeImageInfo
      props - list of props to set
      ad - The AreaDirectory
    • getSelectedBandName

      Get the name of the selected band
      Returns:
      the name of the band
    • clearPropertiesWidgets

      protected void clearPropertiesWidgets()
      Clear the properties widgets
    • setPropertiesState

      protected void setPropertiesState(AreaDirectory ad)
      Set the widgets with the state from the given AreaDirectory
      Parameters:
      ad - AreaDirectory for the image
    • getSize

      protected int[] getSize(AreaDirectory ad)
      _more_
      Parameters:
      ad - _more_
      Returns:
      _more_
    • setPropertiesState

      protected void setPropertiesState(AreaDirectory ad, boolean force)
      Set the widgets with the state from the given AreaDirectory
      Parameters:
      ad - AreaDirectory for the image
      force - force an update regardless of the previous invocation
    • setMagSliders

      protected void setMagSliders(int lineValue, int elementValue)
      Set the mag slider values
      Parameters:
      lineValue - the line value
      elementValue - the element value
    • getMagValue

      protected int getMagValue(JSlider slider)
      Get the value of the given magnification slider.
      Parameters:
      slider - The slider to get the value from
      Returns:
      The magnification value
    • getPair

      protected String[] getPair(String v)
      Get a pair of properties
      Parameters:
      v - a space separated string
      Returns:
      an array of the two strings
    • getSelectedBand

      protected int getSelectedBand()
      Get the selected band from the advanced chooser
      Returns:
      selected band number
    • translatePlace

      protected String translatePlace(String place)
      Translate a place name into a human readable form
      Parameters:
      place - raw name
      Returns:
      human readable name
    • getBandName

      protected String getBandName(AreaDirectory ad, int band)
      Get the band name for a particular area
      Parameters:
      ad - AreaDirectory
      band - band number
      Returns:
      name of the band
    • setAvailableUnits

      protected void setAvailableUnits(AreaDirectory ad, int band)
      Set the available units in the unit selector
      Parameters:
      ad - AreaDirectory for the image
      band - band to use for units
    • getAvailableUnits

      protected List<ucar.unidata.util.TwoFacedObject> getAvailableUnits(AreaDirectory ad, int band)
      Set the available units in the unit selector
      Parameters:
      ad - AreaDirectory for the image
      band - band to use for units
      Returns:
      List of available units
    • readSatBands

      protected void readSatBands()
      Get the band name information from the server
    • makeImageInfo

      protected ucar.unidata.data.imagery.AddeImageInfo makeImageInfo(AreaDirectory dir, boolean isRelative, int num)
      Make an AddeImageInfo from a URL and an AreaDirectory
      Parameters:
      dir - AreaDirectory
      isRelative - true if is relative
      num - number (for relative images)
      Returns:
      corresponding AddeImageInfo
    • checkPropertiesEqual

      protected boolean checkPropertiesEqual(AreaDirectory ad1, AreaDirectory ad2)
      Check to see if the two Area directories are equal
      Parameters:
      ad1 - first AD (may be null)
      ad2 - second AD (may be null)
      Returns:
      true if they are equal
    • getPropertiesDescription

      Get a description of the properties
      Returns:
      a description
    • handleConnectionError

      protected void handleConnectionError(Exception e)
      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.

      Overridden in McIDAS-V to work with ADDE "archive" servers (servers that require a "DAY=" parameter).

      Overrides:
      handleConnectionError in class AddeChooser
      Parameters:
      e - Exception to be handled. Cannot be null.
      See Also:
    • handleConnectionError

      protected void handleConnectionError(String details, Exception e)
      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.

      Overridden in McIDAS-V to work with ADDE "archive" servers (servers that require a "DAY=" parameter).

      Overrides:
      handleConnectionError in class AddeChooser
      Parameters:
      details - Details about the context of e. null will be treated as an empty String.
      e - Exception to be handled. Cannot be null.
    • makeBandInfos

      protected List<ucar.unidata.data.imagery.BandInfo> makeBandInfos(AreaDirectory ad, int[] bands)
      Get the list of bands for the images
      Parameters:
      ad - AreaDirectory
      bands - list of bands
      Returns:
      list of BandInfos for the selected images
    • getBandInfos

      protected List<ucar.unidata.data.imagery.BandInfo> getBandInfos()
      Get the pregenerated bandInfos
    • getSelectedBandInfos

      public List<ucar.unidata.data.imagery.BandInfo> getSelectedBandInfos()
      Get the list of BandInfos for the current selected images
      Returns:
      list of BandInfos
    • getDefaultDisplayType

      Get the id for the default display type
      Overrides:
      getDefaultDisplayType in class ucar.unidata.idv.chooser.IdvChooser
      Returns:
      the display id
    • doLoadInThread

      public void doLoadInThread()
      User said go, we go. Simply get the list of images from the imageChooser and create the ADDE.IMAGE DataSource
      Overrides:
      doLoadInThread in class ucar.unidata.ui.ChooserPanel
    • getDataSourceId

      protected String getDataSourceId()
      Return the data source ID. Used by extending classes.
      Overrides:
      getDataSourceId in class ucar.unidata.idv.chooser.IdvChooser
    • getDataSourceProperties

      protected void getDataSourceProperties(Hashtable ht)
      Get the DataSource properties
      Overrides:
      getDataSourceProperties in class ucar.unidata.idv.chooser.IdvChooser
      Parameters:
      ht - Hashtable of properties
    • processPropertyComponents

      _more_
      Returns:
      _more_
    • doMakeContents

      Make the UI for this selector.
      Overrides:
      doMakeContents in class AddeChooser
      Returns:
      The gui
    • doMakeContents

      public JComponent doMakeContents(boolean doesOverride)