@Override
 public void onSuccess(UpdateTransUnitResult result) {
   TransUnit updatedTU = result.getUpdateInfoList().get(0).getTransUnit();
   Log.debug("save resulted TU: " + updatedTU.debugString());
   if (result.isSingleSuccess()) {
     eventBus.fireEvent(
         new NotificationEvent(
             NotificationEvent.Severity.Info,
             messages.notifyUpdateSaved(updatedTU.getRowIndex(), updatedTU.getId().toString()),
             goToRowLink));
     int rowIndexOnPage = navigationService.findRowIndexById(updatedTU.getId());
     if (rowIndexOnPage != NavigationService.UNDEFINED) {
       UndoLink undoLink = undoLinkProvider.get();
       undoLink.prepareUndoFor(result);
       targetContentsPresenter.addUndoLink(rowIndexOnPage, undoLink);
       navigationService.updateDataModel(updatedTU);
       targetContentsPresenter.confirmSaved(updatedTU);
       targetContentsPresenter.setFocus();
     }
     queue.removeSaved(event, updatedTU.getVerNum());
   } else {
     saveFailure(result.getUpdateInfoList().get(0).getErrorMessage());
   }
   if (queue.hasPending()) {
     performSave(id);
   }
 }
Ejemplo n.º 2
0
  @Override
  public void addUndo(final UndoLink undoLink) {
    undoLink.setLinkStyle("icon-undo " + style.button());
    undoLink.setUndoCallback(
        new UndoLink.UndoCallback() {
          @Override
          public void preUndo() {
            undoLink.setLinkStyle("icon-progress " + style.button());
          }

          @Override
          public void postUndoSuccess() {
            undoContainer.remove(undoLink);
          }
        });
    undoContainer.setWidget(undoLink);
  }