Created
          April 4, 2012 18:31 
        
      - 
      
- 
        Save ulmangt/2304547 to your computer and use it in GitHub Desktop. 
    A possible solution for: https://github.com/metsci/glimpse/issues/6
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package com.metsci.glimpse.examples.stacked; | |
| import static com.metsci.glimpse.util.logging.LoggerUtils.logWarning; | |
| import java.util.logging.Logger; | |
| import com.metsci.glimpse.examples.Example; | |
| import com.metsci.glimpse.plot.StackedPlot2D.PlotInfo; | |
| import com.metsci.glimpse.plot.timeline.StackedTimePlot2D; | |
| public class LayoutUpdateBugTest extends HorizontalTimelinePlotExample | |
| { | |
| private static final Logger logger = Logger.getLogger( LayoutUpdateBugTest.class.getSimpleName( ) ); | |
| public static void main( String[] args ) throws Exception | |
| { | |
| Example.showWithSwing( new LayoutUpdateBugTest( ) ); | |
| } | |
| @Override | |
| public StackedTimePlot2D getLayout( ) | |
| { | |
| final StackedTimePlot2D plot = ( StackedTimePlot2D ) super.getLayout( ); | |
| final PlotInfo speed = plot.getPlot( "speed-plot-1-id" ); | |
| final PlotInfo viscosity = plot.getPlot( "viscosity-plot-2-id" ); | |
| ( new Thread( ) | |
| { | |
| int size = 100; | |
| int direction = 1; | |
| public void run( ) | |
| { | |
| while ( true ) | |
| { | |
| if ( size > 300 || size < 100 ) direction *= -1; | |
| size += direction; | |
| viscosity.setSize( size ); | |
| speed.setSize( -1 ); | |
| try | |
| { | |
| Thread.sleep( 20 ); | |
| } | |
| catch ( InterruptedException e ) | |
| { | |
| logWarning( logger, "Trouble in Resize Thread", e ); | |
| } | |
| } | |
| } | |
| } ).start( ); | |
| return plot; | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment