I have in my shared-styles.html the following code
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/iron-icon/iron-icon.html">
<link rel="import" href="../bower_components/vaadin-button/vaadin-button.html">
<dom-module id="icon-button">
<template>
<vaadin-button>
<iron-icon id="iconx" icon="vaadin:plus"></iron-icon>
<div id="labelx">Label</div>
</vaadin-button>
</template>
<script>
class IconButton extends Polymer.Element {
static get is() {
return 'icon-button';
}
static get properties() {
return {
// Declare your properties here.
};
}
}
customElements.define(IconButton.is, IconButton);
</script>
</dom-module>
I have the following Java-Class
@Tag("icon-button")
@HtmlImport("frontend://styles/shared-styles.html")
public class IconButton extends PolymerTemplate<TemplateModel> {
@Id("labelx")
private Div labelx;
@Id("iconx")
private Div iconx;
public void setText(Component text) {
this.labelx.removeAll();
this.labelx.add(text);
}
public void setIcon(Component icon) {
this.iconx.removeAll();
this.iconx.add(icon);
}
When i use the IconButton in a java-class, the following code works well
Div div2 = new Div();
div2.setText("helloHi");
IconButton iconButton = new IconButton();
iconButton.setText(div2);
how can i make working?
iconButton.setIcon(VaadinIcon.ARROW_RIGHT);