Package org.zanata.webtrans.client.view

Examples of org.zanata.webtrans.client.view.TargetContentsDisplay


    public void concealDisplay() {
        editorKeyShortcuts.enableNavigationContext();
    }

    public void addUndoLink(int row, UndoLink undoLink) {
        TargetContentsDisplay targetContentsDisplay = displayList.get(row);
        targetContentsDisplay.addUndo(undoLink);
    }
View Full Code Here


    public void showData(List<TransUnit> transUnits) {
        ImmutableList.Builder<TargetContentsDisplay> builder =
                ImmutableList.builder();
        for (TransUnit transUnit : transUnits) {
            TargetContentsDisplay display = displayProvider.get();
            display.setListener(this);
            display.setValueAndCreateNewEditors(transUnit);

            if (!canEditTranslation()) {
                display.setToMode(ViewMode.VIEW);
            }

            display.showButtons(isDisplayButtons());
            builder.add(display);
        }
        displayList = builder.build();
        display = null;
    }
View Full Code Here

     */
    public void updateRow(TransUnit updatedTransUnit) {
        Optional<TargetContentsDisplay> contentsDisplayOptional =
                Finds.findDisplayById(displayList, updatedTransUnit.getId());
        if (contentsDisplayOptional.isPresent()) {
            TargetContentsDisplay contentsDisplay =
                    contentsDisplayOptional.get();
            contentsDisplay.setValueAndCreateNewEditors(updatedTransUnit);
            contentsDisplay.setState(TargetContentsDisplay.EditingState.SAVED);
            contentsDisplay.refresh();
            if (equal(updatedTransUnit.getId(), currentTransUnitId)) {
                editorTranslators.updateTranslator(display, currentTransUnitId);
            }
        }
    }
View Full Code Here

     */
    public void confirmSaved(TransUnit updatedTU) {
        Optional<TargetContentsDisplay> contentsDisplayOptional =
                Finds.findDisplayById(displayList, updatedTU.getId());
        if (contentsDisplayOptional.isPresent()) {
            TargetContentsDisplay contentsDisplay =
                    contentsDisplayOptional.get();
            if (contentsDisplay.getEditingState() == TargetContentsDisplay.EditingState.SAVED) {
                // If current display is in saved state, we update both in
                // editor and cached value
                contentsDisplay.setValueAndCreateNewEditors(updatedTU);
                contentsDisplay.refresh();
            } else {
                // editor is in saving state or unsaved state, we don't want to
                // update value in editor, just the cached value.
                contentsDisplay.updateCachedTargetsAndVersion(
                        updatedTU.getTargets(), updatedTU.getVerNum(),
                        updatedTU.getStatus());
            }
            setEditingState(updatedTU.getId(),
                    TargetContentsDisplay.EditingState.SAVED);
View Full Code Here

                Finds.findDisplayById(displayList, transUnitId);
        if (!displayOptional.isPresent()) {
            return;
        }

        TargetContentsDisplay contentsDisplay = displayOptional.get();
        if (editingState == TargetContentsDisplay.EditingState.SAVING) {
            contentsDisplay.setState(TargetContentsDisplay.EditingState.SAVING);
        } else if (!Objects.equal(contentsDisplay.getCachedTargets(),
                contentsDisplay.getNewTargets())) {
            contentsDisplay
                    .setState(TargetContentsDisplay.EditingState.UNSAVED);
        } else {
            contentsDisplay.setState(TargetContentsDisplay.EditingState.SAVED);
        }
    }
View Full Code Here

        List<TargetContentsDisplay> targetContentsDisplays =
                targetContentsPresenter.getDisplays();
        List<SourceContentsDisplay> sourceContentsDisplays =
                sourceContentsPresenter.getDisplays();
        for (int i = 0; i < targetContentsDisplays.size(); i++) {
            TargetContentsDisplay targetDisplay = targetContentsDisplays.get(i);
            SourceContentsDisplay sourceDisplay = sourceContentsDisplays.get(i);
            targetDisplay.refresh();
            sourceDisplay.refresh();
            if (!Strings.isNullOrEmpty(findMessage)) {
                targetDisplay.highlightSearch(findMessage);
                sourceDisplay.highlightSearch(findMessage);
            }
        }
    }
View Full Code Here

        List<TargetContentsDisplay> targetDisplays =
                targetContentsPresenter.getDisplays();

        for (int i = 0; i < sourceContentsPresenter.getDisplays().size(); i++) {
            SourceContentsDisplay sourceDisplay = sourceDisplays.get(i);
            TargetContentsDisplay targetDisplay = targetDisplays.get(i);

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

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

            runValidationEvent.addWidget(targetDisplay);
View Full Code Here

    @Test
    public void canRefreshViewWithSearch() {
        // Given: presenter has highlight search term
        presenter.highlightSearch("blah");
        TargetContentsDisplay targetDisplay = mock(TargetContentsDisplay.class);
        SourceContentsDisplay sourceDisplay = mock(SourceContentsDisplay.class);
        // assuming two displays in the list
        List<TargetContentsDisplay> targetContentsDisplays =
                Lists.newArrayList(targetDisplay, targetDisplay);
        List<SourceContentsDisplay> sourceContentsDisplays =
View Full Code Here

    }

    @Test
    public void canRefreshViewWithNoSearch() {
        // Given: presenter has no highlight search term
        TargetContentsDisplay targetDisplay = mock(TargetContentsDisplay.class);
        SourceContentsDisplay sourceDisplay = mock(SourceContentsDisplay.class);
        // assuming two displays in the list
        List<TargetContentsDisplay> targetContentsDisplays =
                Lists.newArrayList(targetDisplay, targetDisplay);
        List<SourceContentsDisplay> sourceContentsDisplays =
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.client.view.TargetContentsDisplay

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.