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

Commit

Permalink
rhbz844820 - refactoring (layout, localise etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Sep 18, 2012
1 parent 325a59e commit 77662bf
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 65 deletions.
Expand Up @@ -79,7 +79,7 @@ public List<HasSelectableSource> getSourcePanelList()
@Override
public void setValue(TransUnit value)
{
setValue(value, true);
setValue(value, false);
}

@Override
Expand Down
Expand Up @@ -6,7 +6,7 @@
>


<ui:with field="messages" type="org.zanata.webtrans.client.resources.NavigationMessages" />
<ui:with field="messages" type="org.zanata.webtrans.client.resources.TableEditorMessages" />

<ui:style field="style" type="org.zanata.webtrans.client.editor.table.TargetContentsView.Styles">
.targetContentsCell
Expand Down Expand Up @@ -45,7 +45,7 @@
<g:cell verticalAlignment="ALIGN_TOP" horizontalAlignment="ALIGN_JUSTIFY" width="30px">
<g:HTMLPanel ui:field="buttons" height="120px" styleName="fadeElement">
<g:InlineLabel ui:field="saveIcon" title="{messages.editSaveShortcut}" styleName="icon-install {style.button}"/>
<g:InlineLabel ui:field="fuzzyIcon" title="{messages.saveAsFuzzy}" styleName="icon-flag-1 {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" />
Expand Down
Expand Up @@ -21,6 +21,7 @@

package org.zanata.webtrans.client.presenter;

import static org.zanata.webtrans.client.events.NotificationEvent.Severity.Error;
import static org.zanata.webtrans.client.events.NotificationEvent.Severity.Warning;

import java.util.List;
Expand All @@ -42,6 +43,7 @@
import org.zanata.webtrans.client.events.TransUnitSaveEvent;
import org.zanata.webtrans.client.events.TransUnitSelectionEvent;
import org.zanata.webtrans.client.events.TransUnitSelectionHandler;
import org.zanata.webtrans.client.resources.WebTransMessages;
import org.zanata.webtrans.client.service.NavigationController;
import org.zanata.webtrans.client.service.TransUnitSaveService;
import org.zanata.webtrans.client.service.TranslatorInteractionService;
Expand All @@ -60,6 +62,7 @@
/**
* @author Patrick Huang <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
// @formatter:off
public class TransUnitEditPresenter extends WidgetPresenter<TransUnitEditDisplay> implements
TransUnitSelectionHandler,
FilterViewEventHandler,
Expand All @@ -68,9 +71,11 @@ public class TransUnitEditPresenter extends WidgetPresenter<TransUnitEditDisplay
TransUnitEditDisplay.Listener,
TableRowSelectedEventHandler,
LoadingEventHandler
// @formatter:on
{

private final TransUnitEditDisplay display;
private final WebTransMessages messages;
private final EventBus eventBus;
private final NavigationController navigationController;
private final SourceContentsPresenter sourceContentsPresenter;
Expand All @@ -82,14 +87,17 @@ public class TransUnitEditPresenter extends WidgetPresenter<TransUnitEditDisplay
private TransUnitId selectedId;

@Inject
// @formatter:off
public TransUnitEditPresenter(TransUnitEditDisplay display, EventBus eventBus, NavigationController navigationController,
SourceContentsPresenter sourceContentsPresenter,
TargetContentsPresenter targetContentsPresenter,
TranslatorInteractionService translatorService,
TransUnitSaveService transUnitSaveService)
TransUnitSaveService transUnitSaveService, WebTransMessages messages)
// @formatter:on
{
super(display, eventBus);
this.display = display;
this.messages = messages;
this.display.setRowSelectionListener(this);

this.display.addFilterConfirmationHandler(this);
Expand All @@ -107,10 +115,10 @@ public TransUnitEditPresenter(TransUnitEditDisplay display, EventBus eventBus, N
@Override
protected void onBind()
{
eventBus.addHandler(FilterViewEvent.getType(), this);
eventBus.addHandler(TransUnitSelectionEvent.getType(), this);
eventBus.addHandler(TableRowSelectedEvent.TYPE, this);
eventBus.addHandler(LoadingEvent.TYPE, this);
registerHandler(eventBus.addHandler(FilterViewEvent.getType(), this));
registerHandler(eventBus.addHandler(TransUnitSelectionEvent.getType(), this));
registerHandler(eventBus.addHandler(TableRowSelectedEvent.TYPE, this));
registerHandler(eventBus.addHandler(LoadingEvent.TYPE, this));
}

@Override
Expand Down Expand Up @@ -216,10 +224,8 @@ public void refreshView(TransUnit updatedTransUnit, EditorClientId editorClientI
if (!Objects.equal(editorClientId, translatorService.getCurrentEditorClientId()))
{
//updatedTU is our active row but done by another user
//TODO current edit has happened. What's the best way to show it to user? May need to put current editing value in some place
Log.info("detect concurrent edit. Closing editor");
// TODO localise
eventBus.fireEvent(new NotificationEvent(Warning, "Concurrent edit detected. Reset value for current row"));
Log.info("detect concurrent edit. reset editor value");
eventBus.fireEvent(new NotificationEvent(Error, messages.concurrentEdit()));
}
else if (updateType == TransUnitUpdated.UpdateType.WebEditorSaveFuzzy)
{
Expand Down
Expand Up @@ -71,47 +71,10 @@ public interface NavigationMessages extends Messages
@DefaultMessage("Alt+PageUp")
String prevFuzzyOrUntranslatedShortcut();

@DefaultMessage("Save as Approved (Ctrl+Enter)")
String editSaveShortcut();

@DefaultMessage("Save as Approved (Enter)")
String editSaveWithEnterShortcut();

@DefaultMessage("Cancel")
String editCancelShortcut();

@DefaultMessage("History")
String history();

// @DefaultMessage("Copy")
// String editClone();

// @DefaultMessage("Ctrl+Home")
// @DefaultMessage("Clone")
// String editCloneShortcut();

// @DefaultMessage("Clone & Save")
// String editCloneAndSave();

// @DefaultMessage("Ctrl+End")
// @DefaultMessage("Clone & Save")
// String editCloneAndSaveShortcut();

@DefaultMessage("Copy message from source language (Alt+G)")
String copySourceToTarget();

@DefaultMessage("{0} ({1})")
String actionToolTip(String actionName, String shortcut);

@DefaultMessage("Save as Fuzzy (Ctrl+S)")
String saveAsFuzzy();

@DefaultMessage("Source comment: {0}")
String sourceCommentLabel(String comment);

@DefaultMessage("Click here for more info")
String clickHereForMoreInfo();

@DefaultMessage("No content")
String noContent();
}
Expand Up @@ -12,9 +12,6 @@ public interface TableEditorMessages extends Messages
@DefaultMessage("Message has been copied to the target.")
String notifyCopied();

@DefaultMessage("Please open the target in the editor first.")
String notifyUnopened();

@DefaultMessage("Not logged in!")
String notifyNotLoggedIn();

Expand Down Expand Up @@ -68,6 +65,12 @@ public interface TableEditorMessages extends Messages
@DefaultMessage("Move to prev Fuzzy/Untranslated")
String prevFuzzyOrUntranslated();

@DefaultMessage("Save as Approved (Ctrl+Enter)")
String editSaveShortcut();

@DefaultMessage("Save as Fuzzy (Ctrl+S)")
String editSaveAsFuzzyShortcut();

@DefaultMessage("Save as fuzzy")
String saveAsFuzzy();

Expand All @@ -77,9 +80,15 @@ public interface TableEditorMessages extends Messages
@DefaultMessage("Close editor")
String closeEditor();

@DefaultMessage("Cancel")
String editCancelShortcut();

@DefaultMessage("History")
String history();

@DefaultMessage("Translation Unit Details: Row {0}; Id {1}; {2}")
String transUnitDetailsHeadingWithInfo(int rowIndex, String transUnitId, String info);

@DefaultMessage("Copy from source")
@DefaultMessage("Copy message from source language (Alt+G)")
String copyFromSource();
}
Expand Up @@ -40,9 +40,6 @@ public interface UiMessages extends Messages
@DefaultMessage("Details")
String detailsLabel();

@DefaultMessage("#")
String matchCountLabel();

@DefaultMessage("Number of times translation has been used")
String matchCountHeaderTooltip();

Expand Down
Expand Up @@ -255,12 +255,6 @@ public interface WebTransMessages extends Messages
@AlternateMessage({ "one", "1 text flow selected" })
String numTextFlowsSelected(@PluralCount int selectedFlows);

@DefaultMessage("Search & replace")
String searchAndReplace();

@DefaultMessage("Layout Selection")
String layoutSelection();

@DefaultMessage("Notification")
String notification();

Expand Down Expand Up @@ -418,4 +412,7 @@ public interface WebTransMessages extends Messages

@DefaultMessage("Go to row if on current page")
String goToRowOnCurrentPage();

@DefaultMessage("Concurrent edit detected. Reset value for current row. Your change will be lost.")
String concurrentEdit();
}
Expand Up @@ -5,10 +5,11 @@

<ui:style field="style" type="org.zanata.webtrans.client.ui.TransUnitDetailsPanel.Styles">
.container {
width: 99%;
width: 100%;
margin-top: 5px;
table-layout: fixed;
margin-left: 6px;
padding-right: 32px;
}

.header {
Expand Down
Expand Up @@ -7,9 +7,9 @@
<ui:style
type="org.zanata.webtrans.client.ui.ValidationMessagePanelView.Styles">
.container {
width: 95%;
width: 96%;
margin-top: 5px;
margin-left: 28px;
margin-left: 3%;
table-layout: fixed;
}

Expand Down

0 comments on commit 77662bf

Please sign in to comment.