org.jfree.data.category.SelectableCategoryDataset Java Examples

The following examples show how to use org.jfree.data.category.SelectableCategoryDataset. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CategoryPlot.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Clears the selection.
 *
 * @since 1.2.0
 */
public void clearSelection() {
    // cycle through the datasets and clear the selection state
    int datasetCount = this.datasets.size();
    for (int d = 0; d < datasetCount; d++) {
        CategoryDataset dataset = (CategoryDataset) this.datasets.get(d);
        if (dataset instanceof SelectableCategoryDataset) {
            // FIXME:  actually, we need to get the selection state
            // taking into account the rendering source
            SelectableCategoryDataset scd
                    = (SelectableCategoryDataset) dataset;
            if (scd.getSelectionState() != null) {
                CategoryDatasetSelectionState selState
                        = scd.getSelectionState();
                selState.clearSelection();
            }
        }
    }
}
 
Example #2
Source File: CategoryPlot.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the selection state for the specified dataset.  This could be
 * <code>null</code> if the dataset hasn't been set up to support
 * selections.
 *
 * @param dataset  the dataset.
 * @param source  the selection source.
 *
 * @return The selection state (possibly <code>null</code>).
 */
private CategoryDatasetSelectionState findSelectionStateForDataset(
        CategoryDataset dataset, Object source) {
    if (dataset instanceof SelectableCategoryDataset) {
        SelectableCategoryDataset sd = (SelectableCategoryDataset) dataset;
        CategoryDatasetSelectionState s = sd.getSelectionState();
        return s;
    }
    throw new RuntimeException();
    //return null;  // TODO: implement
}