|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jfree.data.general.AbstractDataset
ca.odell.glazedlists.jfreechart.CalculationCategoryDataset
public class CalculationCategoryDataset
An implementation of a CategoryDataset that is backed by a List<Calculation> where each Calculation reports a numeric value. Typical usage of this class resembles:
// create the numeric Calculations we want to chart final Calculation<Number> appleStockPrice = ... final Calculation<Number> googleStockPrice = ... final Calculation<Number> microsoftStockPrice = ... // create the dataset final CalculationCategoryDataset dataset = new CalculationCategoryDataset(); // add the numeric Calculations into the dataset; any change to the // Calculations induces a redraw of the corresponding chart dataset.getCalculations().add(appleStockPrice); dataset.getCalculations().add(googleStockPrice); dataset.getCalculations().add(microsoftStockPrice); ... // when the dataset is no longer needed, dispose() of it so it can be GC'd dataset.dispose();
Note: If this
CalculationCategoryDataset is being shown in a Swing User Interface,
and thus Dataset Changes should be broadcast on the Swing Event Dispatch
Thread, it is the responsibility of the caller to ensure
that ListEvents arrive on the Swing EDT.
GlazedListsSwing.swingThreadProxyList(ca.odell.glazedlists.EventList) ,
Serialized Form| Constructor Summary | |
|---|---|
CalculationCategoryDataset()
|
|
| Method Summary | |
|---|---|
void |
dispose()
Releases the resources consumed by this CalculationCategoryDataset
so that it may eventually be garbage collected. |
protected void |
fireDatasetChanged()
We override this method for speed reasons, since the super needlessly constructs a new DatasetChangeEvent each time this method is called. |
List<Calculation<? extends Number>> |
getCalculations()
Returns the mutable List of Calculations that create the data values in this CategoryDataset. |
int |
getColumnCount()
|
int |
getColumnIndex(Comparable key)
|
Comparable |
getColumnKey(int column)
|
List |
getColumnKeys()
|
int |
getRowCount()
|
int |
getRowIndex(Comparable key)
|
Comparable |
getRowKey(int row)
|
List |
getRowKeys()
|
Number |
getValue(Comparable rowKey,
Comparable columnKey)
|
Number |
getValue(int row,
int column)
|
void |
listChanged(ListEvent<Calculation<? extends Number>> listChanges)
This listener rebroadcasts ListEvents as DatasetChangeEvents. |
| Methods inherited from class org.jfree.data.general.AbstractDataset |
|---|
addChangeListener, clone, getGroup, hasListener, notifyListeners, removeChangeListener, setGroup, validateObject |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jfree.data.general.Dataset |
|---|
addChangeListener, getGroup, removeChangeListener, setGroup |
| Constructor Detail |
|---|
public CalculationCategoryDataset()
| Method Detail |
|---|
public List<Calculation<? extends Number>> getCalculations()
public Comparable getRowKey(int row)
getRowKey in interface KeyedValues2Dpublic int getRowIndex(Comparable key)
getRowIndex in interface KeyedValues2Dpublic List getRowKeys()
getRowKeys in interface KeyedValues2Dpublic int getRowCount()
getRowCount in interface Values2Dpublic Comparable getColumnKey(int column)
getColumnKey in interface KeyedValues2Dpublic int getColumnIndex(Comparable key)
getColumnIndex in interface KeyedValues2Dpublic List getColumnKeys()
getColumnKeys in interface KeyedValues2Dpublic int getColumnCount()
getColumnCount in interface Values2D
public Number getValue(Comparable rowKey,
Comparable columnKey)
getValue in interface KeyedValues2D
public Number getValue(int row,
int column)
getValue in interface Values2Dpublic void listChanged(ListEvent<Calculation<? extends Number>> listChanges)
listChanged in interface ListEventListener<Calculation<? extends Number>>public void dispose()
CalculationCategoryDataset
so that it may eventually be garbage collected.
A CalculationCategoryDataset will be garbage collected without
a call to dispose(), but not before its source Calculations
are all garbage collected. By calling dispose(), you allow the
CalculationCategoryDataset to be garbage collected before its
source Calculations. This is necessary for situations where a
CalculationCategoryDataset is short-lived but its source
Calculations are long-lived.
Warning: It is an error
to call any method on an CalculationCategoryDataset after it has
been disposed.
protected void fireDatasetChanged()
fireDatasetChanged in class AbstractDataset
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||