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

Commit

Permalink
Merge pull request #309 from zanata/editor-cleanup
Browse files Browse the repository at this point in the history
Editor cleanup
  • Loading branch information
Patrick Huang committed Dec 4, 2013
2 parents 8f35f0a + 400d173 commit c721179
Show file tree
Hide file tree
Showing 65 changed files with 1,204 additions and 1,891 deletions.
Expand Up @@ -9,5 +9,9 @@ public interface NotificationDetailListener {

void showNotificationDetail(NotificationEvent notificationEvent);

/**
* remove message from list
* @param notificationEvent
*/
void closeMessage(NotificationEvent notificationEvent);
}
Expand Up @@ -60,7 +60,6 @@ public enum DisplayOrder {
@Override
protected void onBind() {
display.setMessagesToKeep(MESSAGE_TO_KEEP);
display.setMessageOrder(DisplayOrder.ASCENDING);
display.setListener(this);

registerHandler(eventBus.addHandler(NotificationEvent.getType(), this));
Expand Down
Expand Up @@ -61,7 +61,7 @@ public void onSuccess(TransMemoryDetailsList result) {
}
selectDoc(0);

display.show();
display.center();
}
});
}
Expand Down
Expand Up @@ -61,14 +61,8 @@ public TranslationEditorPresenter(TranslationEditorDisplay display,
@Override
protected void onBind() {
transFilterPresenter.bind();
display.setFilterView(transFilterPresenter.getDisplay().asWidget());

transUnitsTablePresenter.bind();
display.setEditorView(transUnitsTablePresenter.getDisplay().asWidget());

transUnitNavigationPresenter.bind();
display.setTransUnitNavigation(transUnitNavigationPresenter
.getDisplay().asWidget());
transUnitsTablePresenter.bind();

registerHandler(eventBus.addHandler(PageChangeEvent.TYPE, this));
registerHandler(eventBus.addHandler(PageCountChangeEvent.TYPE, this));
Expand Down
Expand Up @@ -429,6 +429,9 @@ String undoUnsuccessful(@PluralCount int unsuccessfulCount,
@DefaultMessage("When unexpected error happens, a popup window will display and show it")
String showErrorsTooltip();

@DefaultMessage("Show System Errors")
String showSystemErrors();

@DefaultMessage("Switch between syntax highlightable Editor and plain textarea (no syntax highlight but support spell check in all browser)")
String useCodeMirrorEditorTooltip();

Expand Down Expand Up @@ -569,4 +572,19 @@ String undoUnsuccessful(@PluralCount int unsuccessfulCount,

@DefaultMessage("More details")
String moreDetais();

@DefaultMessage("Editor Buttons")
String editorButtons();

@DefaultMessage("'Enter' key saves immediately")
String enterKeySaves();

@DefaultMessage("Use syntax highlighting Editor")
String useSyntaxHighlight();

@DefaultMessage("Show 'Save as Approved' warning")
String showSaveApproveWarning();

@DefaultMessage("Enable Spell Check")
String enabledSpellCheck();
}
Expand Up @@ -54,15 +54,15 @@ interface Styles extends CssResource {
@UiField
Styles style;

private final WebTransMessages messages;
@UiField
WebTransMessages messages;

private static DiffColorLegendPanelUiBinder uiBinder = GWT
.create(DiffColorLegendPanelUiBinder.class);

@Inject
public DiffColorLegendPanel(final WebTransMessages messages) {
public DiffColorLegendPanel() {
super(true, true);
this.messages = messages;

HTMLPanel container = uiBinder.createAndBindUi(this);
setStyleName(style.diffLegendPanel());
Expand Down
Expand Up @@ -10,14 +10,8 @@
type="org.zanata.webtrans.client.ui.DiffColorLegendPanel.Styles">
.diffLegendPanel {
background: #454545;
padding: 20px 40px 20px 40px;
border-radius: 10px;
}

.headerLabel {
color: #FFFFFF;
font-weight: bold;
font-size: 14px;
padding: 2em 3em;
border-radius: 3px;
}

.insertLabel {
Expand All @@ -31,63 +25,48 @@
text-decoration: line-through;
}

.containLabel {
color: #FFFFFF;
}

.descriptionLabel {
color: #FFFFFF;
}

.table td {
border-bottom: 1px dotted gray;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
</ui:style>

<g:HTMLPanel>
<g:Grid styleName="{style.table}" cellPadding="5">
<g:row>
<g:customCell>
<g:Label styleName="{style.headerLabel}" text="{messages.style}" />
</g:customCell>
<g:customCell>
<g:Label styleName="{style.headerLabel}"
text="{messages.description}" />
</g:customCell>
</g:row>
<g:HTMLPanel styleName="new-zanata">
<table class="{style.table}">
<tr class="txt--invert">
<th>
<ui:text from="{messages.style}" />
</th>
<th>
<ui:text from="{messages.description}" />
</th>
</tr>

<g:row>
<g:customCell>
<g:Label styleName="{style.insertLabel}"
text="{messages.blueColor}" />
</g:customCell>
<g:customCell>
<g:Label ui:field="insDescription"
styleName="{style.descriptionLabel}" />
</g:customCell>
</g:row>
<tr>
<td class="{style.insertLabel}">
<ui:text from="{messages.blueColor}" />
</td>
<td class="txt--invert">
<g:Label ui:field="insDescription" />
</td>
</tr>

<g:row>
<g:customCell>
<g:Label styleName="{style.deleteLabel}"
text="{messages.redColorCrossedOut}" />
</g:customCell>
<g:customCell>
<g:Label ui:field="delDescription"
styleName="{style.descriptionLabel}" />
</g:customCell>
</g:row>
<tr>
<td class="{style.deleteLabel}">
<ui:text from="{messages.redColorCrossedOut}" />
</td>
<td class="txt--invert">
<g:Label ui:field="delDescription" />
</td>
</tr>

<g:row>
<g:customCell>
<g:Label styleName="{style.containLabel}"
text="{messages.plainText}" />
</g:customCell>
<g:customCell>
<g:Label ui:field="containDescription"
styleName="{style.descriptionLabel}" />
</g:customCell>
</g:row>
</g:Grid>
<tr class="txt--invert">
<td>
<ui:text from="{messages.plainText}" />
</td>
<td>
<g:Label ui:field="containDescription" />
</td>
</tr>
</table>
</g:HTMLPanel>
</ui:UiBinder>
Expand Up @@ -24,6 +24,7 @@
import java.util.List;
import java.util.Map;

import com.google.gwt.user.client.ui.HTMLPanel;
import org.zanata.rest.dto.stats.ContainerTranslationStatistics;
import org.zanata.rest.dto.stats.TranslationStatistics;
import org.zanata.rest.dto.stats.TranslationStatistics.StatUnit;
Expand Down Expand Up @@ -404,20 +405,21 @@ private Widget getRemainingWidget(DocumentInfo docInfo) {
}

private Widget getActionWidget(final DocumentInfo docInfo) {
HorizontalPanel panel = new HorizontalPanel();
FlowPanel panel = new FlowPanel();

for (Map.Entry<String, String> entry : docInfo.getDownloadExtensions()
.entrySet()) {
Anchor anchor = new Anchor(entry.getKey());
anchor.addStyleName("l--push-right-half");
anchor.setTitle(messages.downloadFileTitle(entry.getKey()));
anchor.setStyleName("downloadFileLink");
anchor.setHref(Application.getFileDownloadURL(userWorkspaceContext
.getWorkspaceContext().getWorkspaceId(), entry.getValue()));
anchor.setTarget("_blank");
panel.add(anchor);
}
InlineLabel upload = new InlineLabel();
Anchor upload = new Anchor();
upload.setTitle(messages.uploadButtonTitle());
upload.setStyleName("icon-upload uploadButton");
upload.setStyleName("icon-upload txt--lead l--push-left-half");
upload.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Expand Down
Expand Up @@ -7,14 +7,11 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
Expand All @@ -25,55 +22,51 @@
public class DownloadFilesConfirmationBox extends DialogBox {

private final WebTransMessages messages;
private final HorizontalPanel infoPanel;
private final HorizontalPanel progressPanel;
private final UnorderedListWidget progressPanel;
private final Label progressMessage;
private final Anchor downloadLink;
private final Image progressImage;

private final HorizontalPanel buttonPanel;
private final PushButton cancelButton;
private final PushButton okButton;
private final UnorderedListWidget buttonPanel;
private final Button cancelButton;
private final Button okButton;

public DownloadFilesConfirmationBox(boolean autoHide,
WebTransMessages messages, final Resources resources) {
super(autoHide);
this.messages = messages;
setText(messages.downloadAllFiles());
setGlassEnabled(true);
setStyleName("gwt-DialogBox-NoFixedSize");
setStyleName("gwt-DialogBox");

VerticalPanel panel = new VerticalPanel();
panel.setStyleName("new-zanata");

Label infoMessage = new Label(messages.prepareDownloadConfirmation());
InlineLabel infoImg = new InlineLabel();
UnorderedListWidget infoPanel = new UnorderedListWidget();
infoPanel.setStyleName("list--horizontal");

ListItemWidget infoImg = new ListItemWidget();
infoImg.setStyleName("icon-help-circle");

infoPanel = new HorizontalPanel();
infoPanel.setStyleName("info");
infoPanel.add(infoImg);
infoPanel.add(infoMessage);
infoPanel.setCellVerticalAlignment(infoMessage,
HasVerticalAlignment.ALIGN_MIDDLE);

cancelButton = new PushButton(messages.cancel());
cancelButton.addStyleName("button");
infoPanel
.add(new ListItemWidget(messages.prepareDownloadConfirmation()));

okButton = new PushButton(messages.ok());
okButton.addStyleName("button");
cancelButton = new Button(messages.cancel());
okButton = new Button(messages.ok());

buttonPanel = new HorizontalPanel();
buttonPanel.setStyleName("buttonPanel");
buttonPanel.add(cancelButton);
buttonPanel.add(okButton);
buttonPanel = new UnorderedListWidget();
buttonPanel.setStyleName("list--horizontal l--float-right");
buttonPanel.add(new ListItemWidget(cancelButton));
buttonPanel.add(new ListItemWidget(okButton));

progressImage = new Image(resources.progressLoading());
progressMessage = new Label();

progressPanel = new HorizontalPanel();
progressPanel.setSpacing(5);
progressPanel.setStyleName("progress");
progressPanel = new UnorderedListWidget();
progressPanel.setStyleName("list--horizontal");
progressPanel.setVisible(false);

showDownloadLink(false);

panel.add(infoPanel);
Expand Down Expand Up @@ -114,16 +107,11 @@ public void onClick(ClickEvent event) {
public void showDownloadLink(boolean show) {
progressPanel.clear();
if (show) {
progressPanel.add(downloadLink);
progressPanel.add(new ListItemWidget(downloadLink));
cancelButton.setText(messages.close());
} else {
progressPanel.add(progressImage);
progressPanel.add(progressMessage);

progressPanel.setCellVerticalAlignment(progressImage,
HasVerticalAlignment.ALIGN_MIDDLE);
progressPanel.setCellVerticalAlignment(progressMessage,
HasVerticalAlignment.ALIGN_MIDDLE);
progressPanel.add(new ListItemWidget(progressImage));
progressPanel.add(new ListItemWidget(progressMessage));
}
}

Expand Down
Expand Up @@ -15,7 +15,7 @@

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

@UiField
HTMLPanel buttons;
Expand Down Expand Up @@ -43,7 +43,7 @@ public EditorButtonsWidget() {
initWidget(ourUiBinder.createAndBindUi(this));
setDisplayReviewButtons(listener != null && listener.canReview());
setDisplayModifyTranslationButtons(listener != null
&& listener.canEditTranslation());
&& listener.canEditTranslation());
}

private void setDisplayReviewButtons(boolean canReview) {
Expand Down Expand Up @@ -120,7 +120,7 @@ public void setId(TransUnitId id) {
}

interface EditorButtonsWidgetUiBinder extends
UiBinder<HTMLPanel, EditorButtonsWidget> {
UiBinder<HTMLPanel, EditorButtonsWidget> {
}

interface Style extends CssResource {
Expand Down

0 comments on commit c721179

Please sign in to comment.