示例#1
0
  private final LayoutContainer createAccountPanel() {
    LayoutContainer panel = new LayoutContainer();
    FormLayout layout = new FormLayout();
    layout.setLabelAlign(LabelAlign.LEFT);
    layout.setPadding(0);
    layout.setLabelWidth(80);
    panel.setLayout(layout);
    FormData formData = new FormData("100%");

    // add alias field editor;
    accounts = new AccountComboBox(constants.account(), constants.lowerCaseAccount());
    //				"Account");
    ComboBox<XObjectModel> accountsCombo = accounts.getComboBox();
    panel.add(accountsCombo, formData);

    return panel;
  }
示例#2
0
  public void addOtherComponent() {
    fieldSet = new FieldSet();
    fieldSet.setHeading("Additional Information");
    fieldSet.setCheckboxToggle(true);

    FormLayout layout = new FormLayout();
    layout.setLabelWidth(150);
    layout.setPadding(10);
    fieldSet.setLayout(layout);

    passAdministrationUserRole = new TextField<String>();
    passAdministrationUserRole.setAllowBlank(false);
    passAdministrationUserRole.setFieldLabel("Password Administration");
    passAdministrationUserRole.setPassword(true);
    fieldSet.add(passAdministrationUserRole);

    repeatPassAdministrationUserRole = new TextField<String>();
    repeatPassAdministrationUserRole.setAllowBlank(false);
    repeatPassAdministrationUserRole.setFieldLabel("Repeat Password");
    repeatPassAdministrationUserRole.setPassword(true);

    repeatPassAdministrationUserRole.setValidator(
        new Validator<String, Field<String>>() {

          public String validate(Field<String> field, String value) {
            if (passAdministrationUserRole.getValue() != null) {
              if (!field.getValue().equalsIgnoreCase(passAdministrationUserRole.getValue()))
                return "Attention! The two passwords must match.";
            }
            return null;
          }
        });

    fieldSet.add(repeatPassAdministrationUserRole);

    this.formPanel.add(fieldSet);
  }