manolo / gwt-polymer-elements

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

GWT Polymer.create not working #142

Closed wenzel-k closed 7 years ago

wenzel-k commented 7 years ago

Hi

The example ("Using the Element API in Java") here https://github.com/vaadin/gwt-polymer-elements#consuming-web-components-in-gwt suggest using the generated Polymer.create method to create a web component object.

But there is no Polymer#create method (gwt-api-generator --package=PolymerElements/paper-elements --javaDir=src --resourcesDir=src). The only thing that comes close might be Polymer#createElement. But an Object of type com.vaadin.polymer.paper.PaperButtonElement can not be added by the method RootPanel.get().getElement().appendChild(button), like shown in the example, because the generated PaperButtonElement is not a subclass of com.google.gwt.dom.client.Node.

So is there a proper working way to use the generated classes by the gwt-api-generator?

Thanks and best regards ano

wenzel-k commented 7 years ago

I see, still open 😉

For anyone who cares:

  1. Polymer.createElement is the way to go.
  2. And though you can just cast to parentElement.appendChilde((com.google.gwt.dom.client.Element)polymerElement), you should do DOM modifications the polymer way. That is: Polymer.dom(parentElement).appendChild(polymerElement)

Best regards

manolo commented 7 years ago

Updated README file