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

Commit

Permalink
rhbz978666 - remove old implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Jul 18, 2013
1 parent 4e6b358 commit 9a3d92c
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 918 deletions.

This file was deleted.

This file was deleted.

Expand Up @@ -89,7 +89,6 @@ public class TargetContentsPresenter implements
private final TableEditorMessages messages;
private final SourceContentsPresenter sourceContentsPresenter;
private final TranslationHistoryPresenter historyPresenter;
private final ReviewCommentPresenter reviewCommentPresenter;
private final Provider<TargetContentsDisplay> displayProvider;
private final EditorTranslators editorTranslators;
private final EditorKeyShortcuts editorKeyShortcuts;
Expand All @@ -115,9 +114,8 @@ public TargetContentsPresenter(Provider<TargetContentsDisplay> displayProvider,
UserWorkspaceContext userWorkspaceContext,
EditorKeyShortcuts editorKeyShortcuts,
TranslationHistoryPresenter historyPresenter,
UserOptionsService userOptionsService,
SaveAsApprovedConfirmationDisplay saveAsApprovedConfirmation,
ReviewCommentPresenter reviewCommentPresenter)
UserOptionsService userOptionsService,
SaveAsApprovedConfirmationDisplay saveAsApprovedConfirmation)
// @formatter:on
{
this.displayProvider = displayProvider;
Expand All @@ -128,7 +126,6 @@ public TargetContentsPresenter(Provider<TargetContentsDisplay> displayProvider,
this.sourceContentsPresenter = sourceContentsPresenter;
this.editorKeyShortcuts = editorKeyShortcuts;
this.historyPresenter = historyPresenter;
this.reviewCommentPresenter = reviewCommentPresenter;
this.historyPresenter.setCurrentValueHolder(this);
this.userOptionsService = userOptionsService;
this.saveAsApprovedConfirmation = saveAsApprovedConfirmation;
Expand All @@ -148,7 +145,6 @@ private void bindEventHandlers()
eventBus.addHandler(CopyDataToEditorEvent.getType(), this);
eventBus.addHandler(TransUnitEditEvent.getType(), this);
eventBus.addHandler(WorkspaceContextUpdateEvent.getType(), this);
reviewCommentPresenter.bind();
}

public void savePendingChangesIfApplicable()
Expand Down
Expand Up @@ -10,6 +10,8 @@
import org.zanata.common.ContentState;
import org.zanata.webtrans.client.events.CopyDataToEditorEvent;
import org.zanata.webtrans.client.events.NotificationEvent;
import org.zanata.webtrans.client.events.ReviewCommentEvent;
import org.zanata.webtrans.client.events.ReviewCommentEventHandler;
import org.zanata.webtrans.client.resources.WebTransMessages;
import org.zanata.webtrans.client.rpc.AbstractAsyncCallback;
import org.zanata.webtrans.client.rpc.CachingDispatchAsync;
Expand All @@ -36,7 +38,8 @@
* @author Patrick Huang <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
@Singleton
public class TranslationHistoryPresenter extends WidgetPresenter<TranslationHistoryDisplay> implements TranslationHistoryDisplay.Listener
public class TranslationHistoryPresenter extends WidgetPresenter<TranslationHistoryDisplay>
implements TranslationHistoryDisplay.Listener, ReviewCommentEventHandler
{
private final TranslationHistoryDisplay display;
private final EventBus eventBus;
Expand All @@ -60,6 +63,12 @@ public TranslationHistoryPresenter(TranslationHistoryDisplay display, EventBus e
display.setListener(this);
}

@Override
public void onShowReviewComment(ReviewCommentEvent event)
{
showTranslationHistory(event.getTransUnitId());
}

public void showTranslationHistory(final TransUnitId transUnitId)
{
this.transUnitId = transUnitId;
Expand Down Expand Up @@ -101,7 +110,7 @@ protected void displayEntries(TransHistoryItem latest, List<TransHistoryItem> ot
List<String> newTargets = targetContentsPresenter.getNewTargets();
if (!Objects.equal(latest.getContents(), newTargets))
{
all.add(new TransHistoryItem(messages.unsaved(), newTargets, ContentState.New, "You", new Date()));
all.add(new TransHistoryItem(messages.unsaved(), newTargets, ContentState.New, messages.you(), new Date()));
}
}
all.addAll(otherEntries);
Expand Down
@@ -1,7 +1,5 @@
package org.zanata.webtrans.client.ui;

import org.zanata.common.ContentState;
import org.zanata.webtrans.client.events.ReviewCommentEvent;
import org.zanata.webtrans.client.view.TargetContentsDisplay;
import org.zanata.webtrans.shared.model.TransUnitId;
import com.google.gwt.core.client.GWT;
Expand All @@ -15,12 +13,9 @@
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.SimplePanel;

import net.customware.gwt.presenter.client.EventBus;

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

@UiField
HTMLPanel buttons;
Expand All @@ -40,15 +35,12 @@ public class EditorButtonsWidget extends Composite
InlineLabel acceptIcon;
@UiField
InlineLabel rejectIcon;
@UiField
InlineLabel commentIcon;

private TargetContentsDisplay.Listener listener;
private TransUnitId id;

public EditorButtonsWidget(EventBus eventBus)
public EditorButtonsWidget()
{
this.eventBus = eventBus;
initWidget(ourUiBinder.createAndBindUi(this));
setDisplayReviewButtons(listener != null && listener.canReview());
setDisplayModifyTranslationButtons(listener != null && listener.canEditTranslation());
Expand Down Expand Up @@ -129,28 +121,16 @@ public void onReject(ClickEvent event)
event.stopPropagation();
}

@UiHandler("commentIcon")
public void onCommentClick(ClickEvent event)
{
eventBus.fireEvent(new ReviewCommentEvent(id));
}

public void setListener(TargetContentsDisplay.Listener listener)
{
this.listener = listener;
setDisplayReviewButtons(listener.canReview());
setDisplayModifyTranslationButtons(listener.canEditTranslation());
}

public void setIdAndState(TransUnitId id, ContentState state)
public void setId(TransUnitId id)
{
this.id = id;
enableComment(state.isTranslated() || state.isRejectedOrFuzzy());
}

private void enableComment(boolean enable)
{
commentIcon.setVisible(enable);
}


Expand Down
Expand Up @@ -21,7 +21,6 @@
<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:InlineLabel ui:field="commentIcon" title="{messages.comment}" styleName="icon-comment-alt-1 {style.button}" />
<g:SimplePanel ui:field="undoContainer" />
</g:HTMLPanel>
</ui:UiBinder>

This file was deleted.

0 comments on commit 9a3d92c

Please sign in to comment.