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

Commit

Permalink
Browse files Browse the repository at this point in the history
rhbz870876 improve buttons for zip preparation on gwt doclist
  • Loading branch information
davidmason committed Mar 25, 2013
1 parent 10cd563 commit 860a63b
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
Expand Up @@ -11,6 +11,12 @@ public interface WebTransMessages extends Messages
@DefaultMessage("Save")
String save();

@DefaultMessage("OK")
String ok();

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

@DefaultMessage("(No Content)")
String noContent();

Expand Down Expand Up @@ -503,6 +509,12 @@ public interface WebTransMessages extends Messages
@DefaultMessage("Only display Translation Unit Details when there is meta data otherwise hide it")
String showTransUnitDetailsTooltip();

@DefaultMessage("Download All Files")
String downloadAllFiles();

@DefaultMessage("Your download will be prepared and may take a few minutes to complete. Is this ok?")
String prepareDownloadConfirmation();

@DefaultMessage("Download files (zip)")
String downloadAllAsZip();

Expand Down Expand Up @@ -530,4 +542,5 @@ public interface WebTransMessages extends Messages
@DefaultMessage("Start time: {0}")
String lastValidationRunTooltip(String startTime);


}
@@ -1,6 +1,7 @@
package org.zanata.webtrans.client.ui;

import org.zanata.webtrans.client.resources.Resources;
import org.zanata.webtrans.client.resources.WebTransMessages;
import org.zanata.webtrans.client.view.DocumentListDisplay;

import com.google.gwt.event.dom.client.ClickEvent;
Expand All @@ -24,27 +25,29 @@
public class DownloadFilesConfirmationBox extends DialogBox
{

private final WebTransMessages messages;
private final HorizontalPanel infoPanel;
private final HorizontalPanel 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 String defaultMessage = "Your download will be prepared and may take a few minutes to complete. Is this ok?";

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

VerticalPanel panel = new VerticalPanel();

Label infoMessage = new Label(defaultMessage);
Label infoMessage = new Label(messages.prepareDownloadConfirmation());
InlineLabel infoImg = new InlineLabel();
infoImg.setStyleName("icon-help-circle");

Expand All @@ -54,13 +57,13 @@ public DownloadFilesConfirmationBox(boolean autoHide, final Resources resources)
infoPanel.add(infoMessage);
infoPanel.setCellVerticalAlignment(infoMessage, HasVerticalAlignment.ALIGN_MIDDLE);

cancelButton = new PushButton("Cancel");
cancelButton = new PushButton(messages.cancel());
cancelButton.addStyleName("button");

okButton = new PushButton("OK");
okButton = new PushButton(messages.ok());
okButton.addStyleName("button");

HorizontalPanel buttonPanel = new HorizontalPanel();
buttonPanel = new HorizontalPanel();
buttonPanel.setStyleName("buttonPanel");
buttonPanel.add(cancelButton);
buttonPanel.add(okButton);
Expand Down Expand Up @@ -106,6 +109,7 @@ public void onClick(ClickEvent event)
@Override
public void onClick(ClickEvent event)
{
okButton.setVisible(false);
listener.downloadAllFiles();
}
});
Expand All @@ -117,6 +121,7 @@ public void showDownloadLink(boolean show)
if(show)
{
progressPanel.add(downloadLink);
cancelButton.setText(messages.close());
}
else
{
Expand All @@ -138,11 +143,19 @@ public void setInProgress(boolean inProgress)
progressPanel.setVisible(inProgress);
}

@Override
public void show()
{
okButton.setVisible(true);
cancelButton.setText(messages.cancel());
super.show();
}

public void hide()
{
setInProgress(false);
showDownloadLink(false);
super.hide();
super.hide();
}

public void setDownloadLink(String url)
Expand Down
Expand Up @@ -111,7 +111,7 @@ public DocumentListView(Resources resources, WebTransMessages messages, UserWork
this.loadingPanel = loadingPanel;

dataProvider = new ListDataProvider<DocumentNode>();
confirmationBox = new DownloadFilesConfirmationBox(false, resources);
confirmationBox = new DownloadFilesConfirmationBox(false, messages, resources);
fileUploadDialog = new FileUploadDialog(resources);
pager = new DocumentListPager(TextLocation.CENTER, false, true);
searchField = new SearchField(this);
Expand Down

0 comments on commit 860a63b

Please sign in to comment.