package com.vaadin.polymer;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.ui.HTMLPanel;

public class PolymerWidget extends HTMLPanel {

    public PolymerWidget(String tag, String src, String html) {
        super(tag, html);
        Polymer.ensureCustomElement(getElement(), tag, src);
    }

    public PolymerWidget(String tag, SafeHtml safeHtml) {
        super(tag, safeHtml.asString());
    }

    public void setDisabled(boolean disabled) {
        this.setBooleanAttribute("disabled", disabled);
    }

    public void setDisabled(String disabled) {
        this.setBooleanAttribute("disabled", Boolean.valueOf(disabled));
    }

    public void setBooleanAttribute(String name, boolean value) {
        if(value) {
            this.getElement().setAttribute(name, "");
        } else {
            this.getElement().removeAttribute(name);
        }

    }

    // TODO: Remove this hack for paper-radio-button
    public void setName(String value) {
        getElement().setAttribute("name", value);
    }

    // TODO: Remove this hack for paper-tabs
    public void setLink(String link) {
        getElement().setAttribute("link", link);
    }

    public void setToggle(String toggle) {
        getElement().setAttribute("toggle", toggle);
    }
    public void setNoink(String noink) {
        getElement().setAttribute("noink", noink);
    }
    public void setDismissive(String dismissive) {
        getElement().setAttribute("dismissive", dismissive);
    }
    public void setAffirmative(String affirmative) {
        getElement().setAttribute("affirmative", affirmative);
    }
    public void setAutofocus(String autofocus) {
        getElement().setAttribute("autofocus", autofocus);
    }
    public void setTabindex(int index) {
        getElement().setAttribute("tabindex", "" + index);
    }

    // TODO: Remove this hacks for paper-menu-button
    public void setLabel(String label) {
        getElement().setAttribute("label", label);
    }

    public HandlerRegistration addClickHandler(ClickHandler handler) {
        return addDomHandler(handler, ClickEvent.getType());
    }
}

@@ -583,32 +583,33 @@
 ring());%0A    %7D%0A%0A
+%0A
     public void 
@@ -640,37 +640,32 @@
 bled) %7B%0A        
-this.
 setBooleanAttrib
@@ -702,135 +702,8 @@
  %7D%0A%0A
-    public void setDisabled(String disabled) %7B%0A        this.setBooleanAttribute(%22disabled%22, Boolean.valueOf(disabled));%0A    %7D%0A%0A
     
@@ -774,16 +774,17 @@
       if
+ 
 (value) 
@@ -789,37 +789,32 @@
 ) %7B%0A            
-this.
 getElement().set
@@ -867,13 +867,8 @@
     
-this.
 getE
@@ -905,25 +905,24 @@
 ;%0A        %7D%0A
-%0A
     %7D%0A%0A    /
@@ -1070,53 +1070,8 @@
  %7D%0A%0A
-    // TODO: Remove this hack for paper-tabs%0A
     
@@ -1089,217 +1089,21 @@
  set
-L
+No
 ink(
-String link) %7B%0A        getElement().setAttribute(%22link%22, link);%0A    %7D%0A%0A    public void setToggle(String toggle) %7B%0A        getElement().setAttribute(%22toggle%22, toggle);%0A    %7D%0A    public void setNoink(String
+boolean
  noi
@@ -1116,32 +1116,26 @@
         
-getElement().set
+setBoolean
 Attribut
@@ -1182,592 +1182,86 @@
  set
-Dismissive(String dismissive) %7B%0A        getElement().setAttribute(%22dismissive%22, dismissive);%0A    %7D%0A    public void setAffirmative(String affirmative) %7B%0A        getElement().setAttribute(%22affirmative%22, affirmative);%0A    %7D%0A    public void setAutofocus(String autofocus) %7B%0A        getElement().setAttribute(%22autofocus%22, autofocus);%0A    %7D%0A    public void setTabindex(int index) %7B%0A        getElement().setAttribute(%22tabindex%22, %22%22 + index);%0A    %7D%0A%0A    // TODO: Remove this hacks for paper-menu-button%0A    public void setLabel(String label) %7B%0A        getElement().setAttribute(%22label%22, label
+Tabindex(int index) %7B%0A        getElement().setAttribute(%22tabindex%22, %22%22 + index
 );%0A 

Remove unnecessary methods (legacy of 0.5 version) and fix the setNoink method