Пример #1
0
  @Override
  protected void afterRender() {
    super.afterRender();

    setTabIndex(tabIndex);

    setIcon(icon);

    autoWidth();
  }
Пример #2
0
  private FormPanel setupButtonPanel(int tabIndex) {
    FormPanel buttonPanel = new FormPanel();
    buttonPanel.setHeaderVisible(false);
    buttonPanel.setBodyBorder(false);
    buttonPanel.setStyleAttribute("paddingRight", "10px");
    buttonPanel.setButtonAlign(HorizontalAlignment.CENTER);

    searchButton =
        new Button(
            "Search Event",
            IconHelper.create("images/search_icon_16x16.png"),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {

                searchCriteria = new AuditEventSearchCriteriaWeb();
                if (!startDate.validate() || !endDate.validate()) {
                  Info.display(
                      "Warning",
                      "You must enter valid format of date before pressing the search button.");
                  return;
                }
                searchCriteria.setStartDateTime(Utility.DateTimeToString(startDate.getValue()));
                searchCriteria.setEndDateTime(Utility.DateTimeToString(endDate.getValue()));

                Set<AuditEventTypeWeb> ids = new HashSet<AuditEventTypeWeb>();
                if (evenyTypes.getSelectionModel().getSelection().size() > 0) {
                  List<AuditEventTypeWeb> types = evenyTypes.getSelectionModel().getSelection();
                  for (AuditEventTypeWeb type : types) {
                    // Info.display("Information", "Event Type: "+type.getAuditEventTypeName());
                    ids.add(type);
                  }
                  searchCriteria.setAuditEventTypes(ids);
                }

                searchCriteria.setFirstResult(new Integer(0));
                searchCriteria.setMaxResults(PAGE_SIZE);

                // // controller.handleEvent(new AppEvent(AppEvents.AuditEventRequest,
                // searchCriteria));

                PagingLoadConfig config = new BasePagingLoadConfig();
                config.setOffset(0);
                config.setLimit(PAGE_SIZE);

                pagingLoader.load(config);

                status.show();
                searchButton.mask();
              }
            });

    cancelButton =
        new Button(
            "Reset",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                selectedEvenyTypes.setValue("");
                evenyTypes.getSelectionModel().deselectAll();
                startDate.clear();
                endDate.clear();
                searchButton.disable();
              }
            });

    searchButton.setTabIndex(tabIndex++);
    cancelButton.setTabIndex(tabIndex++);
    searchButton.disable();

    status = new Status();
    status.setBusy("please wait...");
    buttonPanel.getButtonBar().add(status);
    status.hide();

    buttonPanel.getButtonBar().setSpacing(15);
    buttonPanel.addButton(searchButton);
    buttonPanel.addButton(cancelButton);

    return buttonPanel;
  }
Пример #3
0
  private FormPanel setupButtonPanel(int tabIndex) {
    FormPanel buttonPanel = new FormPanel();
    buttonPanel.setHeaderVisible(false);
    buttonPanel.setBodyBorder(false);
    buttonPanel.setStyleAttribute("paddingRight", "10px");
    buttonPanel.setButtonAlign(HorizontalAlignment.CENTER);

    submitButton =
        new Button(
            "Save",
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                // Info.display("test:", "save componentSelected");
                if (!leftFormPanel.isValid() || !rightFormPanel.isValid()) {
                  Info.display("test:", "Invalid fields");
                  return;
                }

                if (passwordNew.getValue() != null || passwordConfirm.getValue() != null) {
                  if (passwordNew.getValue() == null
                      || passwordConfirm.getValue() == null
                      || !passwordNew.getValue().equals(passwordConfirm.getValue())) {
                    MessageBox.alert(
                        "Information", "Confirm password is not same as new password", null);
                    return;
                  }
                }

                if (!email.getValue().equals(emailConfirm.getValue())) {
                  MessageBox.alert(
                      "Information", "Confirm email address is not same as email address", null);
                  return;
                }

                // check current password
                UserWeb user = copyUserFromGUI(updateUser);
                user.setPassword(password.getValue());
                controller.handleEvent(new AppEvent(AppEvents.ProfileVarifyPasswordInitiate, user));

                //				UserWeb user = copyUserFromGUI(updateUser);
                //				controller.handleEvent(new AppEvent(AppEvents.ProfileUpdateInitiate, user));
                status.show();
                submitButton.mask();
              }
            });

    cancelButton =
        new Button(
            "Reset",
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent ce) {
                clearFormFields(true);
              }
            });

    submitButton.setTabIndex(tabIndex++);
    cancelButton.setTabIndex(tabIndex++);

    status = new Status();
    status.setBusy("please wait...");
    buttonPanel.getButtonBar().add(status);
    status.hide();

    buttonPanel.getButtonBar().setSpacing(15);
    buttonPanel.addButton(submitButton);
    buttonPanel.addButton(cancelButton);

    return buttonPanel;
  }