| 4286 |
rajveer |
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
|
|
2 |
|
|
|
3 |
import org.enunes.gwt.mvp.client.EventBus;
|
|
|
4 |
|
|
|
5 |
import com.google.gwt.core.client.GWT;
|
|
|
6 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
7 |
import com.google.gwt.event.dom.client.ClickHandler;
|
| 4353 |
rajveer |
8 |
import com.google.gwt.user.client.Window;
|
| 4286 |
rajveer |
9 |
import com.google.gwt.user.client.ui.Button;
|
|
|
10 |
import com.google.gwt.user.client.ui.DialogBox;
|
|
|
11 |
import com.google.gwt.user.client.ui.FileUpload;
|
|
|
12 |
import com.google.gwt.user.client.ui.FormPanel;
|
| 4353 |
rajveer |
13 |
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
|
|
|
14 |
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
|
| 4286 |
rajveer |
15 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
|
16 |
|
|
|
17 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
|
|
18 |
|
|
|
19 |
public class FileUploadBox extends DialogBox {
|
|
|
20 |
private FormPanel form;
|
|
|
21 |
|
|
|
22 |
public FileUploadBox(final EventBus eventBus, final long warehouseId){
|
|
|
23 |
VerticalPanel vpanel = new VerticalPanel();
|
|
|
24 |
|
|
|
25 |
form = new FormPanel();
|
|
|
26 |
form.setEncoding(FormPanel.ENCODING_MULTIPART);
|
|
|
27 |
form.setMethod(FormPanel.METHOD_POST);
|
|
|
28 |
form.setAction(GWT.getHostPageBaseURL() + "process-inventory-report");
|
|
|
29 |
vpanel.add(form);
|
|
|
30 |
vpanel.setHeight("80px");
|
|
|
31 |
HorizontalPanel hpanel = new HorizontalPanel();
|
|
|
32 |
|
|
|
33 |
FileUpload upload = new FileUpload();
|
|
|
34 |
upload.setName("file");
|
|
|
35 |
hpanel.add(upload);
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
Button submitbutton = new Button("Upload");
|
|
|
39 |
hpanel.add(submitbutton);
|
|
|
40 |
form.setWidget(hpanel);
|
|
|
41 |
|
|
|
42 |
setWidget(vpanel);
|
|
|
43 |
setAutoHideEnabled(true);
|
|
|
44 |
setGlassEnabled(true);
|
|
|
45 |
setText("Select file to upload");
|
|
|
46 |
setModal(true);
|
|
|
47 |
|
|
|
48 |
submitbutton.addClickHandler(new ClickHandler() {
|
|
|
49 |
public void onClick(ClickEvent event) {
|
|
|
50 |
form.submit();
|
|
|
51 |
}
|
| 4353 |
rajveer |
52 |
});
|
|
|
53 |
|
|
|
54 |
form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
|
|
|
55 |
|
|
|
56 |
@Override
|
|
|
57 |
public void onSubmitComplete(SubmitCompleteEvent event) {
|
|
|
58 |
Window.alert("File Uploaded successfully.");
|
|
|
59 |
hide();
|
|
|
60 |
|
|
|
61 |
}
|
|
|
62 |
});
|
| 4286 |
rajveer |
63 |
}
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
}
|