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

Commit

Permalink
refactor all "Copy" button text
Browse files Browse the repository at this point in the history
- translation history renamed to "Paste into Editor"
- translation memory and glossary view stay as "Copy" but added tooltip as "Copy and paste into editor"
  • Loading branch information
Patrick Huang committed Sep 5, 2012
1 parent 4031ca4 commit e3a3b6a
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 16 deletions.
Expand Up @@ -130,4 +130,10 @@ public interface UiMessages extends Messages

@DefaultMessage("Action")
String action();

@DefaultMessage("Copy")
String copy();

@DefaultMessage("Copy text and paste into editor")
String copyTooltip();
}
Expand Up @@ -348,14 +348,14 @@ public interface WebTransMessages extends Messages
@DefaultMessage("Version")
String versionNumber();

@DefaultMessage("Modified By")
@DefaultMessage("User")
String modifiedBy();

@DefaultMessage("Modified Date")
String modifiedDate();

@DefaultMessage("Copy")
String copy();
@DefaultMessage("Paste into Editor")
String pasteIntoEditor();

@DefaultMessage("Translation History")
String translationHistory();
Expand Down
Expand Up @@ -49,7 +49,6 @@ public class TranslationHistoryView extends DialogBox implements TranslationHist
private static TranslationHistoryViewUiBinder uiBinder = GWT.create(TranslationHistoryViewUiBinder.class);
private final CellTable<TransHistoryItem> historyTable;
private final EventBus eventBus;
private final HTMLPanel container;
@UiField
WebTransMessages messages;
@UiField
Expand All @@ -70,7 +69,7 @@ public class TranslationHistoryView extends DialogBox implements TranslationHist
public TranslationHistoryView(EventBus eventBus)
{
super(true, true);
container = uiBinder.createAndBindUi(this);
HTMLPanel container = uiBinder.createAndBindUi(this);
this.eventBus = eventBus;
ensureDebugId("transHistory");
setGlassEnabled(true);
Expand Down Expand Up @@ -109,24 +108,25 @@ private CellTable<TransHistoryItem> setUpHistoryTable()
Column<TransHistoryItem, List<String>> contentsColumn = createContentsColumn();
Column<TransHistoryItem, String> modifiedByColumn = createModifiedByColumn();
Column<TransHistoryItem, String> modifiedDateColumn = createModifiedDateColumn();
Column<TransHistoryItem, TransHistoryItem> copyActionColumn = createCopyActionColumn(messages);
Column<TransHistoryItem, TransHistoryItem> pasteActionColumn = createCopyActionColumn(messages);

historyTable.addColumn(versionColumn, messages.versionNumber());
historyTable.setColumnWidth(versionColumn, 15, Style.Unit.PCT);
historyTable.setColumnWidth(versionColumn, 10, Style.Unit.PCT);
historyTable.getColumnSortList().push(versionColumn);

historyTable.addColumn(contentsColumn, messages.target());
historyTable.setColumnWidth(contentsColumn, 45, Style.Unit.PCT);
historyTable.setColumnWidth(contentsColumn, 40, Style.Unit.PCT);

historyTable.addColumn(pasteActionColumn, messages.actions());
historyTable.setColumnWidth(pasteActionColumn, 20, Style.Unit.PCT);
pasteActionColumn.setCellStyleNames(style.pasteButton());

historyTable.addColumn(modifiedByColumn, messages.modifiedBy());
historyTable.setColumnWidth(modifiedByColumn, 10, Style.Unit.PCT);

historyTable.addColumn(modifiedDateColumn, messages.modifiedDate());
historyTable.setColumnWidth(modifiedDateColumn, 20, Style.Unit.PCT);

historyTable.addColumn(copyActionColumn, messages.actions());
historyTable.setColumnWidth(copyActionColumn, 10, Style.Unit.PCT);

return historyTable;
}

Expand All @@ -144,7 +144,7 @@ public Boolean getValue(TransHistoryItem object) {

private Column<TransHistoryItem, TransHistoryItem> createCopyActionColumn(WebTransMessages messages)
{
Cell<TransHistoryItem> copyActionCell = new ActionCell<TransHistoryItem>(messages.copy(), new ActionCell.Delegate<TransHistoryItem>()
Cell<TransHistoryItem> copyActionCell = new ActionCell<TransHistoryItem>(messages.pasteIntoEditor(), new ActionCell.Delegate<TransHistoryItem>()
{
@Override
public void execute(TransHistoryItem historyItem)
Expand Down Expand Up @@ -314,5 +314,7 @@ interface Styles extends CssResource
String compareButton();

String closeButton();

String pasteButton();
}
}
Expand Up @@ -14,6 +14,10 @@
float: right;
text-align: center;
}

.pasteButton Button {
font-size: smaller;
}
</ui:style>

<g:HTMLPanel width="800px" height="600px">
Expand Down
Expand Up @@ -21,6 +21,8 @@
package org.zanata.webtrans.client.ui.table.column;

import com.google.gwt.cell.client.ButtonCell;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.cellview.client.Column;

/**
Expand All @@ -31,9 +33,18 @@
public class CopyButtonColumn<T> extends Column<T, String>
{

public CopyButtonColumn()
public CopyButtonColumn(final String buttonText, final String buttonTooltip)
{
super(new ButtonCell());
super(new ButtonCell()
{
@Override
public void render(Context context, SafeHtml data, SafeHtmlBuilder sb)
{
sb.appendHtmlConstant("<button type=\"button\" tabindex=\"-1\" title=\"" + buttonTooltip + "\">");
sb.appendHtmlConstant(buttonText);
sb.appendHtmlConstant("</button>");
}
});
}

@Override
Expand Down
Expand Up @@ -90,7 +90,7 @@ public GlossaryView(final UiMessages messages, SearchTypeRenderer searchTypeRend

sourceColumn = new HighlightingLabelGlossaryColumn(true, false);
targetColumn = new HighlightingLabelGlossaryColumn(false, true);
copyColumn = new CopyButtonColumn<GlossaryResultItem>();
copyColumn = new CopyButtonColumn<GlossaryResultItem>(messages.copy(), messages.copyTooltip());
detailsColumn = new DetailsColumn<GlossaryResultItem>(resources);

searchType = new EnumListBox<SearchType>(SearchType.class, searchTypeRenderer);
Expand Down
Expand Up @@ -100,7 +100,7 @@ public TransMemoryView(final UiMessages messages, SearchTypeRenderer searchTypeR
this.messages = messages;

sourceColumn = new TransMemorySourceColumn();
copyColumn = new CopyButtonColumn<TransMemoryResultItem>();
copyColumn = new CopyButtonColumn<TransMemoryResultItem>(messages.copy(), messages.copyTooltip());
detailsColumn = new DetailsColumn<TransMemoryResultItem>(resources);

searchType = new EnumListBox<SearchType>(SearchType.class, searchTypeRenderer);
Expand Down

0 comments on commit e3a3b6a

Please sign in to comment.