Subversion Repositories SmartDukaan

Rev

Rev 3850 | Rev 6530 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1961 ankur.sing 1
package in.shop2020.catalog.dashboard.client;
2
 
3
import in.shop2020.catalog.dashboard.shared.Item;
3850 chandransh 4
import in.shop2020.catalog.dashboard.shared.ItemStatus;
1961 ankur.sing 5
 
3872 chandransh 6
import java.util.ArrayList;
7
import java.util.Arrays;
1961 ankur.sing 8
import java.util.List;
9
 
10
import com.google.gwt.core.client.GWT;
3524 chandransh 11
import com.google.gwt.dom.client.Style.Unit;
1961 ankur.sing 12
import com.google.gwt.resources.client.CssResource;
13
import com.google.gwt.uibinder.client.UiBinder;
14
import com.google.gwt.uibinder.client.UiField;
3524 chandransh 15
import com.google.gwt.user.cellview.client.CellTable;
16
import com.google.gwt.user.cellview.client.SimplePager;
17
import com.google.gwt.user.cellview.client.TextColumn;
1961 ankur.sing 18
import com.google.gwt.user.client.Window;
19
import com.google.gwt.user.client.rpc.AsyncCallback;
2489 ankur.sing 20
import com.google.gwt.user.client.ui.Label;
1961 ankur.sing 21
import com.google.gwt.user.client.ui.ResizeComposite;
22
import com.google.gwt.user.client.ui.Widget;
3850 chandransh 23
import com.google.gwt.view.client.AsyncDataProvider;
24
import com.google.gwt.view.client.HasData;
3524 chandransh 25
import com.google.gwt.view.client.ListDataProvider;
3850 chandransh 26
import com.google.gwt.view.client.Range;
3524 chandransh 27
import com.google.gwt.view.client.SelectionChangeEvent;
28
import com.google.gwt.view.client.SingleSelectionModel;
1961 ankur.sing 29
 
2427 ankur.sing 30
/**
31
 * List of items. List contains item Id, product group, brand, model number, model name, color and category
32
 * Dashboard user can select an item in this list and its details are shown in ItemDetails widget.
33
 *
34
 */
1961 ankur.sing 35
public class ItemList extends ResizeComposite{
36
 
2489 ankur.sing 37
    private static String LEGEND = "Currently Showing: ";
1961 ankur.sing 38
    private final CatalogServiceAsync catalogService = GWT.create(CatalogService.class);
39
 
40
    interface ItemListUiBinder extends UiBinder<Widget, ItemList> { }
41
    private static final ItemListUiBinder uiBinder = GWT.create(ItemListUiBinder.class);
42
 
43
    interface SelectionStyle extends CssResource{
44
        String selectedRow();
45
        String alertsRow();
46
    }
47
 
3524 chandransh 48
    @UiField CellTable<Item> itemDescriptionTable;
49
    // Create paging controls.
50
    @UiField SimplePager pager = new SimplePager();
51
 
1961 ankur.sing 52
    @UiField SelectionStyle selectionStyle;
2489 ankur.sing 53
    @UiField Label currentlyShowing;
1961 ankur.sing 54
 
2126 ankur.sing 55
    private ItemDetails itemDetails;
56
 
3850 chandransh 57
    private String currentTreeItemSelection = null;
58
 
3872 chandransh 59
    private String searchText = "";
60
 
61
    private List<String> searchTerms = new ArrayList<String>();
62
 
3850 chandransh 63
    private TextColumn<Item> idColumn = new TextColumn<Item>() {
64
        @Override
65
        public String getValue(Item item) {
66
            return item.getId() + "";
67
        }
68
    };
69
 
70
    private TextColumn<Item> pgColumn = new TextColumn<Item>() {
71
        @Override
72
        public String getValue(Item item) {
73
            return item.getProductGroup();
74
        }
75
    };
76
 
77
    private TextColumn<Item> brandColumn = new TextColumn<Item>(){
78
        @Override
79
        public String getValue(Item item) {
80
            return item.getBrand();
81
        }
82
    };
83
 
84
    private TextColumn<Item> modelNumberColumn = new TextColumn<Item>(){
85
        @Override
86
        public String getValue(Item item) {
87
            return item.getModelNumber();
88
        }
89
    };
90
 
91
    private TextColumn<Item> modelNameColumn = new TextColumn<Item>(){
92
        @Override
93
        public String getValue(Item item) {
94
            return item.getModelName();
95
        }
96
    };
97
 
98
    private TextColumn<Item> colorColumn = new TextColumn<Item>(){
99
        @Override
100
        public String getValue(Item item) {
101
            return item.getColor();
102
        }
103
    };
104
 
105
    private TextColumn<Item> categoryColumn = new TextColumn<Item>(){
106
        @Override
107
        public String getValue(Item item) {
108
            return item.getContentCategory()+"";
109
        }
110
    };
111
 
3524 chandransh 112
    // Create a data provider.
113
    ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
114
 
3850 chandransh 115
    AsyncDataProvider<Item> asyncDataProvider = new AsyncDataProvider<Item>() {
116
 
117
        @Override
118
        protected void onRangeChanged(HasData<Item> display) {
119
            Range range = display.getVisibleRange();
120
            int start = range.getStart();
121
            int limit = range.getLength();
122
            if(currentTreeItemSelection == null)
123
                currentTreeItemSelection = CatalogTree.RISKY_ITEMS;
124
            if(currentTreeItemSelection.equals(CatalogTree.ALL_ITEMS))
125
                loadAllItems(start, limit);
126
            else if(currentTreeItemSelection.equals(CatalogTree.ALL_ACTIVE_ITEMS))
127
                loadAllActiveItems(start, limit);
128
            else if(currentTreeItemSelection.equals(CatalogTree.ALL_PAUSED_ITEMS))
129
                loadAllPausedItems(start, limit);
130
            else if(currentTreeItemSelection.equals(CatalogTree.ALL_PHASED_OUT_ITEMS))
131
                loadAllPhasedOutItems(start, limit);
132
            else if(currentTreeItemSelection.equals(CatalogTree.IN_PROCESS_ITEMS))
133
                loadAllInProcessItems(start, limit);
134
            else if(currentTreeItemSelection.equals(CatalogTree.CONTENT_COMPLETE_ITEMS))
135
                loadAllContentCompleteItems(start, limit);
136
            else if(currentTreeItemSelection.equals(CatalogTree.BEST_DEALS))
137
                loadBestDeals(start, limit);
138
            else if(currentTreeItemSelection.equals(CatalogTree.BEST_SELLERS))
139
                loadBestSellers(start, limit);
140
            else if(currentTreeItemSelection.equals(CatalogTree.LATEST_ARRIVALS))
141
                loadLatestArrivals(start, limit);
142
            else if(currentTreeItemSelection.equals(CatalogTree.RISKY_ITEMS))
143
                loadAllRiskyItems(start, limit);
3872 chandransh 144
            else if(currentTreeItemSelection.equals(CatalogTree.SEARCH))
145
                loadSearchItems(start, limit);
3850 chandransh 146
        }
147
    };
148
 
1961 ankur.sing 149
    public ItemList() {
150
        initWidget(uiBinder.createAndBindUi(this));
151
        initItemList();
152
    }
3850 chandransh 153
 
1961 ankur.sing 154
    private void initItemList() {
3524 chandransh 155
        // Add the columns.        
156
        itemDescriptionTable.addColumn(idColumn, "Item Id");
157
        itemDescriptionTable.addColumn(pgColumn, "Product Group");
158
        itemDescriptionTable.addColumn(brandColumn, "Brand");
159
        itemDescriptionTable.addColumn(modelNumberColumn, "Model Number");
160
        itemDescriptionTable.addColumn(modelNameColumn, "Model Name");
161
        itemDescriptionTable.addColumn(colorColumn, "Color");
162
        itemDescriptionTable.addColumn(categoryColumn, "Category");
163
 
164
        //Set the widths
165
        itemDescriptionTable.setWidth("100%");
166
        itemDescriptionTable.setColumnWidth(idColumn, 80.0, Unit.PX);
167
        itemDescriptionTable.setColumnWidth(pgColumn, 128.0, Unit.PX);
168
        itemDescriptionTable.setColumnWidth(brandColumn, 150.0, Unit.PX);
169
        itemDescriptionTable.setColumnWidth(modelNumberColumn, 200.0, Unit.PX);
170
        itemDescriptionTable.setColumnWidth(modelNameColumn, 200.0, Unit.PX);
171
        itemDescriptionTable.setColumnWidth(colorColumn, 128.0, Unit.PX);
172
        itemDescriptionTable.setColumnWidth(categoryColumn, 220.0, Unit.PX);
173
 
174
        // Connect the table to the data provider.
3850 chandransh 175
        //dataProvider.addDataDisplay(itemDescriptionTable);
176
        asyncDataProvider.addDataDisplay(itemDescriptionTable);
3524 chandransh 177
 
178
        //Add paging support
179
        pager.setDisplay(itemDescriptionTable);
180
 
181
        // Add a selection model to handle item selection.
182
        final SingleSelectionModel<Item> selectionModel = new SingleSelectionModel<Item>();
183
        itemDescriptionTable.setSelectionModel(selectionModel);
184
        selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
185
 
186
            @Override
187
            public void onSelectionChange(SelectionChangeEvent event) {
188
                Item selectedItem = selectionModel.getSelectedObject();
189
                catalogService.getItem(selectedItem.getId(), new AsyncCallback<Item>() {
190
                    @Override
191
                    public void onSuccess(Item result) {
192
                        itemDetails.setItemDetails(result);
193
                    }
194
                    @Override
195
                    public void onFailure(Throwable caught) {
196
                        caught.printStackTrace();
197
                        Window.alert("Unable to fetch item details.");
198
                    }
199
                });
200
            }
201
        });
202
 
203
        loadAllRiskyItems();
1961 ankur.sing 204
    }
205
 
3850 chandransh 206
    public void loadAllItems() {
207
        currentTreeItemSelection = CatalogTree.ALL_ITEMS;
208
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
1961 ankur.sing 209
    }
210
 
3850 chandransh 211
    public void loadAllActiveItems() {
212
        currentTreeItemSelection = CatalogTree.ALL_ACTIVE_ITEMS;
213
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
1961 ankur.sing 214
    }
215
 
3850 chandransh 216
    public void loadAllPhasedOutItems() {
217
        currentTreeItemSelection = CatalogTree.ALL_PHASED_OUT_ITEMS;
218
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
219
    }
1961 ankur.sing 220
 
3850 chandransh 221
    public void loadAllPausedItems() {
222
        currentTreeItemSelection = CatalogTree.ALL_PAUSED_ITEMS;
223
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
224
    }
2427 ankur.sing 225
 
3850 chandransh 226
    public void loadAllInProcessItems() {
227
        currentTreeItemSelection = CatalogTree.IN_PROCESS_ITEMS;
228
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
229
    }
230
 
231
    public void loadAllContentCompleteItems(){
232
        currentTreeItemSelection = CatalogTree.CONTENT_COMPLETE_ITEMS;
233
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
234
    }
235
 
236
    public void loadAllRiskyItems() {
237
        currentTreeItemSelection = CatalogTree.RISKY_ITEMS;
238
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
239
    }
240
 
241
    public void loadBestDeals() {
242
        currentTreeItemSelection = CatalogTree.BEST_DEALS;
243
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
244
    }
245
 
3872 chandransh 246
    public void loadBestSellers() {
247
        currentTreeItemSelection = CatalogTree.BEST_SELLERS;
248
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
249
    }
250
 
3850 chandransh 251
    public void loadLatestArrivals() {
252
        currentTreeItemSelection = CatalogTree.LATEST_ARRIVALS;
253
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
254
    }
255
 
3872 chandransh 256
    public void searchForItems(String searchText) {
257
        currentTreeItemSelection = CatalogTree.SEARCH;
258
        this.searchText = searchText.trim().replaceAll("\\s+", " ");
259
        searchTerms = Arrays.asList(this.searchText.split(" "));
3850 chandransh 260
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
261
    }
262
 
263
    private void updateItemDescriptionTableRowCount(Integer count){
264
        asyncDataProvider.updateRowCount(count, true);
265
    }
266
 
267
    private void updateAsyncItemDescriptionTable(int start, List<Item> items){
268
        // Add the data to the data provider, which automatically pushes it to the
269
        // widget.
270
        asyncDataProvider.updateRowData(start, items);
271
    }
272
 
273
    private void loadAllItems(final int offset, final int limit) {
274
        catalogService.getAllItems(offset, limit, new AsyncCallback<List<Item>>() {
1961 ankur.sing 275
            public void onFailure(Throwable caught) {
2126 ankur.sing 276
                caught.printStackTrace();
1992 ankur.sing 277
                Window.alert("Could not get all items...");
1961 ankur.sing 278
            }
279
            public void onSuccess(List<Item> result) {
3850 chandransh 280
                updateAsyncItemDescriptionTable(offset, result);
281
                currentlyShowing.setText(LEGEND + "All Items");
1961 ankur.sing 282
            }
283
        });
3850 chandransh 284
 
285
        catalogService.getItemCountByStatus(false, ItemStatus.ACTIVE, new AsyncCallback<Integer>() {
286
 
287
            @Override
288
            public void onFailure(Throwable caught) {
289
                caught.printStackTrace();
290
                Window.alert("Could not get the count of items...");
291
            }
292
 
293
            @Override
294
            public void onSuccess(Integer count) {
295
                updateItemDescriptionTableRowCount(count);
296
            }
297
        });
1961 ankur.sing 298
    }
299
 
3850 chandransh 300
    private void loadAllActiveItems(final int offset, final int limit) {
301
        catalogService.getAllActiveItems(offset, limit, new AsyncCallback<List<Item>>() {
2119 ankur.sing 302
            public void onFailure(Throwable caught) {
2126 ankur.sing 303
                caught.printStackTrace();
2119 ankur.sing 304
                Window.alert("Could not get all active items...");
305
            }
306
            public void onSuccess(List<Item> result) {
3850 chandransh 307
                updateAsyncItemDescriptionTable(offset, result);
2489 ankur.sing 308
                currentlyShowing.setText(LEGEND + "Active Items");
2119 ankur.sing 309
            }
310
        });
3850 chandransh 311
 
312
        catalogService.getItemCountByStatus(true, ItemStatus.ACTIVE, new AsyncCallback<Integer>() {
313
 
314
            @Override
315
            public void onFailure(Throwable caught) {
316
                caught.printStackTrace();
317
                Window.alert("Could not get the count of items...");
318
            }
319
 
320
            @Override
321
            public void onSuccess(Integer count) {
322
                updateItemDescriptionTableRowCount(count);
323
            }
324
        });
2119 ankur.sing 325
    }
326
 
3850 chandransh 327
    private void loadAllPhasedOutItems(final int offset, int limit){
328
        catalogService.getAllPhasedOutItems(offset, limit, new AsyncCallback<List<Item>>() {
2208 ankur.sing 329
            public void onFailure(Throwable caught) {
330
                caught.printStackTrace();
331
                Window.alert("Could not load phased out items...");
332
            }
333
            public void onSuccess(List<Item> result) {
3850 chandransh 334
                updateAsyncItemDescriptionTable(offset, result);
2489 ankur.sing 335
                currentlyShowing.setText(LEGEND + "Phased Out Items");
2208 ankur.sing 336
            }
337
        });
3850 chandransh 338
 
339
        catalogService.getItemCountByStatus(true, ItemStatus.PHASED_OUT, new AsyncCallback<Integer>() {
340
 
341
            @Override
342
            public void onFailure(Throwable caught) {
343
                caught.printStackTrace();
344
                Window.alert("Could not get the count of items...");
345
            }
346
 
347
            @Override
348
            public void onSuccess(Integer count) {
349
                updateItemDescriptionTableRowCount(count);
350
            }
351
        });
2208 ankur.sing 352
    }
353
 
3850 chandransh 354
    private void loadAllPausedItems(final int offset, int limit) {
355
        catalogService.getAllPausedItems(offset, limit, new AsyncCallback<List<Item>>() {
2208 ankur.sing 356
            public void onFailure(Throwable caught) {
357
                caught.printStackTrace();
358
                Window.alert("Could not load paused items...");
359
            }
360
            public void onSuccess(List<Item> result) {
3850 chandransh 361
                updateAsyncItemDescriptionTable(offset, result);
2489 ankur.sing 362
                currentlyShowing.setText(LEGEND + "Paused Items");
2208 ankur.sing 363
            }
364
        });
3850 chandransh 365
 
366
        catalogService.getItemCountByStatus(true, ItemStatus.PAUSED, new AsyncCallback<Integer>() {
367
 
368
            @Override
369
            public void onFailure(Throwable caught) {
370
                caught.printStackTrace();
371
                Window.alert("Could not get the count of items...");
372
            }
373
 
374
            @Override
375
            public void onSuccess(Integer count) {
376
                updateItemDescriptionTableRowCount(count);
377
            }
378
        });
2208 ankur.sing 379
    }
380
 
3850 chandransh 381
    private void loadAllInProcessItems(final int offset, int limit) {
382
        catalogService.getAllInProcessItems(offset, limit, new AsyncCallback<List<Item>>() {
2359 ankur.sing 383
            public void onFailure(Throwable caught) {
384
                caught.printStackTrace();
385
                Window.alert("Could not load IN_PROCESS items...");
386
            }
387
            public void onSuccess(List<Item> result) {
3850 chandransh 388
                updateAsyncItemDescriptionTable(offset, result);
2489 ankur.sing 389
                currentlyShowing.setText(LEGEND + "In Process Items");
2359 ankur.sing 390
            }
391
        });
3850 chandransh 392
 
393
        catalogService.getItemCountByStatus(true, ItemStatus.IN_PROCESS, new AsyncCallback<Integer>() {
394
 
395
            @Override
396
            public void onFailure(Throwable caught) {
397
                caught.printStackTrace();
398
                Window.alert("Could not get the count of items...");
399
            }
400
 
401
            @Override
402
            public void onSuccess(Integer count) {
403
                updateItemDescriptionTableRowCount(count);
404
            }
405
        });
2359 ankur.sing 406
    }
407
 
3850 chandransh 408
    private void loadAllContentCompleteItems(final int offset, int limit) {
409
        catalogService.getAllContentCompleteItems(offset, limit, new AsyncCallback<List<Item>>() {
2359 ankur.sing 410
            public void onFailure(Throwable caught) {
411
                caught.printStackTrace();
412
                Window.alert("Could not load CONTENT_COMPLETE items...");
413
            }
414
            public void onSuccess(List<Item> result) {
3850 chandransh 415
                updateAsyncItemDescriptionTable(offset, result);
2489 ankur.sing 416
                currentlyShowing.setText(LEGEND + "Content Complete Items");
2359 ankur.sing 417
            }
418
        });
3850 chandransh 419
 
420
        catalogService.getItemCountByStatus(true, ItemStatus.CONTENT_COMPLETE, new AsyncCallback<Integer>() {
421
 
422
            @Override
2359 ankur.sing 423
            public void onFailure(Throwable caught) {
424
                caught.printStackTrace();
3850 chandransh 425
                Window.alert("Could not get the count of items...");
2359 ankur.sing 426
            }
3850 chandransh 427
 
428
            @Override
429
            public void onSuccess(Integer count) {
430
                updateItemDescriptionTableRowCount(count);
2359 ankur.sing 431
            }
432
        });
433
    }
434
 
3850 chandransh 435
    private void loadAllRiskyItems(final int start, final int limit) {
436
        catalogService.getRiskyItems(new AsyncCallback<List<Item>>() {
1992 ankur.sing 437
            public void onFailure(Throwable caught) {
2126 ankur.sing 438
                caught.printStackTrace();
3850 chandransh 439
                Window.alert("Could not load RISKY items...");
1992 ankur.sing 440
            }
441
            public void onSuccess(List<Item> result) {
3872 chandransh 442
                updateAsyncItemDescriptionTable(start, result.subList(start, Math.min(start + limit, result.size())));
3850 chandransh 443
                updateItemDescriptionTableRowCount(result.size());
444
                currentTreeItemSelection = CatalogTree.RISKY_ITEMS;
445
                currentlyShowing.setText(LEGEND + "Risky Items");
1992 ankur.sing 446
            }
447
        });
448
    }
3850 chandransh 449
 
3872 chandransh 450
    private void loadBestDeals(final int start, final int limit) {
451
        catalogService.getBestDeals(new AsyncCallback<List<Item>>() {
1992 ankur.sing 452
            public void onFailure(Throwable caught) {
2126 ankur.sing 453
                caught.printStackTrace();
3872 chandransh 454
                Window.alert("Could not load best deals.");
1992 ankur.sing 455
            }
456
            public void onSuccess(List<Item> result) {
3872 chandransh 457
                updateAsyncItemDescriptionTable(start, result.subList(start, Math.min(start + limit, result.size())));
3850 chandransh 458
                updateItemDescriptionTableRowCount(result.size());
3872 chandransh 459
                currentlyShowing.setText(LEGEND + "Best Deals");
1992 ankur.sing 460
            }
461
        });
462
    }
3850 chandransh 463
 
464
    private void loadBestSellers(final int start, final int limit) {
1992 ankur.sing 465
        catalogService.getBestSellers(new AsyncCallback<List<Item>>() {
466
            public void onFailure(Throwable caught) {
2126 ankur.sing 467
                caught.printStackTrace();
1992 ankur.sing 468
                Window.alert("Could not load best sellers.");
469
            }
470
            public void onSuccess(List<Item> result) {
3872 chandransh 471
                updateAsyncItemDescriptionTable(start, result.subList(start, Math.min(start + limit, result.size())));
3850 chandransh 472
                updateItemDescriptionTableRowCount(result.size());
2489 ankur.sing 473
                currentlyShowing.setText(LEGEND + "Best Sellers");
1992 ankur.sing 474
            }
475
        });
476
    }
2126 ankur.sing 477
 
3872 chandransh 478
    private void loadLatestArrivals(final int start, final int limit) {
479
        catalogService.getLatestArrivals(new AsyncCallback<List<Item>>() {
3850 chandransh 480
            public void onFailure(Throwable caught) {
481
                caught.printStackTrace();
3872 chandransh 482
                Window.alert("Could not load latest arrivals.");
3850 chandransh 483
            }
484
            public void onSuccess(List<Item> result) {
3872 chandransh 485
                updateAsyncItemDescriptionTable(start, result.subList(start, Math.min(start + limit, result.size())));
3850 chandransh 486
                updateItemDescriptionTableRowCount(result.size());
3872 chandransh 487
                currentlyShowing.setText(LEGEND + "Latest Arrivals");
3850 chandransh 488
            }
489
        });
3872 chandransh 490
 
3850 chandransh 491
    }
492
 
3872 chandransh 493
    private void loadSearchItems(final int start, final int limit) {
494
        catalogService.searchItems(start, limit, searchTerms, new AsyncCallback<List<Item>>() {
495
            public void onFailure(Throwable caught) {
496
                caught.printStackTrace();
497
                Window.alert("Could not load the search results.");
498
            }
499
            public void onSuccess(List<Item> result) {
500
                updateAsyncItemDescriptionTable(start, result);
501
                currentlyShowing.setText(LEGEND + "Search results for " + searchText);
502
            }
503
        });
504
 
505
 
506
        catalogService.getSearchResultCount(searchTerms, new AsyncCallback<Integer>() {
507
 
508
            @Override
509
            public void onFailure(Throwable caught) {
510
                caught.printStackTrace();
511
                Window.alert("Could not get the count of items...");
512
            }
513
 
514
            @Override
515
            public void onSuccess(Integer count) {
516
                updateItemDescriptionTableRowCount(count);
517
            }
518
        });
519
    }
520
 
2126 ankur.sing 521
    public void setItemDetails(ItemDetails itemDetails) {
522
        this.itemDetails = itemDetails;
523
    }
2489 ankur.sing 524
 
525
    /**
526
     * This method is called when item is updated in ItemDetails.java to update 
527
     * attributes in the list also.
528
     * @param item
529
     */
530
    public void updateItem(Item item) {
3524 chandransh 531
        //TODO: Update the item in the list when its details are updated
532
//        itemDescriptionTable.setText(selectedRow, INDEX_PRODUCT_GROUP, item.getProductGroup());
533
//        itemDescriptionTable.setText(selectedRow, INDEX_BRAND, item.getBrand());
534
//        itemDescriptionTable.setText(selectedRow, INDEX_MODEL_NUMBER, item.getModelNumber());
535
//        itemDescriptionTable.setText(selectedRow, INDEX_MODEL_NAME, item.getModelName());
536
//        itemDescriptionTable.setText(selectedRow, INDEX_COLOR, item.getColor());
2489 ankur.sing 537
    }
1961 ankur.sing 538
}