Package org.zanata.webtrans.shared.model

Examples of org.zanata.webtrans.shared.model.TransHistoryItem


                textFlowDAO.findById(action.getTransUnitId().getId(), false);

        HTextFlowTarget hTextFlowTarget =
                hTextFlow.getTargets().get(hLocale.getId());
        Map<Integer, HTextFlowTargetHistory> history = Maps.newHashMap();
        TransHistoryItem latest = null;
        if (hTextFlowTarget != null) {
            String lastModifiedBy =
                    nameOrEmptyString(hTextFlowTarget.getLastModifiedBy());
            int nPlurals =
                    resourceUtils.getNumPlurals(hTextFlow.getDocument(),
                            hLocale);

            latest =
                    new TransHistoryItem(hTextFlowTarget.getVersionNum()
                            .toString(),
                            GwtRpcUtil.getTargetContentsWithPadding(hTextFlow,
                                    hTextFlowTarget, nPlurals),
                            hTextFlowTarget.getState(), lastModifiedBy,
                            hTextFlowTarget.getLastChanged());
View Full Code Here


    private static class TargetHistoryToTransHistoryItemFunction implements
            Function<HTextFlowTargetHistory, TransHistoryItem> {
        @Override
        public TransHistoryItem apply(HTextFlowTargetHistory targetHistory) {
            return new TransHistoryItem(targetHistory.getVersionNum()
                    .toString(), targetHistory.getContents(),
                    targetHistory.getState(),
                    nameOrEmptyString(targetHistory.getLastModifiedBy()),
                    targetHistory.getLastChanged());
        }
View Full Code Here

            eventBus.fireEvent(new NotificationEvent(Error, messages
                    .concurrentEdit()));
            if (targetContentsPresenter.currentEditorContentHasChanged()) {
                translationHistoryPresenter.popupAndShowLoading(messages
                        .concurrentEditTitle());
                TransHistoryItem latest =
                        new TransHistoryItem(updatedTransUnit.getVerNum()
                                .toString(), updatedTransUnit.getTargets(),
                                updatedTransUnit.getStatus(),
                                updatedTransUnit.getLastModifiedBy(),
                                updatedTransUnit.getLastModifiedTime());
                translationHistoryPresenter.displayEntries(latest,
View Full Code Here

        if (latest != null) {
            // add indicator for latest version
            all.add(latest.setOptionalTag(messages.latest()));
            List<String> newTargets = targetContentsPresenter.getNewTargets();
            if (!Objects.equal(latest.getContents(), newTargets)) {
                all.add(new TransHistoryItem(messages.unsaved(), newTargets,
                        null, messages.you(), new Date()));
            }
        }
        all.addAll(otherEntries);
        all.addAll(reviewComments);
View Full Code Here

        verify(keyShortcutPresenter).register(keyShortcutCapture.capture());
    }

    private static TransHistoryItem historyItem(String versionNum) {
        return new TransHistoryItem(versionNum, Lists.newArrayList("a"),
                ContentState.Approved, "admin", new Date());
    }
View Full Code Here

    @Test
    public void willShowTranslationHistoryOnSuccess() {
        // Given: text flow has one history item and one latest translation
        when(messages.translationHistory()).thenReturn("translation history");
        TransHistoryItem historyItem = historyItem("1");
        String latestVersion = "2";
        TransHistoryItem latest = historyItem(latestVersion);
        // latest contents and current contents are equal
        when(targetContentsPresenter.getNewTargets()).thenReturn(
                Lists.newArrayList(latest.getContents()));
        when(messages.latest()).thenReturn("latest");

        // When: request history for trans unit id 1
        presenter.showTranslationHistory(transUnitId);
View Full Code Here

    }

    @Test
    public void willShowTranslationHistoryWithUnsavedValueOnSuccess() {
        // Given: text flow has one history item and one latest translation
        TransHistoryItem historyItem = historyItem("1");
        String latestVersion = "2";
        TransHistoryItem latest = historyItem(latestVersion);
        // latest contents and current contents are NOT equal
        when(targetContentsPresenter.getNewTargets()).thenReturn(
                Lists.newArrayList("b"));
        when(messages.latest()).thenReturn("latest");
        when(messages.unsaved()).thenReturn("unsaved");
View Full Code Here

        // no unsaved content
        when(targetContentsPresenter.getNewTargets()).thenReturn(
                Lists.newArrayList("a"));
        long now = new Date().getTime();
        // items in time order
        TransHistoryItem latest =
                new TransHistoryItem("5", Lists.newArrayList("a"),
                        ContentState.Approved, "admin", new Date(now - 1000));
        TransHistoryItem item =
                new TransHistoryItem("4", Lists.newArrayList("a"),
                        ContentState.Approved, "admin", new Date(now - 2000));
        ReviewComment comment =
                new ReviewComment(new ReviewCommentId(1L), "comment", "admin",
                        new Date(now), 5);
View Full Code Here

    @Test
    public void onCompareClickedWhichMakesTwoItems() {
        when(messages.translationHistoryComparison("5", "4")).thenReturn(
                "comparison of 5 and 4");
        TransHistoryItem one = historyItem("5");
        presenter.compareClicked(one);
        verify(display).disableComparison();

        TransHistoryItem two = historyItem("4");
        presenter.compareClicked(two);
        verify(display).showDiff(one, two, "comparison of 5 and 4");

    }
View Full Code Here

    public void setUp() throws Exception {
        pair = ComparingPair.empty();
    }

    private static TransHistoryItem newItem(String versionNum) {
        return new TransHistoryItem(versionNum, Lists.newArrayList("a"),
                ContentState.Approved, "", new Date());
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.TransHistoryItem

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.