/* Workaround since offRadio styling would be overwritten by default styling. * * paper-radio-button.color1[checked] #offRadio.paper-radio-button {border-color: #03a9f4;} paper-radio-button.color1[checked] #onRadio.paper-radio-button {background-color: #03a9f4;} paper-radio-button.color1 #offRadio.paper-radio-button {border-color: #01579b;} paper-radio-button.color2 #ink.paper-radio-button {color: #f44336;} */ public void setOnColor(String onColor) { if (onColor != null) { this.onColor = onColor; HTMLElement[] elements = button.getElementsByClassName("style-scope paper-radio-button"); for (int i = 0; i < elements.length; i++) { HTMLElement el = elements[i]; if (el.getAttribute("id").equals("offRadio")) { el.setAttribute("style", "border-color: " + onColor + ";"); } else if (el.getAttribute("id").equals("onRadio")) { el.setAttribute("style", "background-color: " + onColor + ";"); } } } }
public void setLabel(String label) { HTMLElement[] elements = button.getElementsByClassName("style-scope paper-radio-button"); for (int i = 0; i < elements.length; i++) { HTMLElement el = elements[i]; if (el.getAttribute("id").equals("radioLabel")) { el.setInnerHTML(label); break; } } }