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

Commit

Permalink
Merge branch 'review-rhbz953734' of github.com:zanata/zanata into rev…
Browse files Browse the repository at this point in the history
…iew-rhbz953734
  • Loading branch information
Alex Eng committed May 17, 2013
2 parents 3a18802 + 65283ab commit 82db1b5
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 77 deletions.
4 changes: 2 additions & 2 deletions zanata-war/pom.xml
Expand Up @@ -396,8 +396,8 @@
</additionalClasspathElements>
<childDelegation>true</childDelegation>
<useSystemClassLoader>true</useSystemClassLoader>
<argLine xml:space="preserve">-Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError
<argLine xml:space="preserve">-Xmx1024m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=${project.build.directory} -Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
<classpathDependencyExcludes>
<classpathDependencyExclude>
Expand Down
Expand Up @@ -447,8 +447,10 @@ public void onKeyShortcut(KeyShortcutEvent event)

private void showDocInEditor(String doc, boolean runSearch)
{
contextHolder.updateContext(null); //this will ensure editor reload (prevent multiple cursors in code mirror)
HistoryToken token = HistoryToken.fromTokenString(history.getToken());
token.setDocumentPath(doc);
token.clearEditorFilterAndSearch();
token.setView(MainView.Editor);
if (runSearch)
{
Expand Down
@@ -0,0 +1,112 @@
package org.zanata.webtrans.client.ui;

import org.zanata.webtrans.client.view.TargetContentsDisplay;
import org.zanata.webtrans.shared.model.TransUnitId;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;

public class EditorButtonsWidget extends Composite
{
private static EditorButtonsWidgetUiBinder ourUiBinder = GWT.create(EditorButtonsWidgetUiBinder.class);

@UiField
HTMLPanel buttons;
@UiField
InlineLabel saveIcon;
@UiField
InlineLabel fuzzyIcon;
@UiField
InlineLabel cancelIcon;
@UiField
InlineLabel historyIcon;
@UiField
SimplePanel undoContainer;
@UiField
Style style;

private TargetContentsDisplay.Listener listener;
private TransUnitId id;

public EditorButtonsWidget()
{
initWidget(ourUiBinder.createAndBindUi(this));
}

public void addUndo(final UndoLink undoLink)
{
undoLink.setLinkStyle("icon-undo " + style.button());
undoLink.setUndoCallback(new UndoLink.UndoCallback()
{
@Override
public void preUndo()
{
undoLink.setLinkStyle("icon-progress " + style.button());
}

@Override
public void postUndoSuccess()
{
undoContainer.remove(undoLink);
}
});
undoContainer.setWidget(undoLink);
}

@UiHandler("saveIcon")
public void onSaveAsApproved(ClickEvent event)
{
listener.saveAsApprovedAndMoveNext(id);
event.stopPropagation();
}

@UiHandler("fuzzyIcon")
public void onSaveAsFuzzy(ClickEvent event)
{
listener.saveAsFuzzy(id);
event.stopPropagation();
}

@UiHandler("cancelIcon")
public void onCancel(ClickEvent event)
{
listener.onCancel(id);
event.stopPropagation();
}

@UiHandler("historyIcon")
public void onHistoryClick(ClickEvent event)
{
listener.showHistory(id);
event.stopPropagation();
}

public void setListener(TargetContentsDisplay.Listener listener)
{
this.listener = listener;
}

public void setId(TransUnitId id)
{
this.id = id;
}


interface EditorButtonsWidgetUiBinder extends UiBinder<HTMLPanel, EditorButtonsWidget>
{
}

interface Style extends CssResource
{

String button();
}
}
@@ -0,0 +1,24 @@
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:with field="messages" type="org.zanata.webtrans.client.resources.TableEditorMessages" />

<ui:style field="style" type="org.zanata.webtrans.client.ui.EditorButtonsWidget.Style">
.button {
cursor: pointer;
padding: 1px;
}

.button:hover {
color: #0085CC;
}

</ui:style>

<g:HTMLPanel ui:field="buttons" styleName="fadeElement buttons">
<g:InlineLabel ui:field="saveIcon" title="{messages.editSaveShortcut}" styleName="icon-install {style.button}"/>
<g:InlineLabel ui:field="fuzzyIcon" title="{messages.editSaveAsFuzzyShortcut}" styleName="icon-flag-1 {style.button}" />
<g:InlineLabel ui:field="cancelIcon" title="{messages.editCancelShortcut}" styleName="icon-cancel-circle {style.button}" />
<g:InlineLabel ui:field="historyIcon" title="{messages.history}" styleName="icon-back-in-time {style.button}" />
<g:SimplePanel ui:field="undoContainer" />
</g:HTMLPanel>
</ui:UiBinder>
Expand Up @@ -26,6 +26,7 @@
import org.zanata.common.ContentState;
import org.zanata.webtrans.client.resources.TableEditorMessages;
import org.zanata.webtrans.client.ui.Editor;
import org.zanata.webtrans.client.ui.EditorButtonsWidget;
import org.zanata.webtrans.client.ui.ToggleEditor;
import org.zanata.webtrans.client.ui.UndoLink;
import org.zanata.webtrans.client.ui.ValidationMessagePanelView;
Expand Down Expand Up @@ -58,26 +59,18 @@ public class TargetContentsView extends Composite implements TargetContentsDispl

@UiField
Grid editorGrid;
@UiField
HTMLPanel buttons;

@UiField(provided = true)
ValidationMessagePanelView validationPanel;
@UiField
InlineLabel saveIcon;
@UiField
InlineLabel fuzzyIcon;
@UiField
InlineLabel cancelIcon;
@UiField
InlineLabel historyIcon;

@UiField
Styles style;
@UiField
SimplePanel undoContainer;

@UiField
Label savingIndicator;

@UiField
EditorButtonsWidget buttons;

private HorizontalPanel rootPanel;
private ArrayList<ToggleEditor> editors;
private Listener listener;
Expand Down Expand Up @@ -118,28 +111,15 @@ public void focusEditor(int currentEditorIndex)
@Override
public void addUndo(final UndoLink undoLink)
{
undoLink.setLinkStyle("icon-undo " + style.button());
undoLink.setUndoCallback(new UndoLink.UndoCallback()
{
@Override
public void preUndo()
{
undoLink.setLinkStyle("icon-progress " + style.button());
}

@Override
public void postUndoSuccess()
{
undoContainer.remove(undoLink);
}
});
undoContainer.setWidget(undoLink);

buttons.addUndo(undoLink);
}

@Override
public void setValueAndCreateNewEditors(TransUnit transUnit)
{
cachedValue = transUnit;
buttons.setId(cachedValue.getId());

editors.clear();
List<String> cachedTargets = cachedValue.getTargets();
Expand Down Expand Up @@ -228,34 +208,6 @@ public void setEnableSpellCheck(boolean spellCheckEnabled)
}
}

@UiHandler("saveIcon")
public void onSaveAsApproved(ClickEvent event)
{
listener.saveAsApprovedAndMoveNext(cachedValue.getId());
event.stopPropagation();
}

@UiHandler("fuzzyIcon")
public void onSaveAsFuzzy(ClickEvent event)
{
listener.saveAsFuzzy(cachedValue.getId());
event.stopPropagation();
}

@UiHandler("cancelIcon")
public void onCancel(ClickEvent event)
{
listener.onCancel(cachedValue.getId());
event.stopPropagation();
}

@UiHandler("historyIcon")
public void onHistoryClick(ClickEvent event)
{
listener.showHistory(cachedValue.getId());
event.stopPropagation();
}

@Override
public void highlightSearch(String findMessage)
{
Expand Down Expand Up @@ -298,6 +250,7 @@ public ArrayList<ToggleEditor> getEditors()
public void setListener(Listener listener)
{
this.listener = listener;
buttons.setListener(listener);
}

@Override
Expand Down Expand Up @@ -358,8 +311,6 @@ public String toString()
interface Styles extends CssResource
{

String button();

String targetContentsCell();

String editorGridWrapper();
Expand Down
Expand Up @@ -19,15 +19,6 @@
position: relative;
}

.button {
cursor: pointer;
padding: 1px;
}

.button:hover {
color: #0085CC;
}

.unsaved {
background-color: #56c0e6;
}
Expand All @@ -53,13 +44,7 @@
</g:FlowPanel>
</g:cell>
<g:cell verticalAlignment="ALIGN_TOP" horizontalAlignment="ALIGN_JUSTIFY" width="22px">
<g:HTMLPanel ui:field="buttons" styleName="fadeElement buttons">
<g:InlineLabel ui:field="saveIcon" title="{messages.editSaveShortcut}" styleName="icon-install {style.button}"/>
<g:InlineLabel ui:field="fuzzyIcon" title="{messages.editSaveAsFuzzyShortcut}" styleName="icon-flag-1 {style.button}" />
<g:InlineLabel ui:field="cancelIcon" title="{messages.editCancelShortcut}" styleName="icon-cancel-circle {style.button}" />
<g:InlineLabel ui:field="historyIcon" title="{messages.history}" styleName="icon-back-in-time {style.button}" />
<g:SimplePanel ui:field="undoContainer" />
</g:HTMLPanel>
<fui:EditorButtonsWidget ui:field="buttons" />
</g:cell>
</g:HorizontalPanel>
</ui:UiBinder>

0 comments on commit 82db1b5

Please sign in to comment.