Package org.zanata.webtrans.shared.model

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


                                        hDoc.getPath(), hDoc.getName());
                downloadExtensions.put(extension,
                        "baked?docId=" + hDoc.getDocId());
            }

            DocumentInfo doc =
                    new DocumentInfo(
                            new DocumentId(hDoc.getId(), hDoc.getDocId()),
                            hDoc.getName(),
                            hDoc.getPath(),
                            hDoc.getLocale().getLocaleId(),
                            null,
View Full Code Here


    @Override
    public void onTransUnitUpdated(TransUnitUpdatedEvent event) {
        TransUnitUpdateInfo updateInfo = event.getUpdateInfo();
        // update stats for containing document
        DocumentInfo updatedDoc = getDocumentInfo(updateInfo.getDocumentId());
        ContainerTranslationStatistics currentStats = updatedDoc.getStats();
        if (currentStats != null) {
            adjustStats(currentStats, updateInfo);
            updatedDoc.setStats(currentStats);

            updateLastTranslatedInfo(updatedDoc, event.getUpdateInfo()
                    .getTransUnit());

            Integer row = pageRows.get(updatedDoc.getId());
            if (row != null) {
                display.updateStats(row, updatedDoc.getStats());
                AuditInfo lastTranslated =
                        new AuditInfo(event.getUpdateInfo().getTransUnit()
                                .getLastModifiedTime(), event.getUpdateInfo()
                                .getTransUnit().getLastModifiedBy());
                display.updateLastTranslated(row, lastTranslated);
            }
            eventBus.fireEvent(new DocumentStatsUpdatedEvent(
                    updatedDoc.getId(), currentStats));
        }

        eventBus.fireEvent(new RefreshProjectStatsEvent(Lists
                .newArrayList(nodes.values())));
    }
View Full Code Here

                documentListPresenter.getDocumentId(newHistoryToken
                        .getDocumentPath());
        EditorFilter editorFilter = getEditorFilterFromToken(newHistoryToken);
        if (!getTransUnitActionContextHolder.isContextInitialized()
                && documentId != null) {
            DocumentInfo documentInfo =
                    documentListPresenter.getDocumentInfo(documentId);
            // if editor is not yet initialized, we want to load document with
            // search and target trans unit all at once
            Long textFlowId = newHistoryToken.getTextFlowId();
            TransUnitId transUnitId =
View Full Code Here

     * @param docId
     *            id of the document to select
     */
    public void selectDocument(DocumentId docId) {
        if (selectedDocument == null || !docId.equals(selectedDocument.getId())) {
            DocumentInfo docInfo = documentListPresenter.getDocumentInfo(docId);
            if (docInfo != null) {
                display.enableTab(MainView.Editor, true);
                selectedDocument = docInfo;
                if (selectedDocument.getStats() != null) {
                    selectedDocumentStats.copyFrom(selectedDocument.getStats());
View Full Code Here

        context = new GetTransUnitActionContext(documentInfo(1, ""));
    }

    @Test
    public void testChangeDocument() throws Exception {
        DocumentInfo document = context.getDocument();
        GetTransUnitActionContext newContext =
                context.changeDocument(documentInfo(99, ""));

        assertThat(context.getDocument(), Matchers.sameInstance(document));
        assertThat(newContext.getDocument(),
View Full Code Here

    private ArrayList<DocumentInfo> generateTransUnitSampleData() {
        HashMap<String, String> extensions = new HashMap<String, String>();
        extensions.put(".po", "");

        ArrayList<DocumentInfo> names = new ArrayList<DocumentInfo>();
        names.add(new DocumentInfo(new DocumentId(new Long(0), ""), "name0",
                "", LocaleId.EN_US, newStats(0), new AuditInfo(new Date(),
                        "Translator"), extensions, new AuditInfo(new Date(),
                        "last translator")));
        names.add(new DocumentInfo(new DocumentId(new Long(1), ""),
                "path1name1", "path/1", LocaleId.EN_US, newStats(1),
                new AuditInfo(new Date(), "Translator"), extensions,
                new AuditInfo(new Date(), "last translator")));
        names.add(new DocumentInfo(new DocumentId(new Long(2), ""),
                "path1name2", "path/1", LocaleId.EN_US, newStats(2),
                new AuditInfo(new Date(), "Translator"), extensions,
                new AuditInfo(new Date(), "last translator")));
        names.add(new DocumentInfo(new DocumentId(new Long(3), ""),
                "path2name1", "path/2", LocaleId.EN_US, newStats(3),
                new AuditInfo(new Date(), "Translator"), extensions,
                new AuditInfo(new Date(), "last translator")));
        names.add(new DocumentInfo(new DocumentId(new Long(4), ""),
                "path2name2", "path/2", LocaleId.EN_US, newStats(4),
                new AuditInfo(new Date(), "Translator"), extensions,
                new AuditInfo(new Date(), "last translator")));
        names.add(new DocumentInfo(new DocumentId(new Long(5), ""), "name2",
                "", LocaleId.EN_US, newStats(5), new AuditInfo(new Date(),
                        "Translator"), extensions, new AuditInfo(new Date(),
                        "last translator")));
        names.add(new DocumentInfo(new DocumentId(new Long(6), ""), "name1",
                "", LocaleId.EN_US, newStats(6), new AuditInfo(new Date(),
                        "Translator"), extensions, new AuditInfo(new Date(),
                        "last translator")));
        names.add(new DocumentInfo(
                new DocumentId(new Long(7), ""),
                "long name, a name which is really quite long, too wide to be displayed without scrolling (in most cases)",
                "", LocaleId.EN_US, newStats(7), new AuditInfo(new Date(),
                        "Translator"), extensions, new AuditInfo(new Date(),
                        "last translator")));
        names.add(new DocumentInfo(
                new DocumentId(new Long(8), ""),
                "another long name, a name which is really quite long, too wide to be displayed without scrolling (in most cases)",
                "long path, a path which is, again, really quite long, and also too wide to be displayed without scrolling (in most cases)",
                LocaleId.EN_US, newStats(8), new AuditInfo(new Date(),
                        "Translator"), extensions, new AuditInfo(new Date(),
                        "last translator")));
        for (int n = 0; n < 100; n++) {
            // two digit numbers, to make sorting happier
            names.add(new DocumentInfo(new DocumentId(new Long(n), ""), "multi"
                    + n, "", LocaleId.EN_US, newStats(n), new AuditInfo(
                    new Date(), "Translator"), extensions, new AuditInfo(
                    new Date(), "last translator")));
        }
        return names;
View Full Code Here

    @Test
    public void onProcessForAppPresenter() {
        HistoryToken token = new HistoryToken();
        token.setDocumentPath("doc/a.po");
        DocumentInfo document = TestFixture.documentInfo(99, "doc/a.po");
        when(documentListPresenter.getDocumentId("doc/a.po")).thenReturn(
                document.getId());
        when(documentListPresenter.getDocumentInfo(document.getId()))
                .thenReturn(document);

        service.processForAppPresenter(document.getId());

        verify(appPresenter).selectDocument(document.getId());
        verify(eventBus).fireEvent(eventCaptor.capture());
        DocumentSelectionEvent documentSelectionEvent =
                TestFixture.extractFromEvents(eventCaptor.getAllValues(),
                        DocumentSelectionEvent.class);
        assertThat(documentSelectionEvent.getDocumentId(),
                Matchers.equalTo(document.getId()));

    }
View Full Code Here

        token.setEditorTextSearch("search text");
        token.setProjectSearchText("project search text");
        token.setDocumentPath("doc/path");
        token.setProjectSearchReplacement("replacement");
        when(historyChangeEvent.getValue()).thenReturn(token.toTokenString());
        DocumentInfo documentInfo = TestFixture.documentInfo(1, "doc/path");
        DocumentId documentId = documentInfo.getId();
        when(documentListPresenter.getDocumentId("doc/path")).thenReturn(
                documentId);
        when(documentListPresenter.getDocumentInfo(documentId)).thenReturn(
                documentInfo);
        when(appPresenter.getSelectedDocIdOrNull()).thenReturn(
View Full Code Here

        token.setProjectSearchText("project search text");
        token.setDocumentPath("doc/path");
        token.setProjectSearchReplacement("replacement");
        token.setTextFlowId("1");
        when(historyChangeEvent.getValue()).thenReturn(token.toTokenString());
        DocumentInfo documentInfo = TestFixture.documentInfo(1, "doc/path");
        DocumentId documentId = documentInfo.getId();
        when(documentListPresenter.getDocumentId("doc/path")).thenReturn(
                documentId);
        when(documentListPresenter.getDocumentInfo(documentId)).thenReturn(
                documentInfo);
        when(appPresenter.getSelectedDocIdOrNull()).thenReturn(
View Full Code Here

        verifyNoMoreInteractions(history);
    }

    @Test
    public void onEditorClickAndHasSelectedDocument() {
        DocumentInfo selectedDocument = mock(DocumentInfo.class);
        presenter.setStatesForTest(null, null, null, selectedDocument);
        when(history.getToken()).thenReturn("view:search");

        presenter.onEditorClicked();
View Full Code Here

TOP

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

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.