/[schmitzm]/branches/2.0-RC2/src/skrueger/geotools/selection/ChartSelectionSynchronizer.java
ViewVC logotype

Diff of /branches/2.0-RC2/src/skrueger/geotools/selection/ChartSelectionSynchronizer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 131 by mojays, Sat May 30 19:58:13 2009 UTC revision 134 by mojays, Sat May 30 20:22:00 2009 UTC
# Line 31  import schmitzm.jfree.chart.selection.Da Line 31  import schmitzm.jfree.chart.selection.Da
31  import schmitzm.jfree.chart.selection.DatasetSelectionModel;  import schmitzm.jfree.chart.selection.DatasetSelectionModel;
32  import schmitzm.jfree.chart.selection.DatasetSelectionModelProvider;  import schmitzm.jfree.chart.selection.DatasetSelectionModelProvider;
33  import schmitzm.jfree.chart.selection.DatasetSelectionChangeEvent;  import schmitzm.jfree.chart.selection.DatasetSelectionChangeEvent;
34    import schmitzm.jfree.feature.Feature2DatasetItemDatasetGroup;
35    
36  /**  /**
37   * This class keeps the selection of a {@link Dataset} (based on feature   * This class keeps the selection of a {@link Dataset} (based on feature
# Line 52  import schmitzm.jfree.chart.selection.Da Line 53  import schmitzm.jfree.chart.selection.Da
53  public class ChartSelectionSynchronizer extends StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel>  public class ChartSelectionSynchronizer extends StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel>
54                                          implements DatasetSelectionListener {                                          implements DatasetSelectionListener {
55    
56    /**    /** Holds the chart datset to keep synchronized with the layer selection model. */
    * Holds the chart datset to keep synchronized with the layer selection model.  
    */  
57    protected DatasetSelectionModel<?> datasetSelModel = null;    protected DatasetSelectionModel<?> datasetSelModel = null;
58      /** Hold the mapping between feature IDs and dataset items. */
59      protected Feature2DatasetItemDatasetGroup<?> mapping = null;
60      
61    /**    /**
62     * Creates a new synchronizer.     * Creates a new synchronizer.
63     * @param layerSelModel     * @param layerSelModel
# Line 68  public class ChartSelectionSynchronizer Line 69  public class ChartSelectionSynchronizer
69     */     */
70    public ChartSelectionSynchronizer(StyledFeatureLayerSelectionModel layerSelModel, DatasetSelectionModel<?> datasetSelModel) {    public ChartSelectionSynchronizer(StyledFeatureLayerSelectionModel layerSelModel, DatasetSelectionModel<?> datasetSelModel) {
71      super(layerSelModel);      super(layerSelModel);
72        // the dataset selection model must provide a mapping
73        // to the feature IDs
74        if ( datasetSelModel.getDataset() == null ||
75             !(datasetSelModel.getDataset().getGroup() instanceof Feature2DatasetItemDatasetGroup) )
76          throw new UnsupportedOperationException("Dataset must provide a Feature2DatasetItemDatasetGroup as DatasetGroup.");
77      this.datasetSelModel = datasetSelModel;      this.datasetSelModel = datasetSelModel;
78        this.mapping         = (Feature2DatasetItemDatasetGroup<?>)datasetSelModel.getDataset().getGroup();
79    }    }
80    
81    /**    /**
# Line 99  public class ChartSelectionSynchronizer Line 106  public class ChartSelectionSynchronizer
106      datasetSelModel.setValueIsAdjusting(true);      datasetSelModel.setValueIsAdjusting(true);
107      datasetSelModel.clearSelection();      datasetSelModel.clearSelection();
108            
109      XYSeriesCollection dataset = (XYSeriesCollection)datasetSelModel.getDataset();      for (String fID : newSelection) {
110  //    dataset.getSeries(0).getDataItem(index);        Comparable dataID = mapping.getDataID(fID);
111  //            if (dataID != null ) {
112  //      //TODO: Fallunterscheidung zwischen den unterschiedlichen DatasetSelectionModel-Typen!!
113  //    for (String fid : newSelection) {        } else {
114  //      int modelIdx = featureTableModel.findFeature(fid);            LOGGER.warn("Something that is not visible in the chart should be selected");
115  //      if (modelIdx >= 0) {        }
116  //          int tableIdx = featureTable.convertRowIndexToView(modelIdx);      }
 //          tableSelModel.addSelectionInterval(tableIdx, tableIdx);  
 //      } else {  
 //          LOGGER.warn("Something that is not visible in the Table should be selected");  
 //      }  
 //    }  
117      datasetSelModel.setValueIsAdjusting(false); // event is fired autmatically!      datasetSelModel.setValueIsAdjusting(false); // event is fired autmatically!
118    
119      // Danger of event circles in valueChanged(..) banned      // Danger of event circles in valueChanged(..) banned

Legend:
Removed from v.131  
changed lines
  Added in v.134

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26