| 2359 |
ankur.sing |
1 |
package in.shop2020.catalog.dashboard.client;
|
|
|
2 |
|
|
|
3 |
import com.google.gwt.core.client.GWT;
|
|
|
4 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
5 |
import com.google.gwt.uibinder.client.UiField;
|
|
|
6 |
import com.google.gwt.user.client.ui.Button;
|
|
|
7 |
import com.google.gwt.user.client.ui.CheckBox;
|
|
|
8 |
import com.google.gwt.user.client.ui.Composite;
|
|
|
9 |
import com.google.gwt.user.client.ui.TextBox;
|
|
|
10 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
11 |
|
|
|
12 |
/**
|
|
|
13 |
* A tree displaying a set of catalog folders.
|
|
|
14 |
*/
|
|
|
15 |
public class FileUploadParams extends Composite {
|
|
|
16 |
|
|
|
17 |
interface FileUploadParamsUiBinder extends UiBinder<Widget, FileUploadParams> {}
|
|
|
18 |
private static FileUploadParamsUiBinder uiBinder = GWT.create(FileUploadParamsUiBinder.class);
|
|
|
19 |
|
|
|
20 |
@UiField Button /*browseButton,*/ analyseButton, uploadButton;
|
|
|
21 |
@UiField TextBox filename, category, productGroup;
|
|
|
22 |
@UiField CheckBox fullUpdate;
|
|
|
23 |
//@UiField VerticalPanel filePanel;
|
|
|
24 |
|
|
|
25 |
public FileUploadParams() {
|
|
|
26 |
initWidget(uiBinder.createAndBindUi(this));
|
|
|
27 |
filename.setText(getFileName());
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
/*@UiHandler("analyseButton")
|
|
|
31 |
void analyse(ClickEvent event) {
|
|
|
32 |
catalogService.uploadItems(filename.getText().trim(), 1, category.getText().trim(), true, true,
|
|
|
33 |
productGroup.getText().trim(), new AsyncCallback<Void>() {
|
|
|
34 |
@Override
|
|
|
35 |
public void onSuccess(Void result) {
|
|
|
36 |
Window.alert("Dry run report generated.");
|
|
|
37 |
}
|
|
|
38 |
@Override
|
|
|
39 |
public void onFailure(Throwable caught) {
|
|
|
40 |
Window.alert("Error while generating dry run report.");
|
|
|
41 |
}
|
|
|
42 |
});
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
@UiHandler("uploadButton")
|
|
|
46 |
void upload(ClickEvent event) {
|
|
|
47 |
catalogService.uploadItems(filename.getText().trim(), 1, category.getText().trim(), true, false,
|
|
|
48 |
productGroup.getText().trim(), new AsyncCallback<Void>() {
|
|
|
49 |
@Override
|
|
|
50 |
public void onSuccess(Void result) {
|
|
|
51 |
Window.alert("Items updated.");
|
|
|
52 |
}
|
|
|
53 |
@Override
|
|
|
54 |
public void onFailure(Throwable caught) {
|
|
|
55 |
Window.alert("Error while updating items.");
|
|
|
56 |
}
|
|
|
57 |
});
|
|
|
58 |
}*/
|
|
|
59 |
|
|
|
60 |
/*@UiHandler("browseButton")
|
|
|
61 |
void onBrowse(ClickEvent event) {
|
|
|
62 |
Window.alert("creating file upload.");
|
|
|
63 |
final FileUpload upload = new FileUpload();
|
|
|
64 |
upload.setName("upload");
|
|
|
65 |
filePanel.add(upload);
|
|
|
66 |
|
|
|
67 |
//holder.add(new HTML("<hr />"));
|
|
|
68 |
|
|
|
69 |
filePanel.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
|
|
|
70 |
filePanel.add(new Button("Submit", new ClickListener()
|
|
|
71 |
{
|
|
|
72 |
public void onClick(Widget sender)
|
|
|
73 |
{
|
|
|
74 |
filename.setText(upload.getFilename());
|
|
|
75 |
}
|
|
|
76 |
}));
|
|
|
77 |
|
|
|
78 |
}*/
|
|
|
79 |
|
|
|
80 |
private String getFileName() {
|
|
|
81 |
//String userHome = System.getProperty("user.home");
|
|
|
82 |
return "~/master-sheets/ItemList.xls";
|
|
|
83 |
}
|
|
|
84 |
}
|