|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectschmitzm.jfree.chart.selection.AbstractDatasetSelectionModel<D,E,F>
public abstract class AbstractDatasetSelectionModel<D extends Dataset,E,F>
This class is a general implementation of DatasetSelectionModel
and maintains whether
items of a Dataset
are selected in a chart or not. The model connects to
the Dataset
as DatasetChangeListener
to recognize the moment a
series is removed. Subclasses must implement
#datasetChanged(org.jfree.data.general.DatasetChangeEvent)
to react with an
automatic unselect.
D
= the dataset type the model handles
E
= the data type the series are identified with in the dataset
F
= the data type the data items are identified with in each series
Field Summary | |
---|---|
protected D |
dataset
Holds the Dataset whose data can be selected. |
protected |
listeners
Holds the listeners to the DatasetSelectionModel . |
protected Logger |
LOGGER
Logger to log waring, debug or error messages. |
protected Map<E,Set<F>> |
selectedSeriesIdx
Contains a Set for each series. |
Constructor Summary | |
---|---|
AbstractDatasetSelectionModel(D dataset)
Creates a new selection model. |
Method Summary | |
---|---|
void |
addSelectionListener(DatasetSelectionListener listener)
Adds a listener which will be informed about changed on the selection model. |
boolean |
changeItemSelection(E seriesKey,
F item)
Changes the selection of a series item. |
void |
clearSelection()
Clears the selection. |
static AbstractDatasetSelectionModel<?,?,?> |
createInstanceFor(Dataset dataset)
Creates a AbstractDatasetSelectionModel for a Dataset . |
protected DatasetSelectionChangeEvent |
createSelectionChangeEvent()
Creates a DatasetSelectionChangeEvent . |
D |
getDataset()
Returns the Dataset whose data can be selected. |
boolean |
getValueIsAdjusting()
Returns whether the current selection change is a part of multiple changes. |
boolean |
isItemSelected(E seriesKey,
F item)
Checks if an series item is selected. |
void |
refreshSelection()
Informs all listeners about a general selection change. |
void |
removeSelectionListener(DatasetSelectionListener listener)
Removes a listener from the selection model. |
void |
setItemSelected(E seriesKey,
F item,
boolean selected)
Sets whether a series item is selected or not. |
void |
setValueIsAdjusting(boolean valueIsAdjusting)
Sets whether the following selection changes are part of multiple changes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface schmitzm.jfree.chart.selection.DatasetSelectionModel |
---|
datasetChanged |
Field Detail |
---|
protected Logger LOGGER
Logger
to log waring, debug or error messages.
protected D extends Dataset dataset
Dataset
whose data can be selected.
protected Map<E,Set<F>> selectedSeriesIdx
Set
for each series. In each of these sets the
selected items are stored.
protectedlisteners
DatasetSelectionModel
.
Constructor Detail |
---|
public AbstractDatasetSelectionModel(D dataset)
dataset
- Dataset
whose data can be selectedMethod Detail |
---|
public static AbstractDatasetSelectionModel<?,?,?> createInstanceFor(Dataset dataset)
AbstractDatasetSelectionModel
for a Dataset
.
dataset
- a dataset
null
if selection is not supported for datasetpublic D getDataset()
Dataset
whose data can be selected.
getDataset
in interface DatasetSelectionModel<D extends Dataset,E,F>
public boolean isItemSelected(E seriesKey, F item)
isItemSelected
in interface DatasetSelectionModel<D extends Dataset,E,F>
seriesKey
- key of the seriesitem
- the item in the seriespublic void setItemSelected(E seriesKey, F item, boolean selected)
setItemSelected
in interface DatasetSelectionModel<D extends Dataset,E,F>
seriesKey
- key of the seriesitem
- the item in the seriesselected
- flag to (de)select the itempublic boolean changeItemSelection(E seriesKey, F item)
changeItemSelection
in interface DatasetSelectionModel<D extends Dataset,E,F>
seriesKey
- key of the seriesitem
- the item in the series
true
if the item changed to selectedpublic void clearSelection()
clearSelection
in interface DatasetSelectionModel<D extends Dataset,E,F>
public void addSelectionListener(DatasetSelectionListener listener)
addSelectionListener
in interface DatasetSelectionModel<D extends Dataset,E,F>
listener
- the listener to be addedpublic void removeSelectionListener(DatasetSelectionListener listener)
removeSelectionListener
in interface DatasetSelectionModel<D extends Dataset,E,F>
listener
- the listener to be removepublic boolean getValueIsAdjusting()
true
refreshSelection()
has no effect
and no DatasetSelectionChangeEvent
is fired until
setValueIsAdjusting(false)
is called.
getValueIsAdjusting
in interface DatasetSelectionModel<D extends Dataset,E,F>
public void setValueIsAdjusting(boolean valueIsAdjusting)
true
refreshSelection()
has no effect
and no DatasetSelectionChangeEvent
event is fired.
If the value is set from true
to false
an automatic
refresh is initiated.
setValueIsAdjusting
in interface DatasetSelectionModel<D extends Dataset,E,F>
refreshSelection()
public void refreshSelection()
getValueIsAdjusting()
is true
.
refreshSelection
in interface DatasetSelectionModel<D extends Dataset,E,F>
protected DatasetSelectionChangeEvent createSelectionChangeEvent()
DatasetSelectionChangeEvent
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |