Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
rhbz844820 - refresh target to make code mirror works
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Sep 18, 2012
1 parent 70d91d2 commit 7ebc40b
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 6 deletions.
Expand Up @@ -245,4 +245,21 @@ private native void codeMirrorHighlight(String term) /*-{
editor.markText(searchCursor.from(), searchCursor.to(), "CodeMirror-searching");
}
}-*/;

public void refresh()
{
if (useCodeMirrorFlag)
{
refreshCodeMirror();
}
}

private native void refreshCodeMirror() /*-{
var editor = this.@org.zanata.webtrans.client.editor.table.EditorTextArea::codeMirrorEditor;
if (editor)
{
editor.refresh();
}
}-*/;
}
Expand Up @@ -66,6 +66,8 @@ public interface TargetContentsDisplay extends WidgetDisplay, IsWidget, HasTrans
*/
void updateCachedAndInEditorTargets(List<String> targets);

void refresh();

interface Listener
{
void validate(ToggleEditor editor);
Expand Down
Expand Up @@ -278,6 +278,15 @@ public void updateCachedAndInEditorTargets(List<String> targets)
}
}

@Override
public void refresh()
{
for (ToggleEditor editor : editors)
{
editor.refresh();
}
}

@Override
public Integer getVerNum()
{
Expand Down
Expand Up @@ -73,7 +73,7 @@ private void processForDocumentListPresenter(HistoryToken token)
private void processForAppPresenter(HistoryToken token)
{
DocumentId docId = documentListPresenter.getDocumentId(token.getDocumentPath());
if (!equal(appPresenter.getSelectedDocIdOrNull(), docId))
if (docId != null && !equal(appPresenter.getSelectedDocIdOrNull(), docId))
{
appPresenter.selectDocument(docId);
}
Expand Down
Expand Up @@ -301,6 +301,12 @@ public void highlightSearch(String findMessage)
textArea.highlight(findMessage);
}

@Override
public void refresh()
{
textArea.refresh();
}

@Override
public void removeTranslator(String name, String color)
{
Expand Down
Expand Up @@ -24,6 +24,8 @@ public interface ToggleEditor extends IsWidget, HasText, HasUpdateValidationWarn

void highlightSearch(String findMessage);

void refresh();

static enum ViewMode
{
VIEW, EDIT
Expand Down
Expand Up @@ -112,14 +112,11 @@ public void buildTable(List<SourceContentsDisplay> sourceDisplays, List<TargetCo
cellFormatter.setVerticalAlignment(i, 1, HasVerticalAlignment.ALIGN_TOP);
cellFormatter.setStyleName(i, 0, style.cellFormat());
cellFormatter.setStyleName(i, 1, style.cellFormat());

sourceDisplay.refresh();
targetDisplay.refresh();
}
applyRowStyle();

for (SourceContentsDisplay sourceDisplay : sourceDisplays)
{
sourceDisplay.refresh();
}
}

private void showEmptyContentIfNoData(int dataSize)
Expand Down

0 comments on commit 7ebc40b

Please sign in to comment.