Package org.zanata.webtrans.client.events

Examples of org.zanata.webtrans.client.events.NotificationEvent


    public void updateDownloadFileProgress() {
        dispatcher.execute(new GetDownloadAllFilesProgress(processId),
                new AsyncCallback<GetDownloadAllFilesProgressResult>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        eventBus.fireEvent(new NotificationEvent(
                                NotificationEvent.Severity.Warning,
                                "Unable get progress of file preparation"));
                        display.hideConfirmation();
                    }

                    @Override
                    public void onSuccess(
                            GetDownloadAllFilesProgressResult result) {
                        display.updateFileDownloadProgress(
                                result.getCurrentProgress(),
                                result.getMaxProgress());

                        if (result.isDone()) {
                            display.stopGetDownloadStatus();
                            final String url =
                                    Application.getAllFilesDownloadURL(result
                                            .getDownloadId());
                            display.setAndShowFilesDownloadLink(url);
                            eventBus.fireEvent(new NotificationEvent(
                                    NotificationEvent.Severity.Info,
                                    "File ready to download", display
                                            .getDownloadAllFilesInlineLink(url)));
                        }
                    }
View Full Code Here


    public void onFileUploadComplete(SubmitCompleteEvent event) {
        display.closeFileUpload();
        if (event.getResults().contains(
                String.valueOf(HttpServletResponse.SC_OK))) {
            if (event.getResults().contains("Warnings")) {
                eventBus.fireEvent(new NotificationEvent(Severity.Warning,
                        "File uploaded with warnings", event.getResults(),
                        true, null));
            } else {
                eventBus.fireEvent(new NotificationEvent(Severity.Info,
                        "File uploaded", event.getResults(), true, null));
            }
            queryStats();
        } else {
            eventBus.fireEvent(new NotificationEvent(Severity.Error,
                    "File upload failed.", event.getResults(), true, null));
        }
    }
View Full Code Here

                                        new Date()));
                            }

                            @Override
                            public void onFailure(Throwable caught) {
                                eventBus.fireEvent(new NotificationEvent(
                                        NotificationEvent.Severity.Error,
                                        "Unable to run validation"));
                                eventBus.fireEvent(new DocValidationResultEvent(
                                        new Date()));
                            }
View Full Code Here

    @Override
    public void proceedToMergeTM(int percentage, MergeOptions mergeOptions) {
        Collection<TransUnit> items = getNotTranslatedItems();

        if (items.isEmpty()) {
            eventBus.fireEvent(new NotificationEvent(Info, messages
                    .noTranslationToMerge()));
            display.hide();
            return;
        }

        display.showProcessing();
        TransMemoryMerge action =
                prepareTMMergeAction(items, percentage, mergeOptions);
        dispatcher.execute(action, new AsyncCallback<UpdateTransUnitResult>() {
            @Override
            public void onFailure(Throwable caught) {
                Log.warn("TM merge failed", caught);
                eventBus.fireEvent(new NotificationEvent(Error, messages
                        .mergeTMFailed()));
                display.hide();
            }

            @Override
            public void onSuccess(final UpdateTransUnitResult result) {
                if (result.getUpdateInfoList().isEmpty()) {
                    eventBus.fireEvent(new NotificationEvent(Info, messages
                            .noTranslationToMerge()));
                } else {
                    final UndoLink undoLink = undoLinkProvider.get();
                    undoLink.prepareUndoFor(result);

                    List<String> rowIndicesOrNull =
                            Lists.transform(result.getUpdateInfoList(),
                                    SuccessRowIndexOrNullFunction.FUNCTION);
                    Iterable<String> successRowIndices =
                            Iterables.filter(rowIndicesOrNull,
                                    StringNotEmptyPredicate.INSTANCE);

                    Log.info("number of rows auto filled by TM merge: "
                            + Iterables.size(successRowIndices));
                    NotificationEvent event =
                            new NotificationEvent(Info, messages
                                    .mergeTMSuccess(Lists
                                            .newArrayList(successRowIndices)),
                                    undoLink);
                    eventBus.fireEvent(event);
                }
View Full Code Here

        Log.info("requesting transUnits: " + action);
        dispatcher.execute(action, new AsyncCallback<GetTransUnitListResult>() {
            @Override
            public void onFailure(Throwable caught) {
                Log.error("GetTransUnits failure " + caught, caught);
                eventBus.fireEvent(new NotificationEvent(
                        NotificationEvent.Severity.Error, messages
                                .notifyLoadFailed()));
                eventBus.fireEvent(LoadingEvent.FINISH_EVENT);
            }
View Full Code Here

        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 =
View Full Code Here

        private void saveFailure(String errorMessage) {
            queue.removeAllPending(event.getTransUnitId());
            targetContentsPresenter.setEditingState(event.getTransUnitId(),
                    TargetContentsDisplay.EditingState.UNSAVED);
            eventBus.fireEvent(new NotificationEvent(
                    NotificationEvent.Severity.Error, messages
                            .notifyUpdateFailed("id " + id, errorMessage),
                    goToRowLink));
        }
View Full Code Here

        SaveOptionsAction action = new SaveOptionsAction(optsMap);

        dispatcher.execute(action, new AsyncCallback<SaveOptionsResult>() {
            @Override
            public void onFailure(Throwable caught) {
                eventBus.fireEvent(new NotificationEvent(
                        NotificationEvent.Severity.Warning,
                        "Could not save user options"));
            }

            @Override
            public void onSuccess(SaveOptionsResult result) {
                eventBus.fireEvent(new NotificationEvent(
                        NotificationEvent.Severity.Info, "Saved user options"));
            }
        });
    }
View Full Code Here

        interactionService.personExit(event.getPerson(), item.getSelectedId());

        if (Objects.equal(editorClientId,
                interactionService.getCurrentEditorClientId())) {
            // TODO if this works then localize the message
            eventBus.fireEvent(new NotificationEvent(
                    NotificationEvent.Severity.Error,
                    "Session has timed out. Please refresh your browser."));
        }
    }
View Full Code Here

        }

        if (Objects.equal(selectedId, updatedTransUnit.getId())
                && fromDifferentUser(editorClientId)) {
            // updatedTU is our active row but done by another user
            eventBus.fireEvent(new NotificationEvent(Error, messages
                    .concurrentEdit()));
            if (targetContentsPresenter.currentEditorContentHasChanged()) {
                translationHistoryPresenter.popupAndShowLoading(messages
                        .concurrentEditTitle());
                TransHistoryItem latest =
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.client.events.NotificationEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.