Class ChartWrapper

All Implemented Interfaces:
KeyListener, PropertyChangeListener, EventListener, Sharable
Direct Known Subclasses:
PlotWrapper, ReadoutTable, StatisticsChartWrapper, TableChartWrapper

public abstract class ChartWrapper extends DisplayComponent implements KeyListener
Abstract class for chart implementations
Version:
$Revision: 1.46 $
Author:
IDV Development Team
  • Field Details

    • PROP_TIMERANGE

      public static final String PROP_TIMERANGE
      Property change id
      See Also:
    • PROP_SELECTEDTIME

      public static final String PROP_SELECTEDTIME
      Property change id
      See Also:
    • animationWidget

      protected AnimationWidget animationWidget
      The widget
    • dataChoiceWrappers

      protected List dataChoiceWrappers
      List of data choices
    • timeFilterSource

      protected TimeSeriesChartWrapper timeFilterSource
      This is the time series that we get the time segments from for subsetting
    • timeSelectSource

      protected ChartWrapper timeSelectSource
      This is the source for time selects
  • Constructor Details

    • ChartWrapper

      public ChartWrapper()
      Default ctor
    • ChartWrapper

      public ChartWrapper(String name, List dataChoices)
      Ctor
      Parameters:
      name - The name
      dataChoices - List of data choices
  • Method Details

    • getCategories

      public List getCategories()
      Get the data categories for selecting data choices
      Returns:
      List of data categories
    • init

      public void init(MultiDisplayHolder displayControl, List dataChoices)
      Initialize
      Parameters:
      displayControl - The display control we're in.
      dataChoices - List of data choices
    • initDone

      public void initDone()
      Called after this chart has been created.
      Overrides:
      initDone in class DisplayComponent
    • getFlatField

      protected FlatField getFlatField(FieldImpl data) throws VisADException, RemoteException
      Utility to extract a FlatField from the data
      Parameters:
      data - The data
      Returns:
      The flat field
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • getTypeName

      public abstract String getTypeName()
      Overwritten by derived classes to return the name of the type of this chart. ex: Histogram, Time Series, etc.
      Overrides:
      getTypeName in class DisplayComponent
      Returns:
      The type name
    • keyPressed

      public void keyPressed(KeyEvent e)
      Noop
      Specified by:
      keyPressed in interface KeyListener
      Parameters:
      e - The event
    • keyReleased

      public void keyReleased(KeyEvent e)
      Noop
      Specified by:
      keyReleased in interface KeyListener
      Parameters:
      e - The event
    • keyTyped

      public void keyTyped(KeyEvent e)
      Noop
      Specified by:
      keyTyped in interface KeyListener
      Parameters:
      e - The event
    • wrapDataChoices

      protected List wrapDataChoices(List choices)
      A utility that takes a list of DataChoice-s and wraps each one in the DataChoiceWrapper. We use the DataChoiceWrapper so that sub classes can have their own extra info for each data choice. ex: colors, etc.
      Parameters:
      choices - List of data choices
      Returns:
      List of data choice wrappers
    • createDataChoiceWrapper

      protected DataChoiceWrapper createDataChoiceWrapper(DataChoice dataChoice)
      A utility to create a data choice wrapper
      Parameters:
      dataChoice - The data choice
      Returns:
      The data choice wrapper
    • getTimeFilterRanges

      protected List getTimeFilterRanges()
      Get get list of Ranges for time subsetting. If there are none then return null.
      Returns:
      List of time ranges or null
    • getTimeRanges

      public List getTimeRanges()
      Get the time ranges to use
      Returns:
      null
    • getPopupMenuItems

      protected List getPopupMenuItems(List items)
      Add the default menu items
      Overrides:
      getPopupMenuItems in class DisplayComponent
      Parameters:
      items - List of menu items
      Returns:
      The items list
    • getInterpreter

      protected org.python.util.PythonInterpreter getInterpreter()
      Create, if needed, and return the interpreter
      Returns:
      The interpreter
    • applyJython

      public void applyJython()
      Get the jython text from the text field and apply it
    • applyJython

      protected void applyJython(String jython)
      Evaluate the jython. This is used so end users can write some jython to extract and muck with the data in a chart.
      Parameters:
      jython - The jython
    • initializeJython

      protected void initializeJython(org.python.util.PythonInterpreter interpreter)
      Add the state of this chart to the interpreter
      Parameters:
      interpreter - The interpreter to initialize
    • canDoJython

      protected boolean canDoJython()
      Should the jython field be shown in the properties
      Returns:
      Can this chart have jython applied to it
    • canBeASourceForTimeSelectionEvents

      protected boolean canBeASourceForTimeSelectionEvents()
      Can this component be a source for time selection events
      Returns:
      false
    • canDoTimeFilters

      protected boolean canDoTimeFilters()
      Can this chart use time subset filters. This is used to determine whether the checkbox should be shown in the menus
      Returns:
      Can this chart use time subset filters.
    • canDoTimeSelect

      protected boolean canDoTimeSelect()
      Can this chart use time selects This is used to determine whether the checkbox should be shown in the menus
      Returns:
      Can this chart use time select
    • canDoDriveTime

      protected boolean canDoDriveTime()
      Can this chart drive the times in the main display. This is used to determine whether the checkbox should be shown in the menus
      Returns:
      Can this chart drive the times in the main display
    • canDoMinMaxDate

      protected boolean canDoMinMaxDate()
      Can this chart subset the entire data set on time
      Returns:
      Can do min max data subsetting
    • canDoResolution

      protected boolean canDoResolution()
      Should show resolution widget
      Returns:
      Should show resolution widget
    • canDoParameters

      public boolean canDoParameters()
      Can we add fields
      Returns:
      ok to add fields
    • canDoRemoveParameters

      public boolean canDoRemoveParameters()
      Can we remove fields
      Returns:
      ok to add fields
    • canDoDataChoiceList

      public boolean canDoDataChoiceList()
      ok to show the data choice list
      Returns:
      ok to show the data choice list
    • canDoWrapperColor

      public boolean canDoWrapperColor()
      Can the color swatch be shown in the properties for the data choice wrappers.
      Returns:
      Can do wrapper colors
    • canDoWrapperSide

      public boolean canDoWrapperSide()
      Can the Side menu be shown in the properties for the data choice wrappers.
      Returns:
      Can do sides in properties
    • propertyChange

      public void propertyChange(PropertyChangeEvent event)
      Handle the event
      Specified by:
      propertyChange in interface PropertyChangeListener
      Overrides:
      propertyChange in class PropertiedThing
      Parameters:
      event - The event
    • doRemove

      public void doRemove()
      Cleanup the chart
      Overrides:
      doRemove in class DisplayComponent
    • getPropertiesComponents

      protected void getPropertiesComponents(List comps, int tabIdx)
      Create the properties contents
      Overrides:
      getPropertiesComponents in class DisplayComponent
      Parameters:
      comps - List of components
      tabIdx - Which tab
    • doMakeWrapperDisplayComponent

      protected JComponent doMakeWrapperDisplayComponent(int idx, ChartWrapper.FieldProperties fieldProperty)
      Make the widget for the field
      Parameters:
      idx - which one
      fieldProperty - The wrapper wrapper
      Returns:
      The gui
    • applyProperties

      protected boolean applyProperties()
      Apply properties
      Overrides:
      applyProperties in class DisplayComponent
      Returns:
      Was successful
    • doApplyProperties

      protected boolean doApplyProperties()
      Apply the properties
      Overrides:
      doApplyProperties in class DisplayComponent
      Returns:
      success
    • addField

      public void addField()
      Add a field to thei chart
    • getFieldSelectionLabels

      public List getFieldSelectionLabels()
      Returns the list of labels used for selecting data choices. If a derived class needs more than one data choice they can override this.
      Returns:
      List of field labels
    • doMultipleAddFields

      public boolean doMultipleAddFields()
      When selecting data does the data tree support multiple selections
      Returns:
      Do multiples
    • formatValue

      public String formatValue(double v)
      utility to format the value
      Parameters:
      v - the value
      Returns:
      the value formatted
    • addDataChoice

      public void addDataChoice(DataChoice dataChoice) throws VisADException, RemoteException
      Add the dta choice
      Parameters:
      dataChoice - the choice
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • addDataChoices

      public void addDataChoices(List newDataChoices) throws VisADException, RemoteException
      Add the data choices
      Parameters:
      newDataChoices - the choices
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • loadData

      public void loadData() throws VisADException, RemoteException
      create shapes for an individual time step.
      Overrides:
      loadData in class DisplayComponent
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • setTimeFromAnimation

      public void setTimeFromAnimation(Real time)
      Animation in main display changed. Some charts show this
      Parameters:
      time - the animation time
    • animationTimeChanged

      public void animationTimeChanged(Real time)
      Use the animation time to set the domain crosshairs
      Overrides:
      animationTimeChanged in class DisplayComponent
      Parameters:
      time - The time
    • setDataChoiceWrappers

      public void setDataChoiceWrappers(List value)
      Set the DataChoiceWrappers property.
      Parameters:
      value - The new value for DataChoiceWrappers
    • getDataChoiceWrappers

      public List getDataChoiceWrappers()
      Get the DataChoiceWrappers property.
      Returns:
      The DataChoiceWrappers
    • setResolution

      public void setResolution(double value)
      Set the Resolution property.
      Parameters:
      value - The new value for Resolution
    • getResolution

      public double getResolution()
      Get the Resolution property.
      Returns:
      The Resolution
    • getDataChoices

      public List getDataChoices()
      Create and return a list of the data choices held by the data choice wrappers.
      Returns:
      List of data choices
    • removeTimeFilterSource

      public void removeTimeFilterSource()
      Remove the current time filter source
    • setTimeFilterSource

      public void setTimeFilterSource(TimeSeriesChartWrapper value)
      Set the FilterSource property.
      Parameters:
      value - The new value for FilterSource
    • getTimeFilterSource

      public TimeSeriesChartWrapper getTimeFilterSource()
      Get the FilterSource property.
      Returns:
      The FilterSource
    • removeTimeSelectSource

      public void removeTimeSelectSource()
      Remove the current time select source
    • setTimeSelectSource

      public void setTimeSelectSource(ChartWrapper value)
      Set the SelectSource property.
      Parameters:
      value - The new value for SelectSource
    • getTimeSelectSource

      public ChartWrapper getTimeSelectSource()
      Get the SelectSource property.
      Returns:
      The SelectSource
    • filterData

      protected double[][] filterData(double[] samples, double[] timeValues) throws VisADException, RemoteException
      Utility to pull subset the given samples based on the time filter ranges
      Parameters:
      samples - The data
      timeValues - The times
      Returns:
      The sampled data/time
      Throws:
      RemoteException - On badness_
      VisADException - On badness_
    • getTimeValues

      public double[] getTimeValues(double[][] samples, FlatField data) throws VisADException, RemoteException
      Convert the time from the data (in samples[1]) into an array of milliseconds
      Parameters:
      samples - The data
      data - Where the data came from
      Returns:
      The times
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • setShowTime

      public void setShowTime(boolean value)
      Set the ShowTime property.
      Parameters:
      value - The new value for ShowTime
    • getShowTime

      public boolean getShowTime()
      Get the ShowTime property.
      Returns:
      The ShowTime
    • setDriveTime

      public void setDriveTime(boolean value)
      Set the DriveTime property.
      Parameters:
      value - The new value for DriveTime
    • getDriveTime

      public boolean getDriveTime()
      Get the DriveTime property.
      Returns:
      The DriveTime
    • setMinDate

      public void setMinDate(double value)
      Set the MinDate property.
      Parameters:
      value - The new value for MinDate
    • getMinDate

      public double getMinDate()
      Get the MinDate property.
      Returns:
      The MinDate
    • setMaxDate

      public void setMaxDate(double value)
      Set the MaxDate property.
      Parameters:
      value - The new value for MaxDate
    • getMaxDate

      public double getMaxDate()
      Get the MaxDate property.
      Returns:
      The MaxDate
    • setJython

      public void setJython(String value)
      Set the Jython property.
      Parameters:
      value - The new value for Jython
    • getJython

      public String getJython()
      Get the Jython property.
      Returns:
      The Jython
    • setAnimationShareGroup

      public void setAnimationShareGroup(String value)
      Set the AnimationShareGroup property.
      Parameters:
      value - The new value for AnimationShareGroup
    • getAnimationShareGroup

      public String getAnimationShareGroup()
      Get the AnimationShareGroup property.
      Returns:
      The AnimationShareGroup