| 1961 |
ankur.sing |
1 |
package in.shop2020.catalog.dashboard.client;
|
|
|
2 |
|
|
|
3 |
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
4 |
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
5 |
import com.google.gwt.user.client.ui.Anchor;
|
|
|
6 |
import com.google.gwt.user.client.ui.Composite;
|
|
|
7 |
import com.google.gwt.user.client.ui.Tree;
|
|
|
8 |
import com.google.gwt.user.client.ui.TreeItem;
|
|
|
9 |
|
|
|
10 |
/**
|
| 2427 |
ankur.sing |
11 |
* A tree containing links to display different sets of items
|
|
|
12 |
* based on item statuses and some other parameters.
|
| 1961 |
ankur.sing |
13 |
*/
|
|
|
14 |
public class CatalogTree extends Composite {
|
| 2027 |
ankur.sing |
15 |
|
|
|
16 |
public static final String ALL_ITEMS = "All Items";
|
| 2359 |
ankur.sing |
17 |
public static final String ALL_ACTIVE_ITEMS = "Active Items";
|
|
|
18 |
public static final String ALL_PHASED_OUT_ITEMS = "Phased Out Items";
|
|
|
19 |
public static final String ALL_PAUSED_ITEMS = "Paused Items";
|
|
|
20 |
public static final String IN_PROCESS_ITEMS = "In Process Items";
|
|
|
21 |
public static final String CONTENT_COMPLETE_ITEMS = "Content Complete Items";
|
| 6530 |
vikram.rag |
22 |
public static final String INACTIVE_ITEMS_WITH_INVENTORY = "Inactive Items with Inventory";
|
| 5128 |
amit.gupta |
23 |
public static final String BREAKEVEN_ITEMS = "Items below Break Even Price";
|
| 2359 |
ankur.sing |
24 |
|
|
|
25 |
public static final String RISKY_ITEMS = "Risky Items";
|
|
|
26 |
|
| 2027 |
ankur.sing |
27 |
public static final String BEST_DEALS = "Best Deals";
|
|
|
28 |
public static final String BEST_SELLERS = "Best Sellers";
|
|
|
29 |
public static final String LATEST_ARRIVALS = "Latest Arrivals";
|
| 2359 |
ankur.sing |
30 |
|
| 3872 |
chandransh |
31 |
public static final String SEARCH = "Search";
|
|
|
32 |
|
| 6530 |
vikram.rag |
33 |
public static final String INVENTORY_OUTOFSYNC_ITEM_LIST = "Inventory Out-of-Sync Items";
|
|
|
34 |
|
| 11671 |
vikram.rag |
35 |
public static final String PRIVATE_DEALS = "Private Deals";
|
|
|
36 |
|
| 1992 |
ankur.sing |
37 |
private Tree tree;
|
|
|
38 |
|
|
|
39 |
interface TreeListener {
|
| 2027 |
ankur.sing |
40 |
void onTreeItemClicked(String itemTypes);
|
| 1992 |
ankur.sing |
41 |
}
|
|
|
42 |
|
|
|
43 |
TreeListener treeListener;
|
| 1961 |
ankur.sing |
44 |
|
| 1992 |
ankur.sing |
45 |
public CatalogTree() {
|
|
|
46 |
tree = new Tree();
|
|
|
47 |
TreeItem root = new TreeItem("Catalog");
|
| 5128 |
amit.gupta |
48 |
TreeItem report = new TreeItem("Reports");
|
| 1992 |
ankur.sing |
49 |
tree.addItem(root);
|
| 5128 |
amit.gupta |
50 |
tree.addItem(report);
|
|
|
51 |
|
| 1961 |
ankur.sing |
52 |
|
| 2027 |
ankur.sing |
53 |
addItem(root, ALL_ITEMS);
|
| 2208 |
ankur.sing |
54 |
addItem(root, ALL_ACTIVE_ITEMS);
|
|
|
55 |
addItem(root, ALL_PHASED_OUT_ITEMS);
|
|
|
56 |
addItem(root, ALL_PAUSED_ITEMS);
|
| 2359 |
ankur.sing |
57 |
addItem(root, IN_PROCESS_ITEMS);
|
|
|
58 |
addItem(root, CONTENT_COMPLETE_ITEMS);
|
|
|
59 |
|
|
|
60 |
addItem(root, RISKY_ITEMS);
|
|
|
61 |
|
| 2027 |
ankur.sing |
62 |
addItem(root, BEST_DEALS);
|
|
|
63 |
addItem(root, BEST_SELLERS);
|
|
|
64 |
addItem(root, LATEST_ARRIVALS);
|
| 2208 |
ankur.sing |
65 |
|
| 3872 |
chandransh |
66 |
addItem(root, SEARCH);
|
| 6530 |
vikram.rag |
67 |
addItem(root,INVENTORY_OUTOFSYNC_ITEM_LIST);
|
| 5128 |
amit.gupta |
68 |
|
| 11671 |
vikram.rag |
69 |
addItem(root,PRIVATE_DEALS);
|
|
|
70 |
|
| 5128 |
amit.gupta |
71 |
addItem(report, INACTIVE_ITEMS_WITH_INVENTORY);
|
|
|
72 |
addItem(report, BREAKEVEN_ITEMS);
|
| 1961 |
ankur.sing |
73 |
|
| 1992 |
ankur.sing |
74 |
root.setState(true);
|
|
|
75 |
initWidget(tree);
|
|
|
76 |
}
|
| 1961 |
ankur.sing |
77 |
|
| 2027 |
ankur.sing |
78 |
private void addItem(TreeItem root, final String title) {
|
| 1992 |
ankur.sing |
79 |
Anchor item = new Anchor(title);
|
|
|
80 |
root.addItem(item);
|
|
|
81 |
item.addClickHandler(new ClickHandler() {
|
|
|
82 |
@Override
|
|
|
83 |
public void onClick(ClickEvent event) {
|
| 2027 |
ankur.sing |
84 |
treeListener.onTreeItemClicked(title);
|
| 1992 |
ankur.sing |
85 |
}
|
|
|
86 |
});
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
public void setTreeListener(TreeListener treeListener) {
|
|
|
90 |
this.treeListener = treeListener;
|
|
|
91 |
}
|
| 1961 |
ankur.sing |
92 |
}
|