Example #1
0
  @Override
  protected void onRender(Element parent, int pos) {
    setElement(DOM.createFieldSet(), parent, pos);

    legend = new El(DOM.createLegend());
    legend.addStyleName("x-fieldset-header");

    if (checkboxToggle && collapsible) {
      checkbox = DOM.createInputCheck().cast();
      sinkEvents(Event.ONCLICK);
      if (checkboxName != null) {
        checkbox.setAttribute("name", checkboxName);
      }
      legend.appendChild((Element) checkbox.cast());
      checkbox.setDefaultChecked(!collapsed);
      checkbox.setChecked(!collapsed);
      if (GXT.isAriaEnabled()) {
        checkbox.setTitle("Expand " + html);
      }
    } else if (!checkboxToggle && collapsible) {
      collapseBtn = new ToolButton("x-tool-toggle");
      collapseBtn.addListener(
          Events.Select,
          new Listener<ComponentEvent>() {
            public void handleEvent(ComponentEvent be) {
              setExpanded(!isExpanded());
            }
          });
      collapseBtn.render(legend.dom);
      collapseBtn.getAriaSupport().setRole("checkbox");
      if (GXT.isAriaEnabled()) {
        collapseBtn.setTitle("Expand " + html);
      }
      ComponentHelper.setParent(this, collapseBtn);
    }

    heading = DOM.createSpan();
    heading.setClassName("x-fieldset-header-text");
    legend.appendChild(heading);
    getElement().appendChild(legend.dom);

    body = el().appendChild(DOM.createDiv());

    if (html != null) {
      setHeadingHtml(html);
    }

    if (collapsed) {
      onCollapse();
    }

    updateIconTitles();

    if (GXT.isFocusManagerEnabled() && !getFocusSupport().isIgnore()) {
      el().setTabIndex(0);
      el().setElementAttribute("hideFocus", "true");
      sinkEvents(Event.FOCUSEVENTS);
    }
  }
 private void updateRange(final int value) {
   double val = value / 100.0;
   String css =
       "background-image: -webkit-gradient(linear, 0% 0%, 100% 0%, color-stop("
           + val
           + ", rgb(114, 171, 14)), color-stop("
           + val
           + ", rgb(197, 197, 197)));";
   range.setAttribute("style", css);
 }
  public void setData(TaskDTO data) {
    this.task = data;
    name.setInnerHTML(data.getName());
    endDate.setInnerHTML(data.getEndDate());
    delegator.setInnerHTML(data.getDelegator());
    priority.setInnerHTML(data.getPriority() + "");
    percentCompleted.setInnerHTML(data.getPercentCompleted() + " %");
    if (!data.getExternalId().isEmpty()) {
      // TODO : display edit percent completed
      range.getStyle().setDisplay(Style.Display.NONE);
    }

    range.setAttribute("min", "0");
    range.setAttribute("max", "100");
    range.setAttribute("step", "5");
    range.setAttribute("value", String.valueOf(data.getPercentCompleted()));
    range.setDisabled(true);
    updateRange(data.getPercentCompleted());
  }