jadex.application.space.envsupport.evaluation
Class AbstractChartDataConsumer

java.lang.Object
  extended by jadex.commons.SimplePropertyObject
      extended by jadex.application.space.envsupport.evaluation.AbstractChartDataConsumer
All Implemented Interfaces:
ITableDataConsumer, IPropertyObject
Direct Known Subclasses:
CategoryChartDataConsumer, HistogramDataConsumer, TimeChartDataConsumer, XYChartDataConsumer

public abstract class AbstractChartDataConsumer
extends SimplePropertyObject
implements ITableDataConsumer

Abstract base class for chart consumers.


Field Summary
protected  org.jfree.chart.JFreeChart chart
          The chart.
 
Fields inherited from class jadex.commons.SimplePropertyObject
pcs, properties
 
Constructor Summary
AbstractChartDataConsumer()
          Create a new chart consumer.
 
Method Summary
protected abstract  void addValue(Comparable seriesname, Object valx, Object valy, DataTable data, Object[] row)
          Add a value to a specific series of the chart.
 void consumeData(long currenttime, double tick)
          Consume data from the provider.
protected abstract  org.jfree.chart.JFreeChart createChart()
          Create a chart with the underlying dataset.
 org.jfree.chart.JFreeChart getChart()
          Get the chart.
 JPanel getChartPanel()
          Get the chart panel.
protected  ResourceInfo getResourceInfo(String name, String[] imports, ClassLoader classloader)
          Find the file for a given name.
 AbstractEnvironmentSpace getSpace()
          Get the space.
protected  ITableDataProvider getTableDataProvider()
          Get the table data provider.
protected  Object[] getValues(int num, DataTable data, Object[] row, SimpleValueFetcher fetcher)
          Get the x/y values for a specific series number.
 void refresh()
          Refresh the chart.
 
Methods inherited from class jadex.commons.SimplePropertyObject
addPropertyChangeListener, getProperties, getProperty, getPropertyNames, hasProperty, removePropertyChangeListener, setProperties, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jadex.commons.IPropertyObject
getProperty, getPropertyNames, hasProperty, setProperty
 

Field Detail

chart

protected org.jfree.chart.JFreeChart chart
The chart.

Constructor Detail

AbstractChartDataConsumer

public AbstractChartDataConsumer()
Create a new chart consumer.

Method Detail

consumeData

public void consumeData(long currenttime,
                        double tick)
Consume data from the provider.

Specified by:
consumeData in interface ITableDataConsumer
Parameters:
currenttime - The current time.
tick - The current tick.

getValues

protected Object[] getValues(int num,
                             DataTable data,
                             Object[] row,
                             SimpleValueFetcher fetcher)
Get the x/y values for a specific series number. In case of a multi series the row array defines the specific data to read.


getChart

public org.jfree.chart.JFreeChart getChart()
Get the chart.

Returns:
The chart.

refresh

public void refresh()
Refresh the chart.


getSpace

public AbstractEnvironmentSpace getSpace()
Get the space.

Returns:
The space.

getTableDataProvider

protected ITableDataProvider getTableDataProvider()
Get the table data provider.

Returns:
The table data provider.

getResourceInfo

protected ResourceInfo getResourceInfo(String name,
                                       String[] imports,
                                       ClassLoader classloader)
                                throws Exception
Find the file for a given name.

Parameters:
name - The filename or logical name (resolved via imports and extension).
extension - The required extension.
imports - The imports, if any.
Returns:
The resource info identifying the file.
Throws:
Exception

getChartPanel

public JPanel getChartPanel()
Get the chart panel.

Returns:
The chart panel.

createChart

protected abstract org.jfree.chart.JFreeChart createChart()
Create a chart with the underlying dataset.

Returns:
The chart.

addValue

protected abstract void addValue(Comparable seriesname,
                                 Object valx,
                                 Object valy,
                                 DataTable data,
                                 Object[] row)
Add a value to a specific series of the chart.

Parameters:
seriesname - The seriesname.
valx - The x value.
valy - The y value.
data - The data table.
row - The current data row.


Copyright © 2010. All Rights Reserved.