@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);
   }
 }
  @Test
  public void canConfirmSavedOnSavingState() {
    selectedTU = currentPageRows.get(1);
    when(display.getId()).thenReturn(selectedTU.getId());
    when(display.getEditingState()).thenReturn(TargetContentsDisplay.EditingState.SAVING);
    presenter.setStatesForTesting(selectedTU.getId(), 0, display);

    presenter.confirmSaved(selectedTU);

    verify(display)
        .updateCachedTargetsAndVersion(
            selectedTU.getTargets(), selectedTU.getVerNum(), selectedTU.getStatus());
    verify(display).setState(TargetContentsDisplay.EditingState.SAVED);
  }
Пример #3
0
 @Override
 public Integer getVerNum() {
   return cachedValue.getVerNum();
 }