Package org.zanata.webtrans.client.events

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


    public void updateValidationMessage(
            Map<ValidationAction, List<String>> errors,
            boolean fireNotification,
            ArrayList<HasUpdateValidationMessage> widgetList) {
        if (!errors.isEmpty() && fireNotification) {
            eventBus.fireEvent(new NotificationEvent(Severity.Info, messages
                    .notifyValidationError()));
        }

        if (widgetList != null) {
            for (HasUpdateValidationMessage widget : widgetList) {
View Full Code Here


        boolean invalidBefore =
                invalidDateFormat(editorFilter.getLastModifiedBefore());
        boolean invalidAfter =
                invalidDateFormat(editorFilter.getLastModifiedAfter());
        if (invalidBefore || invalidAfter) {
            eventBus.fireEvent(new NotificationEvent(
                    NotificationEvent.Severity.Warning,
                    "Invalid date, expected format yyyy-mm-dd"));

            display.selectPartialText(invalidBefore ? editorFilter
                    .getLastModifiedBefore() : editorFilter
View Full Code Here

            if (!canUndo) {
                return;
            }
            if (userWorkspaceContext.hasReadOnlyAccess()) {
                eventBus.fireEvent(new NotificationEvent(Severity.Warning,
                        messages.cannotUndoInReadOnlyMode()));
                return;
            }
            callback.preUndo();
            disableLink();

            dispatcher.execute(revertAction,
                    new AsyncCallback<UpdateTransUnitResult>() {
                        @Override
                        public void onFailure(Throwable caught) {
                            eventBus.fireEvent(new NotificationEvent(
                                    Severity.Error, messages.undoFailure()));
                            if (!Strings.isNullOrEmpty(getText())) {
                                setText(messages.undo());
                            }
                            enableLink();
                        }

                        @Override
                        public void onSuccess(UpdateTransUnitResult result) {
                            if (result.isAllSuccess()) {
                                eventBus.fireEvent(new NotificationEvent(
                                        Severity.Info, messages.undoSuccess()));
                                callback.postUndoSuccess();
                            } else {
                                // most likely the undo link became stale i.e.
                                // entity state has
                                // changed on the server
                                Collection<TransUnitUpdateInfo> unsuccessful =
                                        Collections2.filter(
                                                result.getUpdateInfoList(),
                                                UnsuccessfulUpdatePredicate.INSTANCE);
                                int unsuccessfulCount = unsuccessful.size();
                                int successfulCount =
                                        result.getUpdateInfoList().size()
                                                - unsuccessfulCount;
                                Log.info("undo not all successful. #"
                                        + unsuccessfulCount
                                        + " unsuccess and #" + successfulCount
                                        + " success");
                                eventBus.fireEvent(new NotificationEvent(
                                        Severity.Info, messages
                                                .undoUnsuccessful(
                                                        unsuccessfulCount,
                                                        successfulCount)));
                                setText("");
View Full Code Here

                dispatcher.execute(action,
                        new AsyncCallback<UpdateGlossaryTermResult>() {
                            @Override
                            public void onFailure(Throwable caught) {
                                Log.error(caught.getMessage(), caught);
                                eventBus.fireEvent(new NotificationEvent(
                                        Severity.Error, messages
                                                .saveGlossaryFailed()));
                                display.showLoading(false);
                            }
View Full Code Here

                for (int i = 0; i < contents.size(); i++) {
                    ToggleEditor editor = editors.get(i);
                    editor.setTextAndValidate(contents.get(i));
                }
            }
            eventBus.fireEvent(new NotificationEvent(Severity.Info, messages
                    .notifyCopied()));
        }
    }
View Full Code Here

                    selectedReferenceLocale);
            dispatcher.execute(action,
                    new AsyncCallback<GetTargetForLocaleResult>() {
                @Override
                public void onFailure(Throwable caught) {
                    eventBus.fireEvent(new NotificationEvent(NotificationEvent
                            .Severity.Error, "Failed to fetch target"));
                }

                @Override
                public void onSuccess(GetTargetForLocaleResult result) {
View Full Code Here

            ensureRowSelection(id);
            editor.setTextAndValidate(sourceContentsPresenter
                    .getSelectedSource());
            editor.setFocus();

            eventBus.fireEvent(new NotificationEvent(Severity.Info, messages
                    .notifyCopied()));
        }
    }
View Full Code Here

                    public void onFailure(final Throwable caught) {
                        if (caught instanceof com.google.gwt.user.client.rpc.StatusCodeException
                                && ((StatusCodeException) caught)
                                        .getStatusCode() == 0) {
                            if (!(action instanceof ExitWorkspaceAction)) {
                                eventBus.fireEvent(new NotificationEvent(
                                        NotificationEvent.Severity.Error,
                                        messages.noResponseFromServer()));
                            }
                        }
                        if (caught instanceof AuthenticationError) {
View Full Code Here

        final Stopwatch stopwatch = new Stopwatch().start();
        injector.getDispatcher().execute(action,
                new AsyncCallback<GetDocumentListResult>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        eventBus.fireEvent(new NotificationEvent(
                                NotificationEvent.Severity.Error,
                                "Failed to load documents"));
                        documentListPresenter.showLoading(false);
                        stopwatch.stop();
                    }
View Full Code Here

                .getProjectIterationId().getIterationSlug(), workspaceId
                .getLocaleId().getId(), isPoProject(getProjectType())),
                new AsyncCallback<DownloadAllFilesResult>() {
                    @Override
                    public void onFailure(Throwable caught) {
                        eventBus.fireEvent(new NotificationEvent(
                                NotificationEvent.Severity.Warning,
                                "Unable generate all files to download"));
                        display.hideConfirmation();
                    }

                    @Override
                    public void onSuccess(DownloadAllFilesResult result) {
                        if (result.isPrepared()) {
                            processId = result.getProcessId();
                            display.updateFileDownloadProgress(0, 0);
                            display.setDownloadInProgress(true);
                            display.startGetDownloadStatus(1000);
                        } else {
                            eventBus.fireEvent(new NotificationEvent(
                                    NotificationEvent.Severity.Warning,
                                    "Permission denied for this action"));
                            display.hideConfirmation();
                        }
                    }
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.