Subversion Repositories SmartDukaan

Rev

Rev 3921 | Rev 4762 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3921 Rev 4440
Line 1... Line 1...
1
package in.shop2020.catalog.dashboard.client;
1
package in.shop2020.catalog.dashboard.client;
2
 
2
 
-
 
3
import java.util.Map.Entry;
-
 
4
 
3
import in.shop2020.catalog.dashboard.shared.Item;
5
import in.shop2020.catalog.dashboard.shared.Item;
4
import in.shop2020.catalog.dashboard.shared.Utils;
6
import in.shop2020.catalog.dashboard.shared.Utils;
5
 
7
 
6
import com.google.gwt.core.client.GWT;
8
import com.google.gwt.core.client.GWT;
7
import com.google.gwt.event.dom.client.ClickEvent;
9
import com.google.gwt.event.dom.client.ClickEvent;
Line 13... Line 15...
13
import com.google.gwt.user.client.rpc.AsyncCallback;
15
import com.google.gwt.user.client.rpc.AsyncCallback;
14
import com.google.gwt.user.client.ui.Button;
16
import com.google.gwt.user.client.ui.Button;
15
import com.google.gwt.user.client.ui.DialogBox;
17
import com.google.gwt.user.client.ui.DialogBox;
16
import com.google.gwt.user.client.ui.HorizontalPanel;
18
import com.google.gwt.user.client.ui.HorizontalPanel;
17
import com.google.gwt.user.client.ui.Label;
19
import com.google.gwt.user.client.ui.Label;
-
 
20
import com.google.gwt.user.client.ui.ListBox;
18
import com.google.gwt.user.client.ui.RadioButton;
21
import com.google.gwt.user.client.ui.RadioButton;
19
import com.google.gwt.user.client.ui.ResizeComposite;
22
import com.google.gwt.user.client.ui.ResizeComposite;
20
import com.google.gwt.user.client.ui.VerticalPanel;
23
import com.google.gwt.user.client.ui.VerticalPanel;
21
import com.google.gwt.user.client.ui.Widget;
24
import com.google.gwt.user.client.ui.Widget;
22
 
25
 
Line 186... Line 189...
186
        vp.add(hpRB);
189
        vp.add(hpRB);
187
        
190
        
188
        final Label vendorLabel = new Label("Vendor");
191
        final Label vendorLabel = new Label("Vendor");
189
        vp.add(vendorLabel);
192
        vp.add(vendorLabel);
190
        
193
        
191
        //TODO: Get the list of all vendors from the database and populate the choices accordingly
-
 
192
        final RadioButton hotspotRB = new RadioButton("vendor", "Hotspot");
194
        final ListBox vendor = new ListBox();
193
        final RadioButton sarvottamRB = new RadioButton("vendor", "Sarvottam");
195
        for(Entry<Long, String> e : Utils.getAllVendors().entrySet()){
194
        final RadioButton tulipRB = new RadioButton("vendor", "Tulip");
-
 
195
        hotspotRB.setValue(true);
196
            vendor.addItem(e.getValue());
196
        
197
        }
197
        HorizontalPanel vendorPanel = new HorizontalPanel();
-
 
198
        vendorPanel.add(hotspotRB);
-
 
199
        vendorPanel.add(tulipRB);
-
 
200
        vendorPanel.add(sarvottamRB);
-
 
201
        
198
        
202
        vp.add(vendorPanel);
199
        vp.add(vendor);
203
        
200
        
204
        Button submitButton = new Button("OK");
201
        Button submitButton = new Button("OK");
205
        Button cancelButton = new Button("Cancel");
202
        Button cancelButton = new Button("Cancel");
206
        HorizontalPanel hpButtons = new HorizontalPanel();
203
        HorizontalPanel hpButtons = new HorizontalPanel();
207
        hpButtons.setSpacing(5);
204
        hpButtons.setSpacing(5);
Line 219... Line 216...
219
                    vendorCategory = "Handsets";
216
                    vendorCategory = "Handsets";
220
                } else {
217
                } else {
221
                    vendorCategory = "Accessories";
218
                    vendorCategory = "Accessories";
222
                }
219
                }
223
                
220
                
224
                long vendorId = 1;
-
 
225
                if(hotspotRB.getValue()) {
-
 
226
                    vendorId = 1;
-
 
227
                } else if(sarvottamRB.getValue()) {
221
                long vendorId = Utils.getVendorId(vendor.getItemText(vendor.getSelectedIndex()));
228
                    vendorId = 3;
-
 
229
                } else if(tulipRB.getValue()) {
-
 
230
                    vendorId = 2;
-
 
231
                }
-
 
232
                
222
                
233
                // Servlet mapping mastersheet/download is mapped to in.shop2020.catalog.dashboard.server.FileDownloadServlet
223
                // Servlet mapping mastersheet/download is mapped to in.shop2020.catalog.dashboard.server.FileDownloadServlet
234
                String link = GWT.getHostPageBaseURL() + "mastersheet/download?vendorCategory=" + vendorCategory + "&vendorId=" + vendorId;
224
                String link = GWT.getHostPageBaseURL() + "mastersheet/download?vendorCategory=" + vendorCategory + "&vendorId=" + vendorId;
235
                Window.open(link, "_self", "Master Sheet Download");
225
                Window.open(link, "_self", "Master Sheet Download");
236
                db.hide();
226
                db.hide();