package com.vaadin.components.gwt.polymer.client;

import java.util.Arrays;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.vaadin.components.gwt.polymer.client.sampler.Sampler;
import com.vaadin.polymer.Polymer;
import com.vaadin.polymer.elemental.Function;

public class Demo implements EntryPoint {

    public void onModuleLoad() {
        Polymer.startLoading();

        // Although gwt-polymer-elements takes care of dynamic loading of components
        // if they are created using Polymer.createElement or Polymer Widgets,
        // there are certain features which must be loaded previously to start
        // the application. Hence you have to add import tags to your host page or
        // import those additional features dynamically, in this case it might be
        // necessary to wait until the components are ready.
        // The `Polymer` utility class provide a set of methods for facilitating it,
        // you can pass tag-names for standard component locations (tag-name/tag-name.html)
        // or relative urls otherwise. Also you can pass success and error call-backs.

        // Paper applications must always import paper-styles
        Polymer.importHref("paper-styles");

        // Styles for paper examples
        Polymer.importHref("paper-styles/demo-pages.html");

        // - Iconsets must be loaded before using any component depending on them
        //   Iron comes with the collections:
        //   communication, device, editor, hardware, image, iron, maps, notifications, social.
        // - Animation must be loaded at the beginning as wll
        Polymer.importHref(Arrays.asList(
                "iron-icons/iron-icons.html",
                "iron-icons/communication-icons.html",
                "iron-flex-layout/iron-flex-layout.html",
                "neon-animation/neon-animations.html"
                ), new Function() {
            public Object call(Object arg) {
                // The app is executed when all imports succeed.
                RootPanel.get().add(new Sampler());
                return null;
            }
        });
    }
}

@@ -516,18 +516,20 @@
      // 
-if
+when
  they ar
@@ -569,16 +569,23 @@
 ment or 
+we use 
 Polymer 
@@ -779,31 +779,10 @@
 t th
-ose additional features
+em
  dyn
@@ -815,27 +815,16 @@
 might be
-%0A        //
  necessa
@@ -839,16 +839,27 @@
 it until
+%0A        //
  the com
@@ -877,16 +877,17 @@
  ready.%0A
+%0A
         
@@ -1097,66 +1097,64 @@
 ise.
- Also you can pass success and error call-backs.%0A%0A
+%0A        Polymer.importHref(Arrays.asList(%0A     
         
 // P
@@ -1149,16 +1149,19 @@
         
+   
 // Paper
@@ -1214,35 +1214,24 @@
         
-Polymer.importHref(
+        
 %22paper-s
@@ -1236,20 +1236,26 @@
 -styles%22
-);%0A%0A
+,%0A        
         
@@ -1291,35 +1291,24 @@
         
-Polymer.importHref(
+        
 %22paper-s
@@ -1329,20 +1329,26 @@
 es.html%22
-);%0A%0A
+,%0A        
         
@@ -1349,18 +1349,16 @@
       //
- -
  Iconset
@@ -1423,24 +1423,32 @@
 hem%0A        
+        
 //   Iron co
@@ -1473,16 +1473,24 @@
 ctions:%0A
+        
         
@@ -1581,112 +1581,8 @@
 al.%0A
-        // - Animation must be loaded at the beginning as wll%0A        Polymer.importHref(Arrays.asList(%0A
     
@@ -1728,32 +1728,93 @@
 x-layout.html%22,%0A
+                // Animation must be loaded at the beginning%0A
                 
@@ -1868,18 +1868,45 @@
        )
-, 
+);%0A        Polymer.whenReady(
 new Func

Use HtmlImport instead of timer hack