Changeset 7978


Ignore:
Timestamp:
04/17/12 13:16:54 (7 years ago)
Author:
aivar
Message:

SLIM Plugin: #703 Got out of index exception drawing JFreeChart decay chart initially.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/projects/slim-plugin/src/main/java/loci/slim/ui/DecayGraph.java

    r7930 r7978  
    8787    static final Color TRANS_STOP_COLOR = Color.RED.darker(); 
    8888    static final Color BASE_COLOR = Color.GREEN.darker(); 
    89     static final Color RESIDUAL_COLOR = Color.GRAY.brighter(); //Color.BLACK; 
     89    static final Color RESIDUAL_COLOR = Color.GRAY.brighter(); 
     90     
     91    private static final Object _synchObject = new Object(); 
    9092 
    9193    private static DecayGraph _instance; 
     
    343345     */ 
    344346    private void createDatasets(int bins, double timeInc, ICurveFitData data) 
    345     {        
     347    { 
    346348        XYSeries series2 = new XYSeries("Fitted"); 
    347349        XYSeries series3 = new XYSeries("Data"); 
     
    403405        } 
    404406 
    405         _decayDataset.removeAllSeries(); 
    406         _decayDataset.addSeries(series2); 
    407         _decayDataset.addSeries(series3); 
    408  
    409         _residualDataset.removeAllSeries(); 
    410         _residualDataset.addSeries(series4); 
     407        synchronized (_synchObject) { 
     408            _decayDataset.removeAllSeries(); 
     409            _decayDataset.addSeries(series2); 
     410            _decayDataset.addSeries(series3); 
     411 
     412            _residualDataset.removeAllSeries(); 
     413            _residualDataset.addSeries(series4);  
     414        } 
    411415    } 
    412416 
     
    474478        @Override 
    475479        protected void paintLayer(Graphics2D g2D, JXLayer<? extends V> layer) { 
    476             // this paints layer as is 
    477             super.paintLayer(g2D, layer); 
     480            // synchronized with chart data update 
     481            synchronized (_synchObject) { 
     482                // this paints chart layer as is 
     483                super.paintLayer(g2D, layer); 
     484            } 
    478485             
    479486            if (null != _transStartMarkerProportion && 
Note: See TracChangeset for help on using the changeset viewer.