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

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.importHref("paper-styles/paper-styles.html");
        Polymer.importHref("paper-styles/demo-pages.html");
        Polymer.importHref("iron-icons/iron-icons.html", new Function() {
            public Object call(Object arg) {
                RootPanel.get().add(new Sampler());
                return null;
            }
        });
    }
}

@@ -44,16 +44,42 @@
 lient;%0A%0A
+import java.util.Arrays;%0A%0A
 import c
@@ -220,23 +220,39 @@
 sampler.
+iron.IronCollapse
 Sample
-r
 ;%0Aimport
@@ -415,177 +415,1317 @@
     
-Polymer.importHref(%22paper-styles/paper-styles.html%22);%0A        Polymer.importHref(%22paper-styles/demo-pages.html%22);%0A        Polymer.importHref(%22iron-icons/iron-icons.html%22
+// Although gwt-polymer-elements takes care of dynamic loading of components%0A        // if they are created using Polymer.createElement or Polymer Widgets,%0A        // there are certain features which must be loaded previously to start%0A        // the application. Hence you have to add import tags to your host page or%0A        // import those additional features dynamically, in this case it might be%0A        // necessary to wait until the components are ready.%0A        // The %60Polymer%60 utility class provide a set of methods for facilitating it,%0A        // you can pass tag-names for standard component locations (tag-name/tag-name.html)%0A        // or relative urls otherwise. Also you can pass success and error call-backs.%0A%0A        // Paper applications must always import paper-styles%0A        Polymer.importHref(%22paper-styles%22);%0A%0A        // Styles for paper examples%0A        Polymer.importHref(%22paper-styles/demo-pages.html%22);%0A%0A        // Icon sets must be loaded before using any component depending on them%0A        // Iron comes with the collections:%0A        // communication, device, editor, hardware, image, iron, maps, notifications, social.%0A        Polymer.importHref(Arrays.asList(%0A                %22iron-icons/iron-icons.html%22,%0A                %22iron-icons/communication-icons.html%22%0A                )
 , ne
@@ -1780,24 +1780,89 @@
 ject arg) %7B%0A
+                // The app is executed when all imports succeed.%0A
             
@@ -1893,15 +1893,26 @@
 new 
+IronCollapse
 Sample
-r
 ());

Document needed imports before the app starts