예제 #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;
      }
    }
  }
예제 #2
0
 @Override
 public void ignore() {
   List<Zone> Zones = grid.getSelectionModel().getSelectedItems();
   for (Zone Zone : Zones) {
     Zone foundModel = listStore.findModelWithKey(listStore.getKeyProvider().getKey(Zone));
     if (foundModel != null) {
       foundModel.setSTATUS("IGNORE");
     }
   }
   listStore.commitChanges();
   grid.getView().refresh(false);
 }
예제 #3
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);
 }