|
||||||||||
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.EventListPieDataset<E,K>
public class EventListPieDataset<E,K>
This class adapts an EventList
to the JFreeChart PieDataset
interface. Changes to the backing EventList
are rebroadcast as
changes to this PieDataset.
Extension: JFreeChart | |
This Glazed Lists extension requires the third party library JFreeChart. | |
Tested Version: | 1.0.0 |
Home page: | http://www.jfree.org/jfreechart/ |
License: | LGPL |
Note: The DataEvents broadcasted by this class occur on the Thread the
ListEvents arrive on. If this PieDataset is attached to a swing component,
like a ChartPanel
, it is the responsibility of the
client to ensure that the ListEvents are arriving on the Swing Event
Dispatch Thread, perhaps by using the
SwingThreadProxyEventList
.
SwingThreadProxyEventList
,
Serialized FormConstructor Summary | |
---|---|
EventListPieDataset(EventList<E> source,
Comparator<E> groupingComparator,
FunctionList.Function<List<E>,Comparable<K>> keyFunction,
FunctionList.Function<List<E>,Number> valueFunction)
Adapts the given source to the PieDataset interface by
applying the groupingComparator to forms groups to be
represented in the pie chart. |
|
EventListPieDataset(EventList<E> source,
FunctionList.Function<E,Comparable<K>> keyFunction,
FunctionList.Function<E,Number> valueFunction)
Adapts the given source to the PieDataset interface. |
Method Summary | |
---|---|
void |
dispose()
Releases the resources consumed by this EventListPieDataset 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 DatasetChangedEvent each time this method is called. |
int |
getIndex(Comparable key)
Returns the index for a given key. |
int |
getItemCount()
Returns the number of items (values). |
Comparable |
getKey(int index)
Returns the key of the value at the given index . |
List |
getKeys()
Returns the keys for the values in this PieDataset. |
Number |
getValue(Comparable key)
Returns the value for a given key. |
Number |
getValue(int index)
Returns the value at the given index . |
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 EventListPieDataset(EventList<E> source, FunctionList.Function<E,Comparable<K>> keyFunction, FunctionList.Function<E,Number> valueFunction)
source
to the PieDataset interface. The
given keyFunction
is then applied to each element of the
source
to produce the unique key for the element and the
given valueFunction
is applied to produce the value for an
element.
This constructor should be used when the elements in
source
do not need to be grouped together in order to
represent pie data.
source
- the EventList
containing the data to chartkeyFunction
- produces the keys of the source elements in the pie chartvalueFunction
- produces the values of the source elements in the pie chartpublic EventListPieDataset(EventList<E> source, Comparator<E> groupingComparator, FunctionList.Function<List<E>,Comparable<K>> keyFunction, FunctionList.Function<List<E>,Number> valueFunction)
source
to the PieDataset interface by
applying the groupingComparator
to forms groups to be
represented in the pie chart. The given keyFunction
is then
applied to produce the key for a group and the given
valueFunction
is applied to produce the value for a group.
source
- the EventList
containing the data to chartgroupingComparator
- produces the groups in the pie chartkeyFunction
- produces the keys of the groups in the pie chartvalueFunction
- produces the values of the groups in the pie chartMethod Detail |
---|
public Comparable getKey(int index)
index
.
getKey
in interface KeyedValues
index
- the item index (zero-based)
IndexOutOfBoundsException
- if index
is out of boundspublic int getIndex(Comparable key)
getIndex
in interface KeyedValues
key
- the key
-1
if the key is unrecognisedpublic List getKeys()
getKeys
in interface KeyedValues
null
).public Number getValue(Comparable key)
getValue
in interface KeyedValues
key
- the key
null
)
UnknownKeyException
- if the key is not recognisedpublic int getItemCount()
getItemCount
in interface Values
public Number getValue(int index)
index
.
getValue
in interface Values
index
- the index of interest (zero-based index).
public void dispose()
EventList
that backs this EventListPieDataset should outlast
this EventListPieDataset. This method should be called as soon as this
EventListPieDataset is no longer useful.
Warning: It is an error to call any method on an EventListPieDataset 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 |