Ejemplo n.º 1
0
  /** Instantiates a new change log panel. */
  private ChangeLogPanel() {

    MainPanel.setCommInfo(true);
    try {
      new RequestBuilder(RequestBuilder.GET, "CHANGELOG")
          .sendRequest(
              "",
              new RequestCallback() {
                @Override
                public void onError(Request res, Throwable throwable) {
                  MainPanel.setCommInfo(false);
                  Log.error(throwable.getMessage());
                }

                @Override
                public void onResponseReceived(Request request, Response response) {
                  MainPanel.setCommInfo(false);
                  String text = response.getText();
                  HTML w = new HTML("<p>" + text + "</p>");
                  d.setWidget(w);
                }
              });
    } catch (RequestException e) {
      MainPanel.setCommInfo(false);
      Log.error(e.getMessage());
    }

    d = new DecoratorPanel();
    d.setWidth("100%");

    initWidget(d);
  }
Ejemplo n.º 2
0
  /** Update user. */
  private void updateUser() {
    if (updateMembers()) {
      UserRole role = Ballance_autosauler_net.sessionId.getUserrole();
      if (role.isAdmin()) {
        MainPanel.setCommInfo(true);
        Services.users.updateUser(
            user,
            new AsyncCallback<Boolean>() {

              @Override
              public void onFailure(Throwable caught) {
                MainPanel.setCommInfo(false);
                new AlertDialog(caught).show();
              }

              @Override
              public void onSuccess(Boolean result) {
                MainPanel.setCommInfo(false);

                if (result) {
                  EditUserDialog.this.hide();
                  receiver.onDialogYesButtonClick("reload", null);

                } else {
                  new AlertDialog(M.users.logCreateError()).show();
                }
              }
            });
      }
    }
  }
Ejemplo n.º 3
0
  /**
   * Gets the user.
   *
   * @return the user
   */
  private void getUser() {
    user = null;
    if (editlogin == null) {
      user = new User();
      user.initAsDefault();
      createGUI();
    } else {
      UserRole role = Ballance_autosauler_net.sessionId.getUserrole();
      if (role.isAdmin()) {
        MainPanel.setCommInfo(true);

        Services.users.getUser(
            editlogin,
            new AsyncCallback<User>() {

              @Override
              public void onFailure(Throwable caught) {
                MainPanel.setCommInfo(false);
                new AlertDialog(caught).show();
              }

              @Override
              public void onSuccess(User result) {
                user = result;
                EditUserDialog.this.createGUI();

                MainPanel.setCommInfo(false);
              }
            });
      }
    }
  }