manolo / gwt-polymer-elements

Polymer Web Components for GWT. A collection of Material Design widgets for desktop and mobile.
Apache License 2.0
155 stars 49 forks source link

DrawerPanel #14

Closed grebesche closed 9 years ago

grebesche commented 9 years ago

I see that the CoreDrawerPanel exist, but is not in the demo. Is it a work in progress? I'm using com.vaadin.components:gwt-polymer-elements:1.0-SNAPSHOT

I tried to use it, but just including this line:

final CoreDrawerPanel coreDrawerPanel = new CoreDrawerPanel();

into onModuleLoad prevent any other widget to be added to the DOM. Before:

<body>
  <iframe src="javascript:"
  "" id="BeesGwt" tabindex="-1" style="position: absolute; width: 0px; height: 0px; border: none;
  left: -1000px; top: -1000px;"></iframe>
  <paper-shadow z="2">
    <core-toolbar>My tool bar</core-toolbar>
  </paper-shadow>
  <paper-button raised="true" role="button" tabindex="0">button !</paper-button>
</body>

After:

<body>
  <iframe src="javascript:"
  "" id="BeesGwt" tabindex="-1" style="position: absolute; width: 0px; height: 0px; border: none;
  left: -1000px; top: -1000px;"></iframe>
</body>
manolo commented 9 years ago

Could you share more code, I mean your initial index.html and the onModuleLoad code.

grebesche commented 9 years ago

Here is my initial index.html

<html>
<head>
  <title>Bees GWT App</title>
  <script type="text/javascript" language="javascript" src="BeesGwt/BeesGwt.nocache.js"></script>
</head>

<body>

</body>
</html>

And my onModuleLoad

public void onModuleLoad() {
    PaperShadow paperShadow = new PaperShadow();
    paperShadow.setZ(2);
    CoreToolbar coreToolbar = new CoreToolbar("My tool bar");
    paperShadow.add(coreToolbar);

    PaperButton button = new PaperButton("button !");
    button.setRaised(true);

    // final CoreDrawerPanel coreDrawerPanel = new CoreDrawerPanel();
    button.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
      }
    });

    RootPanel.get().add(paperShadow);
    RootPanel.get().add(button);
    RootPanel.get().add(new Label("Coucou"));
  }

So if I uncomment the CoreDrawerPanel line (even without adding it to the DOM), nothing get displayed and in the JS console I have:

Uncaught java.lang.ClassCastException
  dynamicCast_0_g$  
  getPolymerElement_0_g$    
  CoreDrawerPanel_3_g$  
  CoreDrawerPanel_2_g$  
  CoreDrawerPanel_1_g$  
  onModuleLoad_3_g$ 
  init_2_g$ 
  initializeModules_0_g$    
  apply_0_g$    
  entry0_0_g$   
  (anonymous function)  
  gwtOnLoad_0_g$    
  (anonymous function)  

Am I missing something? Thanks