Ejemplo n.º 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);
    }
  }
Ejemplo n.º 2
0
  /**
   * Remember user/pass implementation <a href=
   * "http://stackoverflow.com/questions/1245174/is-it-possible-to-implement-cross-browser-username-password-autocomplete-in-gxt"
   * >based in this</a> and <a href=
   * "http://www.sencha.com/forum/showthread.php?72027-Auto-complete-login-form" >this</a>.
   */
  public SignInForm(final I18nTranslationService i18n) {
    final Listener<FieldEvent> enterListener =
        new Listener<FieldEvent>() {
          @Override
          public void handleEvent(final FieldEvent fe) {
            if (fe.getEvent().getKeyCode() == 13) {
              onAcceptCallback.onSuccess();
            }
          }
        };

    super.addStyleName("kune-Margin-Large-trbl");
    loginNickOrEmailField =
        new TextField<String>() {
          @Override
          protected void onRender(final Element target, final int index) {
            if (el() == null) {
              setElement(Document.get().getElementById("usernamerender"));
            }
            super.onRender(target, index);
          }

          @Override
          protected void setAriaState(final String stateName, final String stateValue) {}
        };
    loginNickOrEmailField.setFieldLabel(i18n.t("Username"));
    loginNickOrEmailField.setName(USER_FIELD_ID);
    loginNickOrEmailField.setWidth(DEF_SMALL_FIELD_WIDTH);
    loginNickOrEmailField.setAllowBlank(false);
    loginNickOrEmailField.setValidationDelay(3000);
    loginNickOrEmailField.setId(USER_FIELD_ID);
    loginNickOrEmailField.setTabIndex(100);
    loginNickOrEmailField.addStyleName("k-lower");
    loginNickOrEmailField.render(RootPanel.get(LOGIN_ID).getElement());
    ComponentHelper.doAttach(loginNickOrEmailField);
    super.add(loginNickOrEmailField);
    loginNickOrEmailField.addListener(Events.OnKeyPress, enterListener);

    loginPassField =
        new TextField<String>() {
          @Override
          protected void onRender(final Element target, final int index) {
            if (el() == null) {
              final String elementId = "passwordrender";
              setElement(Document.get().getElementById(elementId));
            }
            super.onRender(target, index);
          }

          @Override
          protected void setAriaState(final String stateName, final String stateValue) {}
        };
    loginPassField.setFieldLabel(i18n.t("Password"));
    loginPassField.setName(PASSWORD_FIELD_ID);
    loginPassField.setWidth(DEF_MEDIUM_FIELD_WIDTH);
    loginPassField.setPassword(true);
    loginPassField.setAllowBlank(false);
    loginPassField.setValidationDelay(3000);
    loginPassField.setId(PASSWORD_FIELD_ID);
    loginPassField.setTabIndex(101);
    loginPassField.render(RootPanel.get(LOGIN_ID).getElement());
    ComponentHelper.doAttach(loginPassField);
    loginPassField.addListener(Events.OnKeyPress, enterListener);
    super.add(loginPassField);
  }
Ejemplo n.º 3
0
 @Override
 protected void doDetachChildren() {
   super.doDetachChildren();
   ComponentHelper.doDetach(collapseBtn);
 }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 @Override
 protected void doDetachChildren() {
   super.doDetachChildren();
   ComponentHelper.doDetach(button);
 }