schmitzm.jfree.feature
Class FeatureCategoryDatasetSelectionModel

java.lang.Object
  extended by schmitzm.jfree.chart.selection.AbstractDatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>
      extended by schmitzm.jfree.chart.selection.CategoryDatasetSelectionModel
          extended by schmitzm.jfree.feature.FeatureCategoryDatasetSelectionModel
All Implemented Interfaces:
DatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>, FeatureDatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>

public class FeatureCategoryDatasetSelectionModel
extends CategoryDatasetSelectionModel
implements FeatureDatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>

This class extends the CategoryDatasetSelectionModel with the FeatureDatasetSelectionModel, so that selection operations can directly applied on feature IDs.

Author:
Martin Schmitz

Field Summary
protected  Feature2CategoryDatasetMapping mapping
          Holds the mapping between features and the corresponding column/row keys.
 
Fields inherited from class schmitzm.jfree.chart.selection.AbstractDatasetSelectionModel
dataset, listeners, LOGGER, selectedSeriesIdx
 
Constructor Summary
FeatureCategoryDatasetSelectionModel(CategoryDataset dataset)
          Creates a new selection model.
 
Method Summary
 boolean changeItemSelection(String fID)
          Changes the selection of the data item of a feature in all series.
 boolean changeItemSelection(String fID, Comparable<?> seriesKey)
          Changes the selection of the data item of a feature.
 Set<String> getSelectedFeatures()
          Returns the IDs of the selected features (in any series/row).
 boolean isFeatureSelected(String fID)
          Checks if the data item of a feature is selected in any series.
 boolean isFeatureSelected(String fID, Comparable<?> seriesKey)
          Checks if the data item of a feature is selected.
 void setItemSelected(String fID, boolean selected)
          Sets the selection state for a feature in all dataset series.
 void setItemSelected(String fID, Comparable<?> seriesKey, boolean selected)
          Sets whether the data item of a feature is selected or not.
 
Methods inherited from class schmitzm.jfree.chart.selection.CategoryDatasetSelectionModel
datasetChanged
 
Methods inherited from class schmitzm.jfree.chart.selection.AbstractDatasetSelectionModel
addSelectionListener, changeItemSelection, clearSelection, createInstanceFor, createSelectionChangeEvent, getDataset, getValueIsAdjusting, isItemSelected, refreshSelection, removeSelectionListener, setItemSelected, setValueIsAdjusting
 
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
addSelectionListener, changeItemSelection, clearSelection, datasetChanged, getDataset, getValueIsAdjusting, isItemSelected, refreshSelection, removeSelectionListener, setItemSelected, setValueIsAdjusting
 

Field Detail

mapping

protected Feature2CategoryDatasetMapping mapping
Holds the mapping between features and the corresponding column/row keys.

Constructor Detail

FeatureCategoryDatasetSelectionModel

public FeatureCategoryDatasetSelectionModel(CategoryDataset dataset)
Creates a new selection model.

Parameters:
dataset - a dataset providing FeatureDatasetMetaData as dataset group containing a Feature2CategoryDatasetMapping
Method Detail

isFeatureSelected

public boolean isFeatureSelected(String fID)
Checks if the data item of a feature is selected in any series.

Specified by:
isFeatureSelected in interface FeatureDatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>
Parameters:
fID - feature ID

isFeatureSelected

public boolean isFeatureSelected(String fID,
                                 Comparable<?> seriesKey)
Checks if the data item of a feature is selected.

Parameters:
fID - feature ID
seriesKey - series (row) to check for the feature ID

setItemSelected

public void setItemSelected(String fID,
                            boolean selected)
Sets the selection state for a feature in all dataset series.

Specified by:
setItemSelected in interface FeatureDatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>
Parameters:
fID - feature ID
selected - flag to (de)select the item

setItemSelected

public void setItemSelected(String fID,
                            Comparable<?> seriesKey,
                            boolean selected)
Sets whether the data item of a feature is selected or not.

Parameters:
fID - feature ID
seriesKey - series (row) to set the selection in
selected - flag to (de)select the item

changeItemSelection

public boolean changeItemSelection(String fID)
Changes the selection of the data item of a feature in all series.

Specified by:
changeItemSelection in interface FeatureDatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>
Parameters:
fID - feature ID
Returns:
true if at least one item changed to selected

changeItemSelection

public boolean changeItemSelection(String fID,
                                   Comparable<?> seriesKey)
Changes the selection of the data item of a feature.

Parameters:
fID - feature ID
seriesKey - series to change the selection in
Returns:
true if the item changed to selected

getSelectedFeatures

public Set<String> getSelectedFeatures()
Returns the IDs of the selected features (in any series/row).

Specified by:
getSelectedFeatures in interface FeatureDatasetSelectionModel<CategoryDataset,Comparable<?>,Comparable<?>>