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);
    }
  }
Example #2
0
 protected void onClick(ComponentEvent ce) {
   if (checkboxToggle && ce.getTarget() == (Element) checkbox.cast()) {
     setExpanded(!isExpanded());
     boolean isExpanded = isExpanded();
     checkbox.setChecked(isExpanded);
     checkbox.setDefaultChecked(isExpanded);
   }
 }
  /** Creates the underlying file input. */
  private void createFileInput() {

    if (file != null) {
      el().removeChild(file.dom);
    }

    final InputElement fileElement = Document.get().createFileInputElement();

    file = new El((Element) fileElement.cast());
    file.addEventsSunk(Event.ONCHANGE | Event.FOCUSEVENTS);
    file.setId(XDOM.getUniqueId());
    file.addStyleName("x-form-file");
    file.setTabIndex(-1);
    getFileInput().setName(name);
    getFileInput().setAccept(accept);
    file.insertInto(getElement(), 1);
    if (file != null) {
      file.setEnabled(isEnabled());
    }
  }