Beispiel #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);
    }
  }
  protected void addHelpTool(ContentPanel panel) {
    if (helpTextId == null) return;

    ToolButton helpBtn = new ToolButton("x-tool-help");
    //		if (GXT.isAriaEnabled()) {
    //			helpBtn.setTitle(GXT.MESSAGES.pagingToolBar_beforePageText());
    //		}
    helpBtn.addListener(
        Events.Select,
        new Listener<ComponentEvent>() {
          public void handleEvent(ComponentEvent ce) {
            HelpTextDialog htd = new HelpTextDialog(helpTextId);
            htd.show();
          }
        });
    panel.getHeader().addTool(helpBtn);
  }
Beispiel #3
0
  protected void initTools() {
    super.initTools();

    if (GXT.isAriaEnabled()) {
      moveBtn = new ToolButton("x-tool-move");
      moveBtn.getAriaSupport().setLabel(GXT.MESSAGES.window_ariaMove());
      moveBtn.getAriaSupport().setDescription(GXT.MESSAGES.window_ariaMoveDescription());
      head.addTool(moveBtn);

      resizeBtn = new ToolButton("x-tool-resize");
      resizeBtn.getAriaSupport().setLabel(GXT.MESSAGES.window_ariaResize());
      resizeBtn.getAriaSupport().setDescription(GXT.MESSAGES.window_ariaResizeDescription());
      head.addTool(resizeBtn);
    }

    if (minimizable) {
      minBtn = new ToolButton("x-tool-minimize");
      minBtn.addSelectionListener(
          new SelectionListener<IconButtonEvent>() {
            public void componentSelected(IconButtonEvent ce) {
              minimize();
            }
          });
      head.addTool(minBtn);
    }

    if (maximizable) {
      maxBtn = new ToolButton("x-tool-maximize");
      maxBtn.addSelectionListener(
          new SelectionListener<IconButtonEvent>() {
            public void componentSelected(IconButtonEvent ce) {
              maximize();
            }
          });
      head.addTool(maxBtn);

      restoreBtn = new ToolButton("x-tool-restore");
      restoreBtn.setVisible(false);
      restoreBtn.addSelectionListener(
          new SelectionListener<IconButtonEvent>() {
            public void componentSelected(IconButtonEvent ce) {
              restore();
            }
          });
      head.addTool(restoreBtn);
    }

    if (closable) {
      closeBtn = new ToolButton("x-tool-close");
      if (GXT.isAriaEnabled()) {
        closeBtn.setTitle(GXT.MESSAGES.messageBox_close());
      }
      closeBtn.addListener(
          Events.Select,
          new Listener<ComponentEvent>() {
            public void handleEvent(ComponentEvent ce) {
              hide();
            }
          });
      head.addTool(closeBtn);
    }
  }