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

Commit

Permalink
rhbz978666 - bring back copy into editor function
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang committed Jul 18, 2013
1 parent 5bffb1c commit ff2a03d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Expand Up @@ -6,6 +6,7 @@
import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import org.zanata.webtrans.client.events.CopyDataToEditorEvent;
import org.zanata.webtrans.client.events.NotificationEvent;
import org.zanata.webtrans.client.resources.WebTransMessages;
import org.zanata.webtrans.client.rpc.AbstractAsyncCallback;
Expand Down Expand Up @@ -149,6 +150,12 @@ public void onSuccess(AddReviewCommentResult result)
});
}

@Override
public void copyIntoEditor(List<String> contents)
{
eventBus.fireEvent(new CopyDataToEditorEvent(contents));
}

@Override
protected void onBind()
{
Expand Down
Expand Up @@ -21,14 +21,18 @@

package org.zanata.webtrans.client.ui;

import java.util.List;

import org.zanata.common.ContentState;
import org.zanata.webtrans.client.util.DateUtil;
import org.zanata.webtrans.shared.model.TransHistoryItem;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
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.InlineHTML;
Expand All @@ -39,6 +43,7 @@ public class TransHistoryItemLine extends Composite
private static TransHistoryItemLineUiBinder ourUiBinder = GWT.create(TransHistoryItemLineUiBinder.class);
private static TransHistoryItemTemplate template = GWT.create(TransHistoryItemTemplate.class);
private final TranslationHistoryDisplay.Listener listener;
private final List<String> contents;

@UiField(provided = true)
InlineHTML heading;
Expand All @@ -56,6 +61,7 @@ public class TransHistoryItemLine extends Composite
public TransHistoryItemLine(TransHistoryItem item, TranslationHistoryDisplay.Listener listener)
{
this.listener = listener;
contents = item.getContents();
heading = new InlineHTML(template.heading(item.getModifiedBy(), stateToStyle(item.getStatus()), item.getStatus().name()));
targetContents = new InlineHTML(template.targetContent(TextContentsDisplay.asSyntaxHighlight(item.getContents()).toSafeHtml()));
revision = new InlineHTML(template.targetRevision(item.getVersionNum(), ""));
Expand All @@ -64,7 +70,6 @@ public TransHistoryItemLine(TransHistoryItem item, TranslationHistoryDisplay.Lis
creationDate.setText(DateUtil.formatShortDate(item.getModifiedDate()));

}
// TODO uiHandler for compare and copyIntoEditor

// TODO pahuang confirm styles
private static String stateToStyle(ContentState status)
Expand All @@ -85,6 +90,12 @@ private static String stateToStyle(ContentState status)
return "";
}

@UiHandler("copyIntoEditor")
public void copyIntoEditorClicked(ClickEvent event)
{
listener.copyIntoEditor(contents);
}

interface TransHistoryItemLineUiBinder extends UiBinder<HTMLPanel, TransHistoryItemLine>
{
}
Expand Down
Expand Up @@ -49,5 +49,7 @@ interface Listener
{

void addComment(String commentContent);

void copyIntoEditor(List<String> contents);
}
}

0 comments on commit ff2a03d

Please sign in to comment.