Exemplo n.º 1
0
  @Override
  public void updateView(List<Zone> models) {
    try {
      if (models != null) {
        boolean allOperationsSuccess = true;
        for (Zone model : models) {
          boolean success = true;
          if (model != null) {
            if (model.getErrorMessage() != null) {
              success = false;
              if (allOperationsSuccess) {
                allOperationsSuccess = false;
              }
            } else {
              success = true;
            }
            if ("REMOVE".equalsIgnoreCase(model.getSTATUS())) {
              if (success) {
                listStore.remove(model);
                presenter.removeModelToBeRemoved(model);
              } else {
                Zone oldModel =
                    listStore.findModelWithKey(listStore.getKeyProvider().getKey(model));
                if (oldModel != null) {
                  oldModel.merge(model);
                }
              }
            } else {
              Zone oldModel = listStore.findModelWithKey(listStore.getKeyProvider().getKey(model));
              if (success) {
                model.setErrorMessage(null);
                model.setSTATUS("IGNORE");
              }
              if (oldModel != null) {
                oldModel.merge(model);
              }
            }
          }
        }
        if (allOperationsSuccess) {
          formReset();
          presenter.clearModelsToBeRemoved();
          listStore.commitChanges();
        }
        grid.getView().refresh(false);
      }
    } catch (Exception ex) {
      ViewUtils.notify(htmlMessage, new SystemMessage(ex.getMessage()));
      Window.alert(ex.getMessage());
      ex.printStackTrace(System.out);
    } finally {
      Info.display(messages.message(), messages.finished());

      if (box != null) {
        box.hide();
        box = null;
      }
    }
  }
Exemplo n.º 2
0
 @Override
 public void formUpdated() {
   if (!presenter.isUpdatePending()) {
     callback.viewChanged(
         presenter.getHeaderTitle() != null ? presenter.getHeaderTitle() : widget.getTitle());
   }
   presenter.setUpdatePending(true);
 }
Exemplo n.º 3
0
 @Override
 public void criteria() {
   if (presenter.isUpdatePending() && !Window.confirm(messages.updatePendingContinue())) {
     return;
   }
   filters.clearFilters();
   resetForm();
 }
Exemplo n.º 4
0
 @Override
 public void remove() {
   List<Zone> Zones = grid.getSelectionModel().getSelectedItems();
   for (Zone Zone : Zones) {
     if (Zone.getEntityId() != null) {
       presenter.addModelToBeRemoved(Zone);
       Zone foundModel = listStore.findModelWithKey(listStore.getKeyProvider().getKey(Zone));
       if (foundModel != null) {
         foundModel.setSTATUS("REMOVE");
       }
     }
   }
   listStore.commitChanges();
   grid.getView().refresh(false);
 }
Exemplo n.º 5
0
 @Override
 public void formReset() {
   presenter.removeUpdatedZone(widget.getTitle());
   callback.viewReset(
       presenter.getHeaderTitle() != null ? presenter.getHeaderTitle() : widget.getTitle());
   presenter.setUpdatePending(false);
   if (presenter.getHeaderModel() != null) {
     panel.setHeadingText(messages.commune() + " (" + presenter.getHeaderModel().getNom() + ")");
   } else {
     panel.setHeadingText(
         messages.commune() + " (" + messages.noHeaderSelected(messages.commune()) + ")");
   }
 }
Exemplo n.º 6
0
 @Override
 protected boolean isSearchPending() {
   return presenter.isSearchPending();
 }
Exemplo n.º 7
0
 @Override
 protected boolean isUpdatePending() {
   return presenter.isUpdatePending();
 }
Exemplo n.º 8
0
 @Override
 protected void setModelsToBePersisted(ListStore<Zone> listStore) {
   presenter.setModelsToBePersisted(listStore);
 }
Exemplo n.º 9
0
 @Override
 protected void execute(ActionCommand command, UserRequestCallbackAdapter<Zone> urc) {
   presenter.getEventBus().executeZone(command, urc);
 }