Subversion Repositories SmartDukaan

Rev

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

Rev 4762 Rev 4957
Line 16... Line 16...
16
import com.google.gwt.user.client.ui.Button;
16
import com.google.gwt.user.client.ui.Button;
17
import com.google.gwt.user.client.ui.DialogBox;
17
import com.google.gwt.user.client.ui.DialogBox;
18
import com.google.gwt.user.client.ui.HorizontalPanel;
18
import com.google.gwt.user.client.ui.HorizontalPanel;
19
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;
20
import com.google.gwt.user.client.ui.ListBox;
21
import com.google.gwt.user.client.ui.RadioButton;
-
 
22
import com.google.gwt.user.client.ui.ResizeComposite;
21
import com.google.gwt.user.client.ui.ResizeComposite;
23
import com.google.gwt.user.client.ui.VerticalPanel;
22
import com.google.gwt.user.client.ui.VerticalPanel;
24
import com.google.gwt.user.client.ui.Widget;
23
import com.google.gwt.user.client.ui.Widget;
25
 
24
 
26
/**
25
/**
Line 177... Line 176...
177
        db.setText("Master Sheet Download");
176
        db.setText("Master Sheet Download");
178
        
177
        
179
        final Label categoryLabel = new Label("Category");
178
        final Label categoryLabel = new Label("Category");
180
        vp.add(categoryLabel);
179
        vp.add(categoryLabel);
181
        
180
        
182
        final RadioButton handsetsRB = new RadioButton("Category", "Handsets");
181
        final ListBox category = new ListBox();
183
        final RadioButton accRB = new RadioButton("Category", "Accessories");
182
        category.addItem("ALL");
184
        handsetsRB.setValue(true);
183
        category.addItem("ALL Handsets");
185
        
184
        category.addItem("ALL Accessories");
186
        HorizontalPanel hpRB = new HorizontalPanel();
185
        for(String display_name : Utils.getAllCategories()){
187
        hpRB.add(handsetsRB);
186
        	category.addItem(display_name);
188
        hpRB.add(accRB);
187
        }
-
 
188
        
189
        vp.add(hpRB);
189
        vp.add(category);
190
        
190
        
191
        final Label vendorLabel = new Label("Vendor");
191
        final Label vendorLabel = new Label("Vendor");
192
        vp.add(vendorLabel);
192
        vp.add(vendorLabel);
193
        
193
        
194
        final ListBox vendor = new ListBox();
194
        final ListBox vendor = new ListBox();
-
 
195
        vendor.addItem("ALL");
195
        for(Entry<Long, String> e : Utils.getAllVendors().entrySet()){
196
        for(Entry<Long, String> e : Utils.getAllVendors().entrySet()){
196
            vendor.addItem(e.getValue());
197
            vendor.addItem(e.getValue());
197
        }
198
        }
198
        
199
        
199
        vp.add(vendor);
200
        vp.add(vendor);
200
        
201
        
-
 
202
        final Label brandLabel = new Label("Brand");
-
 
203
        vp.add(brandLabel);
-
 
204
        
-
 
205
        final ListBox brand = new ListBox();
-
 
206
        brand.addItem("ALL");
-
 
207
        for(String brand_name : Utils.getAllBrands()){
-
 
208
        	brand.addItem(brand_name);
-
 
209
        }
-
 
210
        
-
 
211
        vp.add(brand);
-
 
212
        
201
        Button submitButton = new Button("OK");
213
        Button submitButton = new Button("OK");
202
        Button cancelButton = new Button("Cancel");
214
        Button cancelButton = new Button("Cancel");
203
        HorizontalPanel hpButtons = new HorizontalPanel();
215
        HorizontalPanel hpButtons = new HorizontalPanel();
204
        hpButtons.setSpacing(5);
216
        hpButtons.setSpacing(5);
205
        hpButtons.add(submitButton);
217
        hpButtons.add(submitButton);
Line 209... Line 221...
209
        
221
        
210
        db.add(vp);
222
        db.add(vp);
211
        submitButton.addClickHandler(new ClickHandler() {
223
        submitButton.addClickHandler(new ClickHandler() {
212
            @Override
224
            @Override
213
            public void onClick(ClickEvent event) {
225
            public void onClick(ClickEvent event) {
-
 
226
                String Category = category.getItemText(category.getSelectedIndex());                
-
 
227
                String Brand = brand.getItemText(brand.getSelectedIndex());
214
                String Category;
228
                long vendorId;
215
                if(handsetsRB.getValue()) {
229
                if(vendor.getSelectedIndex() != 0){
-
 
230
                	vendorId = Utils.getVendorId(vendor.getItemText(vendor.getSelectedIndex()));
216
                    Category = "Handsets";
231
                }
217
                } else {
232
                else{
218
                    Category = "Accessories";
233
                	vendorId = 0;
219
                }
234
                }
220
                
-
 
221
                long vendorId = Utils.getVendorId(vendor.getItemText(vendor.getSelectedIndex()));
-
 
222
                
235
                
223
                // Servlet mapping mastersheet/download is mapped to in.shop2020.catalog.dashboard.server.FileDownloadServlet
236
                // Servlet mapping mastersheet/download is mapped to in.shop2020.catalog.dashboard.server.FileDownloadServlet
224
                String link = GWT.getHostPageBaseURL() + "mastersheet/download?Category=" + Category + "&vendorId=" + vendorId;
237
                String link = GWT.getHostPageBaseURL() + "mastersheet/download?Category=" + Category + "&vendorId=" + vendorId + "&brand=" + Brand;
225
                Window.open(link, "_self", "Master Sheet Download");
238
                Window.open(link, "_self", "Master Sheet Download");
226
                db.hide();
239
                db.hide();
227
            }
240
            }
228
        });
241
        });
229
        cancelButton.addClickHandler(new ClickHandler() {
242
        cancelButton.addClickHandler(new ClickHandler() {