Subversion Repositories SmartDukaan

Rev

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

Rev 3524 Rev 3850
Line 1... Line 1...
1
package in.shop2020.catalog.dashboard.client;
1
package in.shop2020.catalog.dashboard.client;
2
 
2
 
3
import in.shop2020.catalog.dashboard.shared.Item;
3
import in.shop2020.catalog.dashboard.shared.Item;
-
 
4
import in.shop2020.catalog.dashboard.shared.ItemStatus;
4
 
5
 
5
import java.util.List;
6
import java.util.List;
6
 
7
 
7
import com.google.gwt.core.client.GWT;
8
import com.google.gwt.core.client.GWT;
8
import com.google.gwt.dom.client.Style.Unit;
9
import com.google.gwt.dom.client.Style.Unit;
Line 15... Line 16...
15
import com.google.gwt.user.client.Window;
16
import com.google.gwt.user.client.Window;
16
import com.google.gwt.user.client.rpc.AsyncCallback;
17
import com.google.gwt.user.client.rpc.AsyncCallback;
17
import com.google.gwt.user.client.ui.Label;
18
import com.google.gwt.user.client.ui.Label;
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.Widget;
20
import com.google.gwt.user.client.ui.Widget;
-
 
21
import com.google.gwt.view.client.AsyncDataProvider;
-
 
22
import com.google.gwt.view.client.HasData;
20
import com.google.gwt.view.client.ListDataProvider;
23
import com.google.gwt.view.client.ListDataProvider;
-
 
24
import com.google.gwt.view.client.Range;
21
import com.google.gwt.view.client.SelectionChangeEvent;
25
import com.google.gwt.view.client.SelectionChangeEvent;
22
import com.google.gwt.view.client.SingleSelectionModel;
26
import com.google.gwt.view.client.SingleSelectionModel;
23
 
27
 
24
/**
28
/**
25
 * List of items. List contains item Id, product group, brand, model number, model name, color and category
29
 * List of items. List contains item Id, product group, brand, model number, model name, color and category
Line 43... Line 47...
43
    // Create paging controls.
47
    // Create paging controls.
44
    @UiField SimplePager pager = new SimplePager();
48
    @UiField SimplePager pager = new SimplePager();
45
 
49
 
46
    @UiField SelectionStyle selectionStyle;
50
    @UiField SelectionStyle selectionStyle;
47
    @UiField Label currentlyShowing;
51
    @UiField Label currentlyShowing;
48
    private int selectedRow = -1;
-
 
49
    
52
    
50
    private ItemDetails itemDetails;
53
    private ItemDetails itemDetails;
51
    
54
    
-
 
55
    private String currentTreeItemSelection = null;
-
 
56
    
-
 
57
    private TextColumn<Item> idColumn = new TextColumn<Item>() {
-
 
58
        @Override
-
 
59
        public String getValue(Item item) {
-
 
60
            return item.getId() + "";
-
 
61
        }
-
 
62
    };
-
 
63
    
-
 
64
    private TextColumn<Item> pgColumn = new TextColumn<Item>() {
-
 
65
        @Override
-
 
66
        public String getValue(Item item) {
-
 
67
            return item.getProductGroup();
-
 
68
        }
-
 
69
    };
-
 
70
    
-
 
71
    private TextColumn<Item> brandColumn = new TextColumn<Item>(){
-
 
72
        @Override
-
 
73
        public String getValue(Item item) {
-
 
74
            return item.getBrand();
-
 
75
        }
-
 
76
    };
-
 
77
    
-
 
78
    private TextColumn<Item> modelNumberColumn = new TextColumn<Item>(){
-
 
79
        @Override
-
 
80
        public String getValue(Item item) {
-
 
81
            return item.getModelNumber();
-
 
82
        }
-
 
83
    };
-
 
84
    
-
 
85
    private TextColumn<Item> modelNameColumn = new TextColumn<Item>(){
-
 
86
        @Override
-
 
87
        public String getValue(Item item) {
-
 
88
            return item.getModelName();
-
 
89
        }
-
 
90
    };
-
 
91
    
-
 
92
    private TextColumn<Item> colorColumn = new TextColumn<Item>(){
-
 
93
        @Override
-
 
94
        public String getValue(Item item) {
-
 
95
            return item.getColor();
-
 
96
        }
-
 
97
    };
-
 
98
    
-
 
99
    private TextColumn<Item> categoryColumn = new TextColumn<Item>(){
-
 
100
        @Override
-
 
101
        public String getValue(Item item) {
-
 
102
            return item.getContentCategory()+"";
-
 
103
        }
-
 
104
    };
-
 
105
    
52
    // Create a data provider.
106
    // Create a data provider.
53
    ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
107
    ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
54
    
108
    
-
 
109
    AsyncDataProvider<Item> asyncDataProvider = new AsyncDataProvider<Item>() {
-
 
110
        
-
 
111
        @Override
-
 
112
        protected void onRangeChanged(HasData<Item> display) {
-
 
113
            Range range = display.getVisibleRange();
-
 
114
            int start = range.getStart();
-
 
115
            int limit = range.getLength();
-
 
116
            if(currentTreeItemSelection == null)
-
 
117
                currentTreeItemSelection = CatalogTree.RISKY_ITEMS;
-
 
118
            if(currentTreeItemSelection.equals(CatalogTree.ALL_ITEMS))
-
 
119
                loadAllItems(start, limit);
-
 
120
            else if(currentTreeItemSelection.equals(CatalogTree.ALL_ACTIVE_ITEMS))
-
 
121
                loadAllActiveItems(start, limit);
-
 
122
            else if(currentTreeItemSelection.equals(CatalogTree.ALL_PAUSED_ITEMS))
-
 
123
                loadAllPausedItems(start, limit);
-
 
124
            else if(currentTreeItemSelection.equals(CatalogTree.ALL_PHASED_OUT_ITEMS))
-
 
125
                loadAllPhasedOutItems(start, limit);
-
 
126
            else if(currentTreeItemSelection.equals(CatalogTree.IN_PROCESS_ITEMS))
-
 
127
                loadAllInProcessItems(start, limit);
-
 
128
            else if(currentTreeItemSelection.equals(CatalogTree.CONTENT_COMPLETE_ITEMS))
-
 
129
                loadAllContentCompleteItems(start, limit);
-
 
130
            else if(currentTreeItemSelection.equals(CatalogTree.BEST_DEALS))
-
 
131
                loadBestDeals(start, limit);
-
 
132
            else if(currentTreeItemSelection.equals(CatalogTree.BEST_SELLERS))
-
 
133
                loadBestSellers(start, limit);
-
 
134
            else if(currentTreeItemSelection.equals(CatalogTree.LATEST_ARRIVALS))
-
 
135
                loadLatestArrivals(start, limit);
-
 
136
            else if(currentTreeItemSelection.equals(CatalogTree.RISKY_ITEMS))
-
 
137
                loadAllRiskyItems(start, limit);
-
 
138
        }
-
 
139
    };
-
 
140
    
55
    public ItemList() {
141
    public ItemList() {
56
        initWidget(uiBinder.createAndBindUi(this));
142
        initWidget(uiBinder.createAndBindUi(this));
57
        initItemList();
143
        initItemList();
58
    }
144
    }
59
    
-
 
60
    private void initItemList() {
-
 
61
        TextColumn<Item> idColumn = new TextColumn<Item>() {
-
 
62
            @Override
-
 
63
            public String getValue(Item item) {
-
 
64
                return item.getId() + "";
-
 
65
            }
-
 
66
        };
-
 
67
        
-
 
68
        TextColumn<Item> pgColumn = new TextColumn<Item>() {
-
 
69
            @Override
-
 
70
            public String getValue(Item item) {
-
 
71
                return item.getProductGroup();
-
 
72
            }
-
 
73
        };
-
 
74
        
-
 
75
        TextColumn<Item> brandColumn = new TextColumn<Item>(){
-
 
76
            @Override
-
 
77
            public String getValue(Item item) {
-
 
78
                return item.getBrand();
-
 
79
            }
-
 
80
        };
-
 
81
        
-
 
82
        TextColumn<Item> modelNumberColumn = new TextColumn<Item>(){
-
 
83
            @Override
-
 
84
            public String getValue(Item item) {
-
 
85
                return item.getModelNumber();
-
 
86
            }
-
 
87
        };
-
 
88
        
-
 
89
        TextColumn<Item> modelNameColumn = new TextColumn<Item>(){
-
 
90
            @Override
-
 
91
            public String getValue(Item item) {
-
 
92
                return item.getModelName();
-
 
93
            }
-
 
94
        };
-
 
95
        
-
 
96
        TextColumn<Item> colorColumn = new TextColumn<Item>(){
-
 
97
            @Override
-
 
98
            public String getValue(Item item) {
-
 
99
                return item.getColor();
-
 
100
            }
-
 
101
        };
-
 
102
        
-
 
103
        TextColumn<Item> categoryColumn = new TextColumn<Item>(){
-
 
104
            @Override
-
 
105
            public String getValue(Item item) {
-
 
106
                return item.getContentCategory()+"";
-
 
107
            }
-
 
108
        };
-
 
109
 
145
 
-
 
146
    private void initItemList() {
110
        // Add the columns.        
147
        // Add the columns.        
111
        itemDescriptionTable.addColumn(idColumn, "Item Id");
148
        itemDescriptionTable.addColumn(idColumn, "Item Id");
112
        itemDescriptionTable.addColumn(pgColumn, "Product Group");
149
        itemDescriptionTable.addColumn(pgColumn, "Product Group");
113
        itemDescriptionTable.addColumn(brandColumn, "Brand");
150
        itemDescriptionTable.addColumn(brandColumn, "Brand");
114
        itemDescriptionTable.addColumn(modelNumberColumn, "Model Number");
151
        itemDescriptionTable.addColumn(modelNumberColumn, "Model Number");
Line 125... Line 162...
125
        itemDescriptionTable.setColumnWidth(modelNameColumn, 200.0, Unit.PX);
162
        itemDescriptionTable.setColumnWidth(modelNameColumn, 200.0, Unit.PX);
126
        itemDescriptionTable.setColumnWidth(colorColumn, 128.0, Unit.PX);
163
        itemDescriptionTable.setColumnWidth(colorColumn, 128.0, Unit.PX);
127
        itemDescriptionTable.setColumnWidth(categoryColumn, 220.0, Unit.PX);
164
        itemDescriptionTable.setColumnWidth(categoryColumn, 220.0, Unit.PX);
128
        
165
        
129
        // Connect the table to the data provider.
166
        // Connect the table to the data provider.
130
        dataProvider.addDataDisplay(itemDescriptionTable);
167
        //dataProvider.addDataDisplay(itemDescriptionTable);
-
 
168
        asyncDataProvider.addDataDisplay(itemDescriptionTable);
131
 
169
 
132
        //Add paging support
170
        //Add paging support
133
        pager.setDisplay(itemDescriptionTable);
171
        pager.setDisplay(itemDescriptionTable);
134
        
172
        
135
        // Add a selection model to handle item selection.
173
        // Add a selection model to handle item selection.
Line 152... Line 190...
152
                    }
190
                    }
153
                });
191
                });
154
            }
192
            }
155
        });
193
        });
156
 
194
 
157
 
-
 
158
        loadAllRiskyItems();
195
        loadAllRiskyItems();
159
    }
196
    }
160
    
197
    
161
    private void updateItemDescriptionTable(List<Item> items){
198
    public void loadAllItems() {
162
        // Add the data to the data provider, which automatically pushes it to the
-
 
163
        // widget.
-
 
164
        List<Item> list = dataProvider.getList();
199
        currentTreeItemSelection = CatalogTree.ALL_ITEMS;
165
        list.clear();
-
 
166
        list.addAll(items);
-
 
167
        
-
 
168
        pager.firstPage();
200
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
169
    }
201
    }
170
    
202
    
171
    /**
-
 
172
     * On click of an item in the list, a fresh call is made to the service to fetch item details, vendor prices
-
 
173
     * and vendor item keys. The item object is then passed to ItemDetails to set the values in UI fields 
-
 
174
     * @param event
-
 
175
     */
-
 
176
//    @UiHandler("itemDescriptionTable")
-
 
177
//    void onClick(ClickEvent event) {
-
 
178
//
-
 
179
//        Cell cell = itemDescriptionTable.getCellForEvent(event);
-
 
180
//        int newRowIndex = cell.getRowIndex();
-
 
181
//        selectRow(newRowIndex);
-
 
182
//        String itemId = itemDescriptionTable.getText(newRowIndex, INDEX_ID);
-
 
183
//        
-
 
184
//        catalogService.getItem(Long.parseLong(itemId), new AsyncCallback<Item>() {
-
 
185
//            @Override
-
 
186
//            public void onSuccess(Item result) {
-
 
187
//                itemDetails.setItemDetails(result);
-
 
188
//            }
-
 
189
//            @Override
-
 
190
//            public void onFailure(Throwable caught) {
-
 
191
//                caught.printStackTrace();
-
 
192
//                Window.alert("Unable to fetch item details.");
-
 
193
//            }
-
 
194
//        });
-
 
195
//    }
-
 
196
 
-
 
197
    private void selectRow(int row) {
203
    public void loadAllActiveItems() {
198
        //TODO: Change the style of the selected row
-
 
199
//        String style = selectionStyle.selectedRow();
204
        currentTreeItemSelection = CatalogTree.ALL_ACTIVE_ITEMS;
200
//        if(selectedRow != -1){
-
 
201
//            itemDescriptionTable.getRowElement(row)owFormatter().removeStyleName(selectedRow, style);
205
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
202
//        }
-
 
203
//            
-
 
204
//        itemDescriptionTable.getRowFormatter().addStyleName(row, style);
-
 
205
//        selectedRow = row;
-
 
206
    }
206
    }
207
    
-
 
208
    /* For testing
-
 
209
      private HashMap map;
-
 
210
      private List<Item> items;
-
 
211
      private void loadDummyItems() {
-
 
212
        Item i = new Item(1, "Handset", "Spice", "mi310", "phone", "White", "Business Phone",1, "comments", 1, 1, 
-
 
213
                "", 3000.50, 3000.00, 3000, 3000, 12, 12345, 12345, 12345, 12345, "ACTIVE", 1, "This item is active",
-
 
214
                null, "best", 2990, 1, true, true, null, null, null);
-
 
215
        List<Item> items = new ArrayList<Item>();
-
 
216
        items.add(i);
-
 
217
        this.items = items;
-
 
218
        //itemsMap.put(i.getId(), i);
-
 
219
    }*/
-
 
220
    
207
    
-
 
208
    public void loadAllPhasedOutItems() {
-
 
209
        currentTreeItemSelection = CatalogTree.ALL_PHASED_OUT_ITEMS;
-
 
210
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
211
    }
221
    
212
    
-
 
213
    public void loadAllPausedItems() {
-
 
214
        currentTreeItemSelection = CatalogTree.ALL_PAUSED_ITEMS;
-
 
215
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
216
    }
-
 
217
    
-
 
218
    public void loadAllInProcessItems() {
-
 
219
        currentTreeItemSelection = CatalogTree.IN_PROCESS_ITEMS;
-
 
220
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
221
    }
-
 
222
    
-
 
223
    public void loadAllContentCompleteItems(){
-
 
224
        currentTreeItemSelection = CatalogTree.CONTENT_COMPLETE_ITEMS;
-
 
225
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
226
    }
-
 
227
    
222
    public void loadAllItems() {
228
    public void loadAllRiskyItems() {
-
 
229
        currentTreeItemSelection = CatalogTree.RISKY_ITEMS;
-
 
230
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
231
    }
-
 
232
    
-
 
233
    public void loadBestDeals() {
-
 
234
        currentTreeItemSelection = CatalogTree.BEST_DEALS;
-
 
235
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
236
    }
-
 
237
    
-
 
238
    public void loadLatestArrivals() {
-
 
239
        currentTreeItemSelection = CatalogTree.LATEST_ARRIVALS;
-
 
240
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
241
    }
-
 
242
    
-
 
243
    public void loadBestSellers() {
-
 
244
        currentTreeItemSelection = CatalogTree.BEST_SELLERS;
-
 
245
        itemDescriptionTable.setVisibleRangeAndClearData(new Range(0, pager.getPageSize()), true);
-
 
246
    }
-
 
247
    
-
 
248
    private void updateItemDescriptionTableRowCount(Integer count){
-
 
249
        asyncDataProvider.updateRowCount(count, true);
-
 
250
    }
-
 
251
    
-
 
252
    private void updateAsyncItemDescriptionTable(int start, List<Item> items){
-
 
253
        // Add the data to the data provider, which automatically pushes it to the
-
 
254
        // widget.
-
 
255
        asyncDataProvider.updateRowData(start, items);
-
 
256
    }
-
 
257
    
-
 
258
    private void loadAllItems(final int offset, final int limit) {
223
        catalogService.getAllItems(new AsyncCallback<List<Item>>() {
259
        catalogService.getAllItems(offset, limit, new AsyncCallback<List<Item>>() {
224
            public void onFailure(Throwable caught) {
260
            public void onFailure(Throwable caught) {
225
                caught.printStackTrace();
261
                caught.printStackTrace();
226
                Window.alert("Could not get all items...");
262
                Window.alert("Could not get all items...");
227
            }
263
            }
228
            public void onSuccess(List<Item> result) {
264
            public void onSuccess(List<Item> result) {
229
                updateItemDescriptionTable(result);
265
                updateAsyncItemDescriptionTable(offset, result);
230
                currentlyShowing.setText(LEGEND + "All Items"); 
266
                currentlyShowing.setText(LEGEND + "All Items");
-
 
267
            }
-
 
268
        });
-
 
269
        
-
 
270
        catalogService.getItemCountByStatus(false, ItemStatus.ACTIVE, new AsyncCallback<Integer>() {
-
 
271
 
-
 
272
            @Override
-
 
273
            public void onFailure(Throwable caught) {
-
 
274
                caught.printStackTrace();
-
 
275
                Window.alert("Could not get the count of items...");
-
 
276
            }
-
 
277
 
-
 
278
            @Override
-
 
279
            public void onSuccess(Integer count) {
-
 
280
                updateItemDescriptionTableRowCount(count);
231
            }
281
            }
232
        });
282
        });
233
    }
283
    }
234
    
284
    
235
    public void loadAllActiveItems() {
285
    private void loadAllActiveItems(final int offset, final int limit) {
236
        catalogService.getAllActiveItems(new AsyncCallback<List<Item>>() {
286
        catalogService.getAllActiveItems(offset, limit, new AsyncCallback<List<Item>>() {
237
            public void onFailure(Throwable caught) {
287
            public void onFailure(Throwable caught) {
238
                caught.printStackTrace();
288
                caught.printStackTrace();
239
                Window.alert("Could not get all active items...");
289
                Window.alert("Could not get all active items...");
240
            }
290
            }
241
            public void onSuccess(List<Item> result) {
291
            public void onSuccess(List<Item> result) {
242
                updateItemDescriptionTable(result);
292
                updateAsyncItemDescriptionTable(offset, result);
243
                currentlyShowing.setText(LEGEND + "Active Items");
293
                currentlyShowing.setText(LEGEND + "Active Items");
244
            }
294
            }
245
        });
295
        });
-
 
296
        
-
 
297
        catalogService.getItemCountByStatus(true, ItemStatus.ACTIVE, new AsyncCallback<Integer>() {
-
 
298
 
-
 
299
            @Override
-
 
300
            public void onFailure(Throwable caught) {
-
 
301
                caught.printStackTrace();
-
 
302
                Window.alert("Could not get the count of items...");
-
 
303
            }
-
 
304
 
-
 
305
            @Override
-
 
306
            public void onSuccess(Integer count) {
-
 
307
                updateItemDescriptionTableRowCount(count);
-
 
308
            }
-
 
309
        });
246
    }
310
    }
247
    
311
    
248
    public void loadAllPhasedOutItems() {
312
    private void loadAllPhasedOutItems(final int offset, int limit){
249
        catalogService.getAllPhasedOutItems(new AsyncCallback<List<Item>>() {
313
        catalogService.getAllPhasedOutItems(offset, limit, new AsyncCallback<List<Item>>() {
250
            public void onFailure(Throwable caught) {
314
            public void onFailure(Throwable caught) {
251
                caught.printStackTrace();
315
                caught.printStackTrace();
252
                Window.alert("Could not load phased out items...");
316
                Window.alert("Could not load phased out items...");
253
            }
317
            }
254
            public void onSuccess(List<Item> result) {
318
            public void onSuccess(List<Item> result) {
255
                updateItemDescriptionTable(result);
319
                updateAsyncItemDescriptionTable(offset, result);
256
                currentlyShowing.setText(LEGEND + "Phased Out Items");
320
                currentlyShowing.setText(LEGEND + "Phased Out Items");
257
            }
321
            }
258
        });
322
        });
-
 
323
        
-
 
324
        catalogService.getItemCountByStatus(true, ItemStatus.PHASED_OUT, new AsyncCallback<Integer>() {
-
 
325
 
-
 
326
            @Override
-
 
327
            public void onFailure(Throwable caught) {
-
 
328
                caught.printStackTrace();
-
 
329
                Window.alert("Could not get the count of items...");
-
 
330
            }
-
 
331
 
-
 
332
            @Override
-
 
333
            public void onSuccess(Integer count) {
-
 
334
                updateItemDescriptionTableRowCount(count);
-
 
335
            }
-
 
336
        });
259
    }
337
    }
260
    
338
    
261
    public void loadAllPausedItems() {
339
    private void loadAllPausedItems(final int offset, int limit) {
262
        catalogService.getAllPausedItems(new AsyncCallback<List<Item>>() {
340
        catalogService.getAllPausedItems(offset, limit, new AsyncCallback<List<Item>>() {
263
            public void onFailure(Throwable caught) {
341
            public void onFailure(Throwable caught) {
264
                caught.printStackTrace();
342
                caught.printStackTrace();
265
                Window.alert("Could not load paused items...");
343
                Window.alert("Could not load paused items...");
266
            }
344
            }
267
            public void onSuccess(List<Item> result) {
345
            public void onSuccess(List<Item> result) {
268
                updateItemDescriptionTable(result);
346
                updateAsyncItemDescriptionTable(offset, result);
269
                currentlyShowing.setText(LEGEND + "Paused Items");
347
                currentlyShowing.setText(LEGEND + "Paused Items");
270
            }
348
            }
271
        });
349
        });
-
 
350
        
-
 
351
        catalogService.getItemCountByStatus(true, ItemStatus.PAUSED, new AsyncCallback<Integer>() {
-
 
352
 
-
 
353
            @Override
-
 
354
            public void onFailure(Throwable caught) {
-
 
355
                caught.printStackTrace();
-
 
356
                Window.alert("Could not get the count of items...");
-
 
357
            }
-
 
358
 
-
 
359
            @Override
-
 
360
            public void onSuccess(Integer count) {
-
 
361
                updateItemDescriptionTableRowCount(count);
-
 
362
            }
-
 
363
        });
272
    }
364
    }
273
    
365
    
274
    public void loadAllInProcessItems() {
366
    private void loadAllInProcessItems(final int offset, int limit) {
275
        catalogService.getAllInProcessItems(new AsyncCallback<List<Item>>() {
367
        catalogService.getAllInProcessItems(offset, limit, new AsyncCallback<List<Item>>() {
276
            public void onFailure(Throwable caught) {
368
            public void onFailure(Throwable caught) {
277
                caught.printStackTrace();
369
                caught.printStackTrace();
278
                Window.alert("Could not load IN_PROCESS items...");
370
                Window.alert("Could not load IN_PROCESS items...");
279
            }
371
            }
280
            public void onSuccess(List<Item> result) {
372
            public void onSuccess(List<Item> result) {
281
                updateItemDescriptionTable(result);
373
                updateAsyncItemDescriptionTable(offset, result);
282
                currentlyShowing.setText(LEGEND + "In Process Items");
374
                currentlyShowing.setText(LEGEND + "In Process Items");
283
            }
375
            }
284
        });
376
        });
-
 
377
        
-
 
378
        catalogService.getItemCountByStatus(true, ItemStatus.IN_PROCESS, new AsyncCallback<Integer>() {
-
 
379
 
-
 
380
            @Override
-
 
381
            public void onFailure(Throwable caught) {
-
 
382
                caught.printStackTrace();
-
 
383
                Window.alert("Could not get the count of items...");
-
 
384
            }
-
 
385
 
-
 
386
            @Override
-
 
387
            public void onSuccess(Integer count) {
-
 
388
                updateItemDescriptionTableRowCount(count);
-
 
389
            }
-
 
390
        });
285
    }
391
    }
286
    
392
    
287
    public void loadAllContentCompleteItems() {
393
    private void loadAllContentCompleteItems(final int offset, int limit) {
288
        catalogService.getAllContentCompleteItems(new AsyncCallback<List<Item>>() {
394
        catalogService.getAllContentCompleteItems(offset, limit, new AsyncCallback<List<Item>>() {
289
            public void onFailure(Throwable caught) {
395
            public void onFailure(Throwable caught) {
290
                caught.printStackTrace();
396
                caught.printStackTrace();
291
                Window.alert("Could not load CONTENT_COMPLETE items...");
397
                Window.alert("Could not load CONTENT_COMPLETE items...");
292
            }
398
            }
293
            public void onSuccess(List<Item> result) {
399
            public void onSuccess(List<Item> result) {
294
                updateItemDescriptionTable(result);
400
                updateAsyncItemDescriptionTable(offset, result);
295
                currentlyShowing.setText(LEGEND + "Content Complete Items");
401
                currentlyShowing.setText(LEGEND + "Content Complete Items");
296
            }
402
            }
297
        });
403
        });
298
    }
404
        
-
 
405
        catalogService.getItemCountByStatus(true, ItemStatus.CONTENT_COMPLETE, new AsyncCallback<Integer>() {
299
    
406
 
300
    public void loadAllRiskyItems() {
407
            @Override
301
        catalogService.getRiskyItems(new AsyncCallback<List<Item>>() {
-
 
302
            public void onFailure(Throwable caught) {
408
            public void onFailure(Throwable caught) {
303
                caught.printStackTrace();
409
                caught.printStackTrace();
304
                Window.alert("Could not load RISKY items...");
410
                Window.alert("Could not get the count of items...");
305
            }
411
            }
-
 
412
 
-
 
413
            @Override
306
            public void onSuccess(List<Item> result) {
414
            public void onSuccess(Integer count) {
307
                updateItemDescriptionTable(result);
415
                updateItemDescriptionTableRowCount(count);
308
                currentlyShowing.setText(LEGEND + "Risky Items");
-
 
309
            }
416
            }
310
        });
417
        });
311
    }
418
    }
312
    
419
    
313
    public void loadBestDeals() {
420
    private void loadAllRiskyItems(final int start, final int limit) {
314
        catalogService.getBestDeals(new AsyncCallback<List<Item>>() {
421
        catalogService.getRiskyItems(new AsyncCallback<List<Item>>() {
315
            public void onFailure(Throwable caught) {
422
            public void onFailure(Throwable caught) {
316
                caught.printStackTrace();
423
                caught.printStackTrace();
317
                Window.alert("Could not load best deals.");
424
                Window.alert("Could not load RISKY items...");
318
            }
425
            }
319
            public void onSuccess(List<Item> result) {
426
            public void onSuccess(List<Item> result) {
-
 
427
                updateAsyncItemDescriptionTable(0, result.subList(start, Math.min(start + limit, result.size())));
320
                updateItemDescriptionTable(result);
428
                updateItemDescriptionTableRowCount(result.size());
-
 
429
                currentTreeItemSelection = CatalogTree.RISKY_ITEMS;
321
                currentlyShowing.setText(LEGEND + "Best Deals");
430
                currentlyShowing.setText(LEGEND + "Risky Items");
322
            }
431
            }
323
        });
432
        });
324
    }
433
    }
325
    
434
 
326
    public void loadLatestArrivals() {
435
    private void loadLatestArrivals(final int start, final int limit) {
327
        catalogService.getLatestArrivals(new AsyncCallback<List<Item>>() {
436
        catalogService.getLatestArrivals(new AsyncCallback<List<Item>>() {
328
            public void onFailure(Throwable caught) {
437
            public void onFailure(Throwable caught) {
329
                caught.printStackTrace();
438
                caught.printStackTrace();
330
                Window.alert("Could not load latest arrivals.");
439
                Window.alert("Could not load latest arrivals.");
331
            }
440
            }
332
            public void onSuccess(List<Item> result) {
441
            public void onSuccess(List<Item> result) {
-
 
442
                updateAsyncItemDescriptionTable(0, result.subList(start, Math.min(start + limit, result.size())));
333
                updateItemDescriptionTable(result);
443
                updateItemDescriptionTableRowCount(result.size());
334
                currentlyShowing.setText(LEGEND + "Latest Arrivals");
444
                currentlyShowing.setText(LEGEND + "Latest Arrivals");
335
            }
445
            }
336
        });
446
        });
-
 
447
        
337
    }
448
    }
338
    
449
 
339
    public void loadBestSellers() {
450
    private void loadBestSellers(final int start, final int limit) {
340
        catalogService.getBestSellers(new AsyncCallback<List<Item>>() {
451
        catalogService.getBestSellers(new AsyncCallback<List<Item>>() {
341
            public void onFailure(Throwable caught) {
452
            public void onFailure(Throwable caught) {
342
                caught.printStackTrace();
453
                caught.printStackTrace();
343
                Window.alert("Could not load best sellers.");
454
                Window.alert("Could not load best sellers.");
344
            }
455
            }
345
            public void onSuccess(List<Item> result) {
456
            public void onSuccess(List<Item> result) {
-
 
457
                updateAsyncItemDescriptionTable(0, result.subList(start, Math.min(start + limit, result.size())));
346
                updateItemDescriptionTable(result);
458
                updateItemDescriptionTableRowCount(result.size());
347
                currentlyShowing.setText(LEGEND + "Best Sellers");
459
                currentlyShowing.setText(LEGEND + "Best Sellers");
348
            }
460
            }
349
        });
461
        });
350
    }
462
    }
351
 
463
 
-
 
464
    private void loadBestDeals(final int start, final int limit) {
-
 
465
        catalogService.getBestDeals(new AsyncCallback<List<Item>>() {
-
 
466
            public void onFailure(Throwable caught) {
-
 
467
                caught.printStackTrace();
-
 
468
                Window.alert("Could not load best deals.");
-
 
469
            }
-
 
470
            public void onSuccess(List<Item> result) {
-
 
471
                updateAsyncItemDescriptionTable(0, result.subList(start, Math.min(start + limit, result.size())));
-
 
472
                updateItemDescriptionTableRowCount(result.size());
-
 
473
                currentlyShowing.setText(LEGEND + "Best Deals");
-
 
474
            }
-
 
475
        });
-
 
476
    }
-
 
477
 
352
    public void setItemDetails(ItemDetails itemDetails) {
478
    public void setItemDetails(ItemDetails itemDetails) {
353
        this.itemDetails = itemDetails;
479
        this.itemDetails = itemDetails;
354
    }
480
    }
355
    
481
    
356
    /**
482
    /**