Package org.zanata.webtrans.client.events

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


    public void validate(ToggleEditor editor) {
        TransUnitId transUnitId = editor.getId();
        Optional<String> sourceContent =
                sourceContentsPresenter.getSourceContent(transUnitId);
        if (sourceContent.isPresent()) {
            RunValidationEvent event =
                    new RunValidationEvent(sourceContent.get(),
                            editor.getText(), false);
            // widget that displays red outline
            event.addWidget(editor);
            // widget that displays warnings
            Optional<TargetContentsDisplay> targetDisplay =
                    Finds.findDisplayById(displayList, transUnitId);
            if (targetDisplay.isPresent()) {
                event.addWidget(targetDisplay.get());
            }
            eventBus.fireEvent(event);
        }
    }
View Full Code Here


            String source =
                    sourceDisplay.getSourcePanelList().get(0).getSource();
            String target = targetDisplay.getEditors().get(0).getText();

            RunValidationEvent runValidationEvent =
                    new RunValidationEvent(source, target, false);

            runValidationEvent.addWidget(targetDisplay);

            eventBus.fireEvent(runValidationEvent);
        }
    }
View Full Code Here

                .thenReturn(Optional.of("source"));

        presenter.validate(editor);

        verify(eventBus).fireEvent(eventCaptor.capture());
        RunValidationEvent event = (RunValidationEvent) eventCaptor.getValue();
        assertThat(event.getSourceContent(), equalTo("source"));
        assertThat(event.getTarget(), equalTo("target"));
        assertThat(event.isFireNotification(), equalTo(false));
        assertThat(event.getWidgetList(),
                Matchers.<HasUpdateValidationMessage> containsInAnyOrder(
                        editor, display));
    }
View Full Code Here

        when(editor.getText()).thenReturn("target");

        presenter.onRequestValidation(RequestValidationEvent.EVENT);

        verify(eventBus).fireEvent(eventCaptor.capture());
        RunValidationEvent event =
                TestFixture.extractFromEvents(eventCaptor.getAllValues(),
                        RunValidationEvent.class);
        MatcherAssert.assertThat(event.getTarget(), Matchers.equalTo("target"));
    }
View Full Code Here

                TestFixture.extractFromEvents(eventCaptor.getAllValues(),
                        NotificationEvent.class);
        MatcherAssert.assertThat(notificationEvent.getMessage(),
                Matchers.equalTo("copied"));

        RunValidationEvent runValidationEvent =
                TestFixture.extractFromEvents(eventCaptor.getAllValues(),
                        RunValidationEvent.class);
        assertThat(runValidationEvent.getSourceContent(),
                equalTo("source content"));
    }
View Full Code Here

TOP

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

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.