This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'review-rhbz953734' of github.com:zanata/zanata into rev…
…iew-rhbz953734
- Loading branch information
Showing
6 changed files
with
151 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
zanata-war/src/main/java/org/zanata/webtrans/client/ui/EditorButtonsWidget.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
zanata-war/src/main/java/org/zanata/webtrans/client/ui/EditorButtonsWidget.ui.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters