Exemplo n.º 1
0
  private void createViewDSInfoPanel() {
    BorderLayoutData data = new BorderLayoutData(Style.LayoutRegion.EAST, 475, 100, 750);
    data.setMargins(new Margins(1, 1, 1, 5));
    data.setCollapsible(true);

    viewDsInfoPanel = new ContentPanel();
    viewDsInfoPanel.setLayout(new CenterLayout());
    viewDsInfoPanel.setLayoutOnChange(true);
    //        filterPanel.setAnimCollapse(true);
    viewDsInfoPanel.setId("eastPanel");
    viewDsInfoPanel.setBodyBorder(false);
    viewDsInfoPanel.setIcon(HarvesterUI.ICONS.view_info_icon());
    viewDsInfoPanel.setHeading(HarvesterUI.CONSTANTS.viewDataSetInformation());
    LabelToolItem noDsSelectedLabel = new LabelToolItem(HarvesterUI.CONSTANTS.noDataSetSelected());
    noDsSelectedLabel.setStyleName("noDataSetSelected");
    viewDsInfoPanel.add(noDsSelectedLabel);

    mainBorderLayout.addListener(
        Events.Expand,
        new Listener<BorderLayoutEvent>() {
          @Override
          public void handleEvent(BorderLayoutEvent be) {
            if (be.getRegion().equals(Style.LayoutRegion.EAST)) setOnExpandDataSet();
          }
        });

    mainGridPanel.add(viewDsInfoPanel, data);
  }
Exemplo n.º 2
0
 private void emptyDataSetPanel() {
   // Only do when visible to enhance performance
   if (viewDsInfoPanel.isExpanded()) {
     viewDsInfoPanel.removeAll();
     LabelToolItem noDsSelectedLabel =
         new LabelToolItem(HarvesterUI.CONSTANTS.noDataSetSelected());
     noDsSelectedLabel.setStyleName("noDataSetSelected");
     viewDsInfoPanel.setLayout(new CenterLayout());
     viewDsInfoPanel.setHeading(HarvesterUI.CONSTANTS.viewDataSetInformation());
     viewDsInfoPanel.add(noDsSelectedLabel);
   }
 }
Exemplo n.º 3
0
  private void createDatePickerDialog() {
    dpDialog = new Dialog();
    dpDialog.setHeading(HarvesterUI.CONSTANTS.datePicker());
    dpDialog.setIcon(HarvesterUI.ICONS.calendar());
    dpDialog.setButtons("");
    dpDialog.setResizable(false);
    dpDialog.setWidth(400);
    dpDialog.setHeight(250);
    dpDialog.setLayout(new FitLayout());
    dpDialog.setBodyStyleName("pad-text");
    dpDialog.setHideOnButtonClick(true);

    DatePicker datePicker = new DatePicker();
    datePicker.setValue(new Date());
    datePicker.addListener(
        Events.Select,
        new Listener<DatePickerEvent>() {
          public void handleEvent(DatePickerEvent be) {
            calendar.setDate(be.getDate());
            DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            String result = formatter.format(calendar.getDate());
            currentMonthAndYear.setText(result);
            calendarTaskManager.updateScheduleTasks();
          }
        });

    dpDialog.add(datePicker);
  }
Exemplo n.º 4
0
  public void loadGridFilteredData(List<FilterQuery> filterQueries) {
    UtilManager.maskCentralPanel(HarvesterUI.CONSTANTS.loadingMainData());
    getPagingToolBar().showRefreshIconRunning(true);
    AsyncCallback<DataContainer> callback =
        new AsyncCallback<DataContainer>() {
          public void onFailure(Throwable caught) {
            new ServerExceptionDialog("Failed to get response from server", caught.getMessage())
                .show();
          }

          public void onSuccess(DataContainer mainDataParent) {
            store.removeAll();
            store.add(mainDataParent.getChildren(), true);

            mainDataGrid.expandAll();

            selectPreviouslySelectedItem();
            resetScrollBarPos();

            getPagingToolBar().showRefreshIconRunning(false);
            UtilManager.unmaskCentralPanel();
          }
        };
    FilterServiceAsync service = (FilterServiceAsync) Registry.get(HarvesterUI.FILTER_SERVICE);
    service.getFilteredData(filterQueries, callback);
  }
Exemplo n.º 5
0
 /**
  * ******************************************************* View Info Side Panel Functions
  * ********************************************************
  */
 private void editPanelInfo(DataSourceUI dataSourceUI) {
   // Only do when visible to enhance performance
   if (viewDsInfoPanel.isExpanded()) {
     DataSetSideViewInfo dataSetViewInfo = new DataSetSideViewInfo();
     dataSetViewInfo.createForm(dataSourceUI);
     viewDsInfoPanel.removeAll();
     viewDsInfoPanel.setLayout(new FitLayout());
     viewDsInfoPanel.add(dataSetViewInfo);
     viewDsInfoPanel.setHeading(
         HarvesterUI.CONSTANTS.viewDataSet()
             + ": "
             + dataSourceUI.getDataSourceSet()
             + " ("
             + HarvesterUI.CONSTANTS.dataProvider()
             + ": "
             + dataSourceUI.getDataSetParent().getName()
             + ")");
   }
 }
Exemplo n.º 6
0
  public IngestTypeFilter(BrowseFilterPanel browseFilterPanel) {
    super(browseFilterPanel);

    setText(HarvesterUI.CONSTANTS.ingestTypes());

    Menu rangeMenu = new Menu();
    rangeMenu.add(createCheckedCountryList());
    rangeMenu.add(new SeparatorMenuItem());
    rangeMenu.add(createCountryList());
    setMenu(rangeMenu);
  }
Exemplo n.º 7
0
  private void createViewsButtons(ToolBar calendarToolbar) {
    final ToggleButton oneDay = new ToggleButton("<b>" + HarvesterUI.CONSTANTS.oneDay() + "</b>");
    final ToggleButton threeDay =
        new ToggleButton("<b>" + HarvesterUI.CONSTANTS.threeDay() + "</b>");
    final ToggleButton week = new ToggleButton("<b>" + HarvesterUI.CONSTANTS.week() + "</b>");
    final ToggleButton month = new ToggleButton("<b>" + HarvesterUI.CONSTANTS.month() + "</b>");
    month.toggle();

    oneDay.addListener(
        Events.OnClick,
        new Listener<ButtonEvent>() {
          public void handleEvent(ButtonEvent ce) {
            threeDay.toggle(false);
            week.toggle(false);
            month.toggle(false);
            oneDay.toggle(true);
            calendar.setView(CalendarViews.DAY, 1);
          }
        });

    threeDay.addListener(
        Events.OnClick,
        new Listener<ButtonEvent>() {
          public void handleEvent(ButtonEvent ce) {
            threeDay.toggle(true);
            week.toggle(false);
            month.toggle(false);
            oneDay.toggle(false);
            calendar.setView(CalendarViews.DAY, 3);
          }
        });

    week.addListener(
        Events.OnClick,
        new Listener<ButtonEvent>() {
          public void handleEvent(ButtonEvent ce) {
            threeDay.toggle(false);
            week.toggle(true);
            month.toggle(false);
            oneDay.toggle(false);
            calendar.setView(CalendarViews.DAY, 7);
          }
        });

    month.addListener(
        Events.OnClick,
        new Listener<ButtonEvent>() {
          public void handleEvent(ButtonEvent ce) {
            threeDay.toggle(false);
            week.toggle(false);
            month.toggle(true);
            oneDay.toggle(false);
            calendar.setView(CalendarViews.MONTH);
          }
        });

    calendarToolbar.add(oneDay);
    calendarToolbar.add(threeDay);
    calendarToolbar.add(week);
    calendarToolbar.add(month);
  }
Exemplo n.º 8
0
  private ToolBar createCalendarToolbar() {
    ToolBar calendarToolbar = new ToolBar();

    currentMonthAndYear = new Button();
    DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
    String result = formatter.format(calendar.getDate());
    currentMonthAndYear.setText(result);
    currentMonthAndYear.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            dpDialog.show();
            dpDialog.center();
          }
        });

    Button today = new Button("<b>" + HarvesterUI.CONSTANTS.today() + "</b>");
    today.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            ((DatePicker) dpDialog.getItem(0)).setValue(new Date());
            //                DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            //                String result = formatter.format(calendar.getDate());
            //                currentMonthAndYear.setText(result);
            //                calendarTaskManager.updateScheduleTasks();
          }
        });

    Button yearLeft = new Button("<b>" + "<<" + "</b>");
    yearLeft.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            DateWrapper dw = new DateWrapper(calendar.getDate());
            ((DatePicker) dpDialog.getItem(0)).setValue(dw.addMonths(-1).asDate());
            //                DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            //                String result = formatter.format(calendar.getDate());
            //                currentMonthAndYear.setText(result);
            //                calendarTaskManager.updateScheduleTasks();
          }
        });

    Button yearRight = new Button("<b>" + ">>" + "</b>");
    yearRight.addSelectionListener(
        new SelectionListener<ButtonEvent>() {
          @Override
          public void componentSelected(ButtonEvent ce) {
            DateWrapper dw = new DateWrapper(calendar.getDate());
            ((DatePicker) dpDialog.getItem(0)).setValue(dw.addMonths(1).asDate());
            //                DateTimeFormat formatter = DateTimeFormat.getFormat("MMMM yyyy");
            //                String result = formatter.format(calendar.getDate());
            //                currentMonthAndYear.setText(result);
            //                calendarTaskManager.updateScheduleTasks();
          }
        });

    calendarToolbar.add(today);
    calendarToolbar.add(new SeparatorToolItem());
    calendarToolbar.add(yearLeft);
    calendarToolbar.add(currentMonthAndYear);
    calendarToolbar.add(yearRight);
    calendarToolbar.add(new SeparatorToolItem());

    calendarToolbar.add(new FillToolItem());
    createViewsButtons(calendarToolbar);

    return calendarToolbar;
  }
Exemplo n.º 9
0
  private void createMainGrid() {
    store = new TreeStore<ModelData>();

    mainDataGrid =
        new TreeGrid<DataContainer>(store, createColumnModel()) {
          @Override
          protected void onRender(Element parent, int index) {
            super.onRender(parent, index);
            if (HarvesterUI.UTIL_MANAGER
                .getLoggedUserName()
                .equals(HarvesterUI.CONSTANTS.anonymous())) {
              mainDataGrid.removeAllListeners();
            }

            DeferredCommand.addCommand(
                new Command() {
                  public void execute() {
                    browseFilterPanel.setExpanded(false);
                    viewDsInfoPanel.setExpanded(false);
                  }
                });
          }
        };

    mainDataGrid.setAutoExpand(true);
    //        mainDataGrid.getTreeView().setBufferEnabled(false);
    mainDataGrid.setTrackMouseOver(false);
    mainDataGrid.setExpandOnFilter(true);
    mainDataGrid.setId("MainDataGrid01");
    //        mainDataGrid.setStateId("MainDataGridStateID01");
    mainDataGrid.setColumnLines(true);
    mainDataGrid.getView().setEmptyText(HarvesterUI.CONSTANTS.noDataAvailable());
    mainDataGrid.setStripeRows(true);
    //        mainDataGrid.setStateful(true);
    mainDataGrid.setColumnReordering(true);
    mainDataGrid.disableTextSelection(false);
    mainDataGrid.setSelectionModel(mainGridSelectionModel);
    mainDataGrid.addPlugin(mainGridSelectionModel);
    mainDataGrid
        .getSelectionModel()
        .addSelectionChangedListener(
            new SelectionChangedListener<DataContainer>() {
              @Override
              public void selectionChanged(SelectionChangedEvent<DataContainer> se) {
                if (se.getSelectedItem() != null) {
                  selectedItemIndex = mainDataGrid.getStore().indexOf(se.getSelectedItem());
                  if (se.getSelectedItem() instanceof AggregatorUI) {
                    overviewGridAggregatorOperations.showButtons(topToolbar);
                    overviewGridDataSetOperations.hideButtons(topToolbar);
                    overviewGridDataProviderOperations.hideButtons(topToolbar);
                  } else if (se.getSelectedItem() instanceof DataProviderUI) {
                    DataProviderUI dataProviderUI = (DataProviderUI) se.getSelectedItem();
                    if (dataProviderUI.getDataSourceUIList().size() == 1) {
                      overviewGridDataSetOperations.showButtons(topToolbar);
                      overviewGridDataProviderOperations.showButtons(topToolbar);
                      overviewGridAggregatorOperations.hideButtons(topToolbar);
                      editPanelInfo(dataProviderUI.getDataSourceUIList().get(0));
                    } else {
                      overviewGridDataProviderOperations.showButtons(topToolbar);
                      overviewGridDataSetOperations.hideButtons(topToolbar);
                      overviewGridAggregatorOperations.hideButtons(topToolbar);
                    }
                  } else if (se.getSelectedItem() instanceof DataSourceUI) {
                    overviewGridDataSetOperations.showButtons(topToolbar);
                    overviewGridAggregatorOperations.hideButtons(topToolbar);
                    overviewGridDataProviderOperations.hideButtons(topToolbar);
                    editPanelInfo((DataSourceUI) se.getSelectedItem());
                  }
                } else {
                  emptyDataSetPanel();
                  overviewGridDataSetOperations.hideButtons(topToolbar);
                  overviewGridAggregatorOperations.hideButtons(topToolbar);
                  overviewGridDataProviderOperations.hideButtons(topToolbar);
                }
              }
            });

    //        mainDataGrid.addListener(Events.Attach, new Listener<GridEvent<BaseTreeModel>>() {
    //            public void handleEvent(GridEvent<BaseTreeModel> be) {
    //                reloadMainData();
    //            }
    //        });

    // Comparator
    final MainGridDefaultComparator mainGridDefaultComparator = new MainGridDefaultComparator();
    store.setStoreSorter(
        new StoreSorter<ModelData>() {
          @Override
          public int compare(Store<ModelData> store, ModelData m1, ModelData m2, String property) {
            return mainGridDefaultComparator.compareMainGridItem(store, m1, m2, property);
          }
        });

    TreeGridView mainGridViewConfig = new TreeGridView();
    mainGridViewConfig.setViewConfig(
        new GridViewConfig() {
          @Override
          public String getRowStyle(ModelData model, int rowIndex, ListStore<ModelData> ds) {
            if (HarvesterUI.getProjectType().equals("EUDML")) {
              if (model instanceof DataProviderUI) {
                if (((DataProviderUI) model).getDataSourceUIList().size() == 1) {
                  return "ULTRA_LIGHT_ORANGE";
                } else if (((DataProviderUI) model).getDataSourceUIList().size() > 1)
                  return "LIGHT_ORANGE";
                return "WHITE";
              }
              return "WHITE";
            } else {
              if (model instanceof AggregatorUI) {
                return "AGGREGATOR_STYLE";
              } else if (model instanceof DataProviderUI) {
                if (((DataProviderUI) model).getDataSourceUIList().size() == 1) {
                  return "DP_SINGLE_DS_STYLE";
                } else if (((DataProviderUI) model).getDataSourceUIList().size() > 1)
                  return "DP_MANY_DS_STYLE";
                return "WHITE";
              }
              return "WHITE";
            }
          }
        });
    mainGridViewConfig.setForceFit(true);
    mainDataGrid.setView(mainGridViewConfig);

    mainDataGrid.setIconProvider(
        new ModelIconProvider<DataContainer>() {
          public AbstractImagePrototype getIcon(DataContainer model) {
            if (model instanceof AggregatorUI) {
              return HarvesterUI.ICONS.aggregator_icon();
            } else if (model instanceof DataProviderUI) {
              return HarvesterUI.ICONS.data_provider_icon();
            } else if (model instanceof DataSourceUI) {
              return HarvesterUI.ICONS.data_set_icon();
            }
            return null;
          }
        });

    OverviewGridContextMenus overviewGridContextMenus = new OverviewGridContextMenus(mainDataGrid);
    overviewGridContextMenus.createTreeContextMenu();

    overviewGridDataSetOperations = new OverviewGridDataSetOperations(mainDataGrid);
    overviewGridAggregatorOperations = new OverviewGridAggregatorOperations(mainDataGrid);
    overviewGridDataProviderOperations = new OverviewGridDataProviderOperations(mainDataGrid);

    BorderLayoutData data = new BorderLayoutData(Style.LayoutRegion.CENTER);
    mainGridPanel.add(mainDataGrid, data);
  }
Exemplo n.º 10
0
  private ColumnModel createColumnModel() {
    ArrayList<ColumnConfig> columns = new ArrayList<ColumnConfig>();

    mainGridSelectionModel = new CheckBoxSelectionModel<ModelData>();
    mainGridSelectionModel.setSelectionMode(Style.SelectionMode.MULTI);
    columns.add(mainGridSelectionModel.getColumn());

    countryColumn = new ColumnConfig("country", HarvesterUI.ICONS.worldmap().getHTML(), 35);
    countryColumn.setAlignment(Style.HorizontalAlignment.CENTER);

    countryColumn.setRenderer(
        new GridCellRenderer<ModelData>() {
          public Object render(
              ModelData model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<ModelData> store,
              Grid<ModelData> grid) {
            if (model instanceof DataProviderUI) {
              if (model.get("country") != null && !model.get("country").equals("none")) {
                return "<img src=\"resources/images/countries/"
                    + model.get("country")
                    + ".png\" alt=\""
                    + model.get("countryName")
                    + "\" title=\""
                    + model.get("countryName")
                    + "\"/> ";
              }
            }
            return "";
          }
        });
    columns.add(countryColumn);

    ColumnConfig name =
        new ColumnConfig("name", "<CENTER>" + HarvesterUI.CONSTANTS.name() + "</CENTER>", 100);
    name.setRenderer(new TreeGridCellRenderer<ModelData>());
    name.setWidth(260);
    columns.add(name);

    // Europeana column only
    if (HarvesterUI.getProjectType().equals("EUROPEANA")) {
      ColumnConfig nameCode =
          new ColumnConfig(
              "nameCode", "<CENTER>" + HarvesterUI.CONSTANTS.nameCodeHeader() + "</CENTER>", 100);
      columns.add(nameCode);
    }

    ColumnConfig dataSourceSet =
        new ColumnConfig(
            "dataSourceSet", "<CENTER>" + HarvesterUI.CONSTANTS.dataSetHeader() + "</CENTER>", 100);
    columns.add(dataSourceSet);

    ColumnConfig metadataFormat =
        new ColumnConfig(
            "metadataFormat",
            "<CENTER>" + HarvesterUI.CONSTANTS.oaiSchemasHeader() + "</CENTER>",
            100);
    metadataFormat.setWidth(110);
    columns.add(metadataFormat);

    ColumnConfig ingest =
        new ColumnConfig(
            "ingest", "<CENTER>" + HarvesterUI.CONSTANTS.ingestTypeHeader() + "</CENTER>", 150);
    ingest.setRenderer(new IngestTypeRenderer());
    columns.add(ingest);
    ColumnConfig lastIngest =
        new ColumnConfig(
            "lastIngest", "<CENTER>" + HarvesterUI.CONSTANTS.lastIngestHeader() + "</CENTER>", 100);
    lastIngest.setWidth(130);
    lastIngest.setAlignment(Style.HorizontalAlignment.CENTER);
    lastIngest.setRenderer(new LastIngestRenderer());
    columns.add(lastIngest);
    ColumnConfig nextIngest =
        new ColumnConfig(
            "nextIngest", "<CENTER>" + HarvesterUI.CONSTANTS.nextIngestHeader() + "</CENTER>", 100);
    nextIngest.setRenderer(new NextIngestRenderer());
    nextIngest.setAlignment(Style.HorizontalAlignment.CENTER);
    nextIngest.setWidth(130);
    columns.add(nextIngest);
    ColumnConfig records =
        new ColumnConfig(
            "records", "<CENTER>" + HarvesterUI.CONSTANTS.records() + "</CENTER>", 100);
    records.setAlignment(Style.HorizontalAlignment.RIGHT);
    records.setRenderer(new RecordsRenderer());
    columns.add(records);
    ColumnConfig ingestStatus =
        new ColumnConfig(
            "status", "<CENTER>" + HarvesterUI.CONSTANTS.ingestStatusHeader() + "</CENTER>", 100);
    ingestStatus.setRenderer(new IngestStatusRenderer());
    ingestStatus.setAlignment(Style.HorizontalAlignment.CENTER);
    columns.add(ingestStatus);

    return new ColumnModel(columns);
  }
Exemplo n.º 11
0
  private void createNewUSerDialog() {
    setButtons("");
    setLayout(new FitLayout());
    setHeading(HarvesterUI.CONSTANTS.addUser());
    setIcon(HarvesterUI.ICONS.add16());
    setResizable(false);
    setModal(true);
    setSize(600, 200);
    setBodyBorder(false);
    FormData formData = new FormData("95%");

    newUserFormPanel = new DefaultFormPanel();
    newUserFormPanel.setHeaderVisible(false);

    newUserFormPanel.setLayout(new EditableFormLayout(175));

    userNameField = new TextField<String>();
    userNameField.setFieldLabel(HarvesterUI.CONSTANTS.username() + HarvesterUI.REQUIRED_STR);
    userNameField.setId("userNameField");
    userNameField.setMinLength(4);
    userNameField.setAllowBlank(false);
    newUserFormPanel.add(userNameField, formData);

    Validator usernameValidator =
        new Validator() {
          public String validate(Field<?> field, String s) {
            if (!s.matches("^[A-Za-z0-9]+(?:[ _-][A-Za-z0-9]+)*$"))
              return HarvesterUI.CONSTANTS.usernameValidateMessage();
            return null;
          }
        };
    userNameField.setValidator(usernameValidator);

    emailField = new TextField<String>();
    emailField.setFieldLabel(HarvesterUI.CONSTANTS.email() + HarvesterUI.REQUIRED_STR);
    emailField.setId("emailField");
    emailField.setAllowBlank(false);
    newUserFormPanel.add(emailField, formData);

    Validator emailValidator =
        new Validator() {
          public String validate(Field<?> field, String s) {
            if (!s.matches("[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"))
              return HarvesterUI.CONSTANTS.emailValidateMessage();
            return null;
          }
        };
    emailField.setValidator(emailValidator);

    roleCombo = new SimpleComboBox<String>();
    roleCombo.setEditable(false);
    roleCombo.setFieldLabel(HarvesterUI.CONSTANTS.role() + HarvesterUI.REQUIRED_STR);
    roleCombo.setTriggerAction(ComboBox.TriggerAction.ALL);
    for (UserRole userRole : UserRole.values()) {
      if (userRole != UserRole.ANONYMOUS) roleCombo.add(userRole.name());
    }
    roleCombo.setValue(roleCombo.getStore().getAt(0));
    newUserFormPanel.add(roleCombo, formData);

    saveButton =
        new Button(
            HarvesterUI.CONSTANTS.save(),
            HarvesterUI.ICONS.save_icon(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent be) {
                AsyncCallback<User> callback =
                    new AsyncCallback<User>() {
                      public void onFailure(Throwable caught) {
                        new ServerExceptionDialog(
                                "Failed to get response from server", caught.getMessage())
                            .show();
                      }

                      public void onSuccess(User user) {
                        AsyncCallback<ResponseState> callback =
                            new AsyncCallback<ResponseState>() {
                              public void onFailure(Throwable caught) {
                                new ServerExceptionDialog(
                                        "Failed to get response from server", caught.getMessage())
                                    .show();
                              }

                              public void onSuccess(ResponseState result) {
                                unmask();
                                if (result == ResponseState.USER_ALREADY_EXISTS) {
                                  HarvesterUI.UTIL_MANAGER.getErrorBox(
                                      HarvesterUI.CONSTANTS.newUser(),
                                      HarvesterUI.CONSTANTS.usernameAlreadyExists());
                                  return;
                                }
                                hide();
                                userManagementGrid.getStore().add(newUser);
                                HarvesterUI.UTIL_MANAGER.getSaveBox(
                                    HarvesterUI.CONSTANTS.newUser(),
                                    HarvesterUI.CONSTANTS.saveNewUserSuccess());
                                Dispatcher.get().dispatch(AppEvents.ViewUserManagementForm);
                              }
                            };
                        mask(HarvesterUI.CONSTANTS.saveUserMask());
                        newUserFormPanel.submit();
                        String role = roleCombo.getValue().getValue().trim();
                        String userName = userNameField.getValue().trim();
                        String email = emailField.getValue().trim();
                        String password = "******";
                        newUser = new User(userName, password, role, email, 15);
                        service.saveNewUser(newUser, callback);
                      }
                    };
                String userName = userNameField.getValue();
                service.getUser(userName, callback);
              }
            });
    newUserFormPanel.addButton(saveButton);
    newUserFormPanel.addButton(
        new Button(
            HarvesterUI.CONSTANTS.cancel(),
            HarvesterUI.ICONS.cancel_icon(),
            new SelectionListener<ButtonEvent>() {
              @Override
              public void componentSelected(ButtonEvent be) {
                hide();
                Dispatcher.get().dispatch(AppEvents.ViewUserManagementForm);
              }
            }));

    newUserFormPanel.setButtonAlign(Style.HorizontalAlignment.CENTER);

    FormButtonBinding binding = new FormButtonBinding(newUserFormPanel);
    binding.addButton(saveButton);

    add(newUserFormPanel);
  }