예제 #1
0
  @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\">&#160;</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);
  }