示例#1
0
  /**
   * Requests the service for registered users.<br>
   * On success, adds entries to the grid.
   */
  private void tryGetUsers() {

    AsyncCallback<List<PortalUserSelDTO>> callback =
        new AsyncCallback<List<PortalUserSelDTO>>() {
          public void onFailure(Throwable arg0) {
            MessageBox.alert(
                    commonMessagesBundle.headerErrorWindow(),
                    "No se pudieron obtener los usuarios.",
                    null)
                .setModal(true);
          }

          public void onSuccess(List<PortalUserSelDTO> contentTypes) {
            store.removeAll();
            store.clearFilters();
            filter.setValue(null);

            List<PortalUserSelModelData> lModels = new LinkedList<PortalUserSelModelData>();
            for (PortalUserSelDTO dto : contentTypes) {
              lModels.add(new PortalUserSelModelData(dto));
            }
            store.add(lModels);
          }
        };

    service.getUsers(callback);
  }
示例#2
0
  /**
   * Requests the service for user details. On success displays them on the detail panel.<br>
   *
   * @param portalUser
   */
  private void tryRetrieveAndDisplayDetails(PortalUserSelModelData portalUser) {

    AsyncCallback<PortalUserDTO> callback =
        new AsyncCallback<PortalUserDTO>() {
          public void onFailure(Throwable arg0) {
            MessageBox.alert(
                    commonMessagesBundle.headerErrorWindow(),
                    usersMessagesBundle.msgErrorGettingUserData(),
                    null)
                .setModal(true);
          }

          public void onSuccess(PortalUserDTO user) {
            showDetailsPanel(user);
          }
        };

    service.getById(portalUser.getDTO().getId(), callback);
  }
示例#3
0
  /**
   * Requests the service for passed user deletion.<br>
   *
   * @param userModel
   */
  private void tryRemoveUser(PortalUserSelModelData userModel) {

    AsyncCallback<Void> callback =
        new AsyncCallback<Void>() {
          public void onFailure(Throwable arg0) {
            MessageBox.alert(
                    commonMessagesBundle.headerErrorWindow(),
                    usersMessagesBundle.msgErrorGettingUserData(),
                    null)
                .setModal(true);
          }

          public void onSuccess(Void arg) {
            MessageBox.info("Usuarios", "Usuario eliminado correctamente", null);
            tryGetUsers();
          }
        };

    service.delete(userModel.getDTO().getId(), callback);
  }