Class TimesChooser

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, IdvConstants
Direct Known Subclasses:
AddeChooser, DqcRadarChooser, TDSPointObsChooser, TDSRadarChooser, TDSRadarChooser1

public class TimesChooser extends IdvChooser
A chooser that allows for selecting times
Author:
Unidata IDV Development Team
See Also:
  • Field Details

    • MSG_TIMES

      protected static final String MSG_TIMES
      Message for selecting times
      See Also:
    • LABEL_TIMES

      protected static final String LABEL_TIMES
      Label for times
      See Also:
    • selectedDriver

      protected TwoFacedObject selectedDriver
      Selected driver
    • timesContainer

      protected JComponent timesContainer
      times container
    • timesComponents

      protected List timesComponents
      times components
    • drivercbx

      public JCheckBox drivercbx
      the time driver checkbox
  • Constructor Details

    • TimesChooser

      public TimesChooser(IdvChooserManager mgr, Element root)
      Create me.
      Parameters:
      mgr - The chooser manager
      root - The chooser.xml node
  • Method Details

    • haveAnyTimes

      protected boolean haveAnyTimes()
      Are there any times in the times list.
      Returns:
      Do we have any times at all.
    • getTimesList

      public ChooserList getTimesList()
      Create (if needed) and return the list that shows times.
      Returns:
      The times list.
    • getTimeDriverPopupMenu

      public JPopupMenu getTimeDriverPopupMenu()
      Get the time driver popup menu
      Returns:
      the menu
    • getAbsoluteTimeSelectMode

      protected int getAbsoluteTimeSelectMode()
      Get the selection mode for the absolute times panel. Subclasses can override.
      Returns:
      select mode
    • getRelativeTimesList

      public ChooserList getRelativeTimesList()
      Create (if needed) and return the list that shows times.
      Returns:
      The times list.
    • clearTimesList

      protected void clearTimesList()
      Clear all times in the times list.
    • readTimes

      public void readTimes()
      Do what needs to be done to read in the times. Subclasses need to implement this. This is public by implementation only
    • readDrivers

      public void readDrivers()
      Read the time drives
    • updateTimeDriver

      protected List updateTimeDriver()
      Update the time driver list
      Returns:
      the list of time drivers
    • makeTimesPanel

      protected JPanel makeTimesPanel()
      Create the absolute/relative times selector
      Returns:
      the image list panel
    • absoluteTimesSelectionChanged

      protected void absoluteTimesSelectionChanged()
      Handle when the absolute times selection has changed
    • makeTimesPanel

      protected JPanel makeTimesPanel(boolean includeExtra)
      Make the times panel
      Parameters:
      includeExtra - true if including extra time component
      Returns:
      the time selection panel
    • updateStatus

      protected void updateStatus()
      Update the status label
      Overrides:
      updateStatus in class IdvChooser
    • makeTimesPanel

      protected JPanel makeTimesPanel(boolean includeExtra, boolean useTimeLine)
      Make the times panel
      Parameters:
      includeExtra - true to include the extra stuff
      useTimeLine - true to include the time line
      Returns:
      the times panel
    • makeTimesPanel

      protected JPanel makeTimesPanel(boolean includeExtra, boolean useTimeLine, boolean includeTimeDriver)
      Make the times panel
      Parameters:
      includeExtra - true to include the extra stuff
      useTimeLine - true to include the time line
      includeTimeDriver - include the time driver component
      Returns:
      the times panel
    • checkActiveViewWithDriver

      protected boolean checkActiveViewWithDriver()
      Check the current active view window and make sure it does has a time driver, otherwise, reset the active view window
      Returns:
      true if active view has a time driver
    • doLoad

      public void doLoad()
      Gets called by doLoad in a thread when the user presses the load button. Should be overwritten by a derived class.
      Overrides:
      doLoad in class ChooserPanel
    • enableAbsoluteTimesList

      protected void enableAbsoluteTimesList(boolean enabled)
      Enable the absolute times list
      Parameters:
      enabled - enabled
    • 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.
      Parameters:
      times - List of thinggs to put into absolute times list
    • setTimeDrivers

      protected void setTimeDrivers(List drivers)
      Set the time drivers in the list
      Parameters:
      drivers - the List of time drivers
    • updatetimeline

      public void updatetimeline(TwoFacedObject id)
      Update the timeline
      Parameters:
      id - the timeline object id
    • getNumTimesToSelect

      protected int getNumTimesToSelect()
      Get the number of times to select
      Returns:
      the number
    • getHaveAbsoluteTimesSelected

      protected boolean getHaveAbsoluteTimesSelected()
      Any absolute times selected
      Returns:
      Any absolute times selected
    • getTimeLine

      protected Timeline getTimeLine()
      Get the timeline
      Returns:
      the timeline
    • getAbsoluteTimes

      protected List getAbsoluteTimes()
      Get the list of all absolute times. This returns the list of objects that was passed in from setAbsoluteTimes. What is really held by the timesList and the timeLines is a list of DatedObjects that holds the objects that are passed in.
      Returns:
      all absolute times
    • getTimeDrivers

      protected List getTimeDrivers()
      Get the list of timedrivers
      Returns:
      the list
    • getSelectedAbsoluteTimes

      protected List getSelectedAbsoluteTimes()
      Get selected absolute times
      Returns:
      selected absolute times
    • setSelectedAbsoluteTimes

      protected void setSelectedAbsoluteTimes(List selectedTimes)
      Set the selected indices in the absolute times list
      Parameters:
      selectedTimes - List of selected times
    • setSelectedAbsoluteTimes

      protected void setSelectedAbsoluteTimes(int[] indices)
      Set the selected indices in the absolute times list
      Parameters:
      indices - selected indices
    • setSelectedAbsoluteTime

      protected void setSelectedAbsoluteTime(int selectedIndex)
      Set the selected index
      Parameters:
      selectedIndex - selected index
    • setSelectedAbsoluteTime

      protected void setSelectedAbsoluteTime(int from, int to)
      Set range of selected times
      Parameters:
      from - from index
      to - to index
    • makeDatedObjects

      protected List<DatedThing> makeDatedObjects(List items)
      Utility to wrap the given items as DatedThings
      Parameters:
      items - List of items. Might be a DatedThing, an AddeImageDescriptor or a DateTime
      Returns:
      List of DatedThings
    • popupTimeline

      public void popupTimeline() throws Exception
      Show the timeline
      Throws:
      Exception - On badness
    • getExtraAbsoluteTimeComponent

      protected JComponent getExtraAbsoluteTimeComponent()
      Get the extra absolute time component
      Returns:
      the component
    • getExtraRelativeTimeComponent

      protected JComponent getExtraRelativeTimeComponent()
      Get the extra relative time component
      Returns:
      the component
    • getExtraTimeComponent

      protected JComponent getExtraTimeComponent()
      Get the extra time widget. Subclasses can add their own time widgets.
      Returns:
      a widget that can be selected for more options
    • setSelectedTimes

      protected void setSelectedTimes(DateTime[] times)
      Set the selected times in the list based on the input times. This is a NOOP - subclasses should implement
      Parameters:
      times - times to use for sampling
    • getDefaultRelativeTimeIndex

      protected int getDefaultRelativeTimeIndex()
      Get the default selected index for the relative times list.
      Returns:
      default index
    • getDefaultTimeDriverIndex

      protected int getDefaultTimeDriverIndex()
      Get the default time driver index
      Returns:
      the index
    • haveTimeSelected

      protected boolean haveTimeSelected()
      Are there any times selected.
      Returns:
      Any times selected.
    • getRelativeTimeIncrement

      public float getRelativeTimeIncrement()
      Get the increment between times for relative time requests. Subclasse need to override this.
      Returns:
      time increment (hours)
    • getRelativeTimesChooser

      public JComponent getRelativeTimesChooser()
      Create (if needed) and return the list that shows times.
      Returns:
      The times list.
    • getRelativeTimeIndices

      public int[] getRelativeTimeIndices()
      Get the relative time indices
      Returns:
      an array of indices
    • getDoAbsoluteTimes

      protected boolean getDoAbsoluteTimes()
      Do we do absolute or relative times
      Returns:
      Do we do absolute times
    • getDoTimeDrivers

      protected boolean getDoTimeDrivers()
      See if we should be doing timedrivers
      Returns:
      true if doing time driving
    • setDoTimeDrivers

      protected void setDoTimeDrivers(boolean value)
      Set the time driver property
      Parameters:
      value - the property
    • setDoAbsoluteTimes

      protected void setDoAbsoluteTimes(boolean yesorno)
      Set whether we do absolute or relative times
      Parameters:
      yesorno - true to do absolute times
    • getDoRelativeTimes

      protected boolean getDoRelativeTimes()
      Did the user select relative times?
      Returns:
      Should we load relative times
    • enableWidgets

      protected void enableWidgets()
      Enable the GUI widgets based on what has been selected.
    • enableTimeWidgets

      protected void enableTimeWidgets()
      Enable the GUI widgets based on what has been selected.
    • disableTimeWidgets

      protected void disableTimeWidgets()
      Disable the GUI widgets
    • checkTimesLists

      protected void checkTimesLists()
      Check the times lists
    • addTimeSelectionListener

      public static void addTimeSelectionListener(JList list, Timeline timeline)
      Add a listener to the JList that pops up a menu on a right click that allos for the selection of different strides.
      Parameters:
      list - list to popup on
      timeline - the timeline