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