Subversion Repositories SmartDukaan

Rev

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

Rev 2427 Rev 3884
Line 12... Line 12...
12
import com.google.gwt.user.client.Window;
12
import com.google.gwt.user.client.Window;
13
import com.google.gwt.user.client.rpc.AsyncCallback;
13
import com.google.gwt.user.client.rpc.AsyncCallback;
14
import com.google.gwt.user.client.ui.Button;
14
import com.google.gwt.user.client.ui.Button;
15
import com.google.gwt.user.client.ui.DialogBox;
15
import com.google.gwt.user.client.ui.DialogBox;
16
import com.google.gwt.user.client.ui.HorizontalPanel;
16
import com.google.gwt.user.client.ui.HorizontalPanel;
-
 
17
import com.google.gwt.user.client.ui.Label;
17
import com.google.gwt.user.client.ui.RadioButton;
18
import com.google.gwt.user.client.ui.RadioButton;
18
import com.google.gwt.user.client.ui.ResizeComposite;
19
import com.google.gwt.user.client.ui.ResizeComposite;
19
import com.google.gwt.user.client.ui.VerticalPanel;
20
import com.google.gwt.user.client.ui.VerticalPanel;
20
import com.google.gwt.user.client.ui.Widget;
21
import com.google.gwt.user.client.ui.Widget;
21
 
22
 
Line 168... Line 169...
168
     */
169
     */
169
    private void createDialog() {
170
    private void createDialog() {
170
        VerticalPanel vp = new VerticalPanel();
171
        VerticalPanel vp = new VerticalPanel();
171
        final DialogBox db = new DialogBox();
172
        final DialogBox db = new DialogBox();
172
        db.setText("Master Sheet Download");
173
        db.setText("Master Sheet Download");
-
 
174
        
-
 
175
        final Label categoryLabel = new Label("Category");
-
 
176
        vp.add(categoryLabel);
-
 
177
        
173
        final RadioButton handsetsRB = new RadioButton("vendorCategory", "Handsets");
178
        final RadioButton handsetsRB = new RadioButton("vendorCategory", "Handsets");
174
        final RadioButton accRB = new RadioButton("vendorCategory", "Accessories");
179
        final RadioButton accRB = new RadioButton("vendorCategory", "Accessories");
175
        handsetsRB.setValue(true);
180
        handsetsRB.setValue(true);
-
 
181
        
176
        HorizontalPanel hpRB = new HorizontalPanel();
182
        HorizontalPanel hpRB = new HorizontalPanel();
177
        hpRB.add(handsetsRB);
183
        hpRB.add(handsetsRB);
178
        hpRB.add(accRB);
184
        hpRB.add(accRB);
179
        
-
 
180
        vp.add(hpRB);
185
        vp.add(hpRB);
181
        
186
        
-
 
187
        final Label vendorLabel = new Label("Vendor");
-
 
188
        vp.add(vendorLabel);
-
 
189
        
-
 
190
        final RadioButton hotspotRB = new RadioButton("vendor", "Hotspot");
-
 
191
        final RadioButton sarvottamRB = new RadioButton("vendor", "Sarvottam");
-
 
192
        final RadioButton tulipRB = new RadioButton("vendor", "Tulip");
-
 
193
        hotspotRB.setValue(true);
-
 
194
        
-
 
195
        HorizontalPanel vendorPanel = new HorizontalPanel();
-
 
196
        vendorPanel.add(hotspotRB);
-
 
197
        vendorPanel.add(tulipRB);
-
 
198
        vendorPanel.add(sarvottamRB);
-
 
199
        
-
 
200
        vp.add(vendorPanel);
-
 
201
        
182
        Button submitButton = new Button("OK");
202
        Button submitButton = new Button("OK");
183
        Button cancelButton = new Button("Cancel");
203
        Button cancelButton = new Button("Cancel");
184
        HorizontalPanel hpButtons = new HorizontalPanel();
204
        HorizontalPanel hpButtons = new HorizontalPanel();
185
        hpButtons.setSpacing(5);
205
        hpButtons.setSpacing(5);
186
        hpButtons.add(submitButton);
206
        hpButtons.add(submitButton);
187
        hpButtons.add(cancelButton);
207
        hpButtons.add(cancelButton);
188
        
208
        
189
        vp.add(hpRB);
-
 
190
        vp.add(hpButtons);
209
        vp.add(hpButtons);
-
 
210
        
191
        db.add(vp);
211
        db.add(vp);
192
        submitButton.addClickHandler(new ClickHandler() {
212
        submitButton.addClickHandler(new ClickHandler() {
193
            @Override
213
            @Override
194
            public void onClick(ClickEvent event) {
214
            public void onClick(ClickEvent event) {
195
                String vendorCategory;
215
                String vendorCategory;
196
                if(handsetsRB.getValue()) {
216
                if(handsetsRB.getValue()) {
197
                    vendorCategory = "Handsets";
217
                    vendorCategory = "Handsets";
198
                } else {
218
                } else {
199
                    vendorCategory = "Accessories";
219
                    vendorCategory = "Accessories";
200
                }
220
                }
-
 
221
                
-
 
222
                long vendorId = 1;
-
 
223
                if(hotspotRB.getValue()) {
-
 
224
                    vendorId = 1;
-
 
225
                } else if(sarvottamRB.getValue()) {
-
 
226
                    vendorId = 3;
-
 
227
                } else if(tulipRB.getValue()) {
-
 
228
                    vendorId = 2;
-
 
229
                }
-
 
230
                
201
                // Servlet mapping mastersheet/download is mapped to in.shop2020.catalog.dashboard.server.FileDownloadServlet
231
                // Servlet mapping mastersheet/download is mapped to in.shop2020.catalog.dashboard.server.FileDownloadServlet
202
                String link = GWT.getHostPageBaseURL() + "mastersheet/download?vendorCategory=" + vendorCategory;
232
                String link = GWT.getHostPageBaseURL() + "mastersheet/download?vendorCategory=" + vendorCategory + "&vendorId=" + vendorId;
203
                Window.open(link, "_self", "Master Sheet Download");
233
                Window.open(link, "_self", "Master Sheet Download");
204
                db.hide();
234
                db.hide();
205
            }
235
            }
206
        });
236
        });
207
        cancelButton.addClickHandler(new ClickHandler() {
237
        cancelButton.addClickHandler(new ClickHandler() {