schmitzm.jfree.chart.selection
Interface DatasetSelectionModel<D extends Dataset,E,F>

All Known Subinterfaces:
FeatureDatasetSelectionModel<D,E,F>
All Known Implementing Classes:
AbstractDatasetSelectionModel, CategoryDatasetSelectionModel, FeatureCategoryDatasetSelectionModel, FeatureSeriesDatasetSelectionModel, SeriesDatasetSelectionModel

public interface DatasetSelectionModel<D extends Dataset,E,F>

This selection model 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

Author:
Martin Schmitz (University of Bonn/Germany)

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.
 void datasetChanged(DatasetChangeEvent event)
          Listens for dataset changes.
 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.
 

Method Detail

getDataset

D getDataset()
Returns the Dataset whose data can be selected.


isItemSelected

boolean isItemSelected(E seriesKey,
                       F item)
Checks if an series item is selected.

Parameters:
seriesKey - key of the series
item - the item in the series

setItemSelected

void setItemSelected(E seriesKey,
                     F item,
                     boolean selected)
Sets whether a series item is selected or not.

Parameters:
seriesKey - key of the series
item - the item in the series
selected - flag to (de)select the item

changeItemSelection

boolean changeItemSelection(E seriesKey,
                            F item)
Changes the selection of a series item.

Parameters:
seriesKey - key of the series
item - the item in the series
Returns:
true if the item changed to selected

clearSelection

void clearSelection()
Clears the selection.


addSelectionListener

void addSelectionListener(DatasetSelectionListener listener)
Adds a listener which will be informed about changed on the selection model.

Parameters:
listener - the listener to be added

removeSelectionListener

void removeSelectionListener(DatasetSelectionListener listener)
Removes a listener from the selection model.

Parameters:
listener - the listener to be remove

getValueIsAdjusting

boolean getValueIsAdjusting()
Returns whether the current selection change is a part of multiple changes. If true refreshSelection() has no effect and no DatasetSelectionChangeEvent is fired until setValueIsAdjusting(false) is called.


setValueIsAdjusting

void setValueIsAdjusting(boolean valueIsAdjusting)
Sets whether the following selection changes are part of multiple changes. If 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.

See Also:
refreshSelection()

refreshSelection

void refreshSelection()
Informs all listeners about a general selection change.


datasetChanged

void datasetChanged(DatasetChangeEvent event)
Listens for dataset changes. If a some data items are no longer present in the dataset, the respective items are removed from selection list.