org.progeeks.jfreechart
Interface ChartDataTransform

All Superinterfaces:
StandardBean
All Known Implementing Classes:
DefaultChartDataTransform

public interface ChartDataTransform
extends StandardBean

Interface for classes which can transform a data source into a List of objects that can be fed into a MetaDatasetProducer. Usually, the data source will just be another object, possibly even a List itself or an object with some property that is a List. Users of a ChartDataTransform can also register with it to receive notifications when the data source has changed in a way that affects the chart data. Currently, most MetaDatasetProducers can handle mods to existing data and new data being added. Can't handle data being deleted. The events are broadcast just like an ObservableList.

Version:
$Revision: 1.5 $
Author:
esword

Field Summary
static java.lang.String PROP_DATA_SOURCE
           
 
Method Summary
 java.lang.Object getChartDataItem(java.lang.Object keyData)
          Using the passed in object, return any matching data from the data source.
 java.util.List getDataList()
          Generates or extracts list with the data objects used to produce a chart Dataset from a stored data object.
 java.lang.Object getDataSource()
          Retrieve the data source that is used.
 java.lang.Object getOriginalDataItem(java.lang.Object chartData)
          The opposite of getChartDataItem, invoked with information from the chart.
 void releaseDataSource()
          Tells the transform that its work is done.
 
Methods inherited from interface org.progeeks.util.beans.StandardBean
addPropertyChangeListener, addPropertyChangeListener, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener
 

Field Detail

PROP_DATA_SOURCE

static final java.lang.String PROP_DATA_SOURCE
See Also:
Constant Field Values
Method Detail

getDataList

java.util.List getDataList()
Generates or extracts list with the data objects used to produce a chart Dataset from a stored data object.

Returns:
List with the data objects
Throws:
java.lang.UnsupportedOperationException - - if this transform does not support this operation

getChartDataItem

java.lang.Object getChartDataItem(java.lang.Object keyData)
Using the passed in object, return any matching data from the data source. Useful for when outside actors want to manipulate the display of the chart in some way (i.e. set the focus), but don't have direct access to the form of data that goes into the DatasetProducer to obtain the chart-specific information. For example, an outside class may pass a JDBC ResultSet to a chart controller in a setFocus call. The transform could translate the result set into a List of beans that the chart controller can then use a DatasetProducer to find the corresponding points on the chart.

Parameters:
keyData -
Returns:
Matching data from the data source.

getDataSource

java.lang.Object getDataSource()
Retrieve the data source that is used. There is purposefully no setDataSource call to make the property immutable. Once a Transform has been build and is creating data for a chart, you don't want to remove the whole underlying data structure, largely because charts aren't good at deleting data.

Returns:
data source used to generate chart data.

getOriginalDataItem

java.lang.Object getOriginalDataItem(java.lang.Object chartData)
The opposite of getChartDataItem, invoked with information from the chart. Attempts to return the original data object that is represented by the passed parameter. Useful for when a user action on the chart needs to be broadcast outside of the chart context in a form that other components can understand.

Parameters:
chartData - If the List that was passed to the chart originally from getDataList contained the actual data from the DataSource, then chartData can just be returned directly. Otherwise, chartData should contain enough information for the transform to know how to retrieve the original information. For example, chartData may be a clone of the original object. original data cannot be obtained.

releaseDataSource

void releaseDataSource()
Tells the transform that its work is done. Allows it to remove any connections (i.e. listeners) it has to the datasource



Copyright © 2002-2003 Paul Speed. All Rights Reserved.