/** * Display confirmation dialog box if new status of TU has been changed to approved without any * content changes. */ @Override public void onCheckStateHasChanged(CheckStateHasChangedEvent event) { TransUnit transUnit = navigationService.getByIdOrNull(event.getTransUnitId()); if (transUnit == null) { return; } boolean targetChanged = !Objects.equal(transUnit.getTargets(), event.getTargets()); boolean targetUnchangedButCanSaveAsApproved = (event.getAdjustedState() == ContentState.Translated) && !Objects.equal(transUnit.getStatus(), event.getAdjustedState()); if (targetChanged) { targetContentsPresenter.saveAsApprovedAndMoveNext(event.getTransUnitId()); } else if (targetUnchangedButCanSaveAsApproved) { targetContentsPresenter.showSaveAsApprovedConfirmation(event.getTransUnitId()); } else { eventBus.fireEvent(NavTransUnitEvent.NEXT_ENTRY_EVENT); } }
private void performSave(TransUnitId idToSave) { TransUnitSaveEvent forSaving = queue.getNextPendingForSaving(idToSave); if (forSaving == null) { Log.info("no pending save for " + idToSave); return; } targetContentsPresenter.setEditingState(idToSave, TargetContentsDisplay.EditingState.SAVING); UpdateTransUnit updateTransUnit = new UpdateTransUnit( new TransUnitUpdateRequest( idToSave, forSaving.getTargets(), forSaving.getAdjustedStatus(), forSaving.getVerNum(), sourceType), TransUnitUpdated.UpdateType.WebEditorSave); Log.info("about to save translation: " + updateTransUnit); dispatcher.execute( updateTransUnit, new UpdateTransUnitCallback( forSaving, documentListPresenter.getCurrentDocument(), idToSave)); }