@Override protected void onRender(Element target, int index) { setElement(DOM.createDiv(), target, index); super.onRender(target, index); if (template == null) { String html = "<tpl for=\".\"><a href=\"#\" class=\"color-{.}\"><em><span style=\"background:#{.}\" unselectable=\"on\"> </span></em></a></tpl>"; setTemplate(XTemplate.create(html)); } JavaScriptObject toJavaScriptArray = JsUtil.toJavaScriptArray(getColors()); getTemplate().overwrite(el().dom, toJavaScriptArray); sinkEvents(Event.ONCLICK | Event.ONMOUSEOVER | Event.ONMOUSEOUT); }