public void draw ( final List < Displayer > displayerList ) { // Get the modules to load. Set < ChartPackage > packageList = EnumSet . noneOf ( ChartPackage . class ) ; for ( Displayer displayer : displayerList ) { try { GoogleDisplayer googleDisplayer = ( GoogleDisplayer ) displayer ; packageList . add ( _packageTypes . get ( googleDisplayer . getDisplayerSettings ( ) . getType ( ) ) ) ; } catch ( ClassCastException e ) { // Just ignore non Google displayers. } } // Create an array of packages. ChartPackage [ ] packageArray = new ChartPackage [ packageList . size ( ) ] ; int i = 0 ; for ( ChartPackage pkg : packageList ) { packageArray [ i ++ ] = pkg ; } // Load the visualization API ChartLoader chartLoader = new ChartLoader ( packageArray ) ; chartLoader . loadApi ( new Runnable ( ) { // Called when the visualization API has been loaded. public void run ( ) { for ( Displayer displayer : displayerList ) { try { GoogleDisplayer googleDisplayer = ( GoogleDisplayer ) displayer ; googleDisplayer . ready ( ) ; } catch ( ClassCastException e ) { // Just ignore non Google displayers. } } } } ) ; }
In Google the renderer mechanism is asynchronous .