public class CalculationCategoryDataset extends AbstractDataset implements ListEventListener<Calculation<? extends java.lang.Number>>
// 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 ListEvent
s arrive on the Swing EDT.
GlazedListsSwing.swingThreadProxyList(ca.odell.glazedlists.EventList<E>)
Constructor and Description |
---|
CalculationCategoryDataset() |
Modifier and Type | Method and Description |
---|---|
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.
|
java.util.List<Calculation<? extends java.lang.Number>> |
getCalculations()
Returns the mutable List of Calculations that create the data values in
this CategoryDataset.
|
int |
getColumnCount() |
int |
getColumnIndex(java.lang.Comparable key) |
java.lang.Comparable |
getColumnKey(int column) |
java.util.List |
getColumnKeys() |
int |
getRowCount() |
int |
getRowIndex(java.lang.Comparable key) |
java.lang.Comparable |
getRowKey(int row) |
java.util.List |
getRowKeys() |
java.lang.Number |
getValue(java.lang.Comparable rowKey,
java.lang.Comparable columnKey) |
java.lang.Number |
getValue(int row,
int column) |
void |
listChanged(ListEvent<Calculation<? extends java.lang.Number>> listChanges)
This listener rebroadcasts ListEvents as DatasetChangeEvents.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
listChanged
public java.util.List<Calculation<? extends java.lang.Number>> getCalculations()
public java.lang.Comparable getRowKey(int row)
public int getRowIndex(java.lang.Comparable key)
public java.util.List getRowKeys()
public int getRowCount()
public java.lang.Comparable getColumnKey(int column)
public int getColumnIndex(java.lang.Comparable key)
public java.util.List getColumnKeys()
public int getColumnCount()
public java.lang.Number getValue(java.lang.Comparable rowKey, java.lang.Comparable columnKey)
public java.lang.Number getValue(int row, int column)
public void listChanged(ListEvent<Calculation<? extends java.lang.Number>> listChanges)
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 Calculation
s
are all garbage collected. By calling dispose()
, you allow the
CalculationCategoryDataset
to be garbage collected before its
source Calculation
s. This is necessary for situations where a
CalculationCategoryDataset
is short-lived but its source
Calculation
s are long-lived.
Warning: It is an error
to call any method on an CalculationCategoryDataset
after it has
been disposed.
protected void fireDatasetChanged()
Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by builder at 2012-09-17 16:07