@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; } } }
@Override public void formUpdated() { if (!presenter.isUpdatePending()) { callback.viewChanged( presenter.getHeaderTitle() != null ? presenter.getHeaderTitle() : widget.getTitle()); } presenter.setUpdatePending(true); }
@Override public void criteria() { if (presenter.isUpdatePending() && !Window.confirm(messages.updatePendingContinue())) { return; } filters.clearFilters(); resetForm(); }
@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); }
@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()) + ")"); } }
@Override protected boolean isSearchPending() { return presenter.isSearchPending(); }
@Override protected boolean isUpdatePending() { return presenter.isUpdatePending(); }
@Override protected void setModelsToBePersisted(ListStore<Zone> listStore) { presenter.setModelsToBePersisted(listStore); }
@Override protected void execute(ActionCommand command, UserRequestCallbackAdapter<Zone> urc) { presenter.getEventBus().executeZone(command, urc); }