| 167 |
ashish |
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.hotspot.dashbaord.client.inbox.InboxPresenter.Display;
|
|
|
4 |
|
|
|
5 |
import com.google.gwt.dom.client.Style.Unit;
|
|
|
6 |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
|
|
7 |
import com.google.gwt.user.client.ui.Anchor;
|
|
|
8 |
import com.google.gwt.user.client.ui.Composite;
|
| 306 |
ashish |
9 |
import com.google.gwt.user.client.ui.DockLayoutPanel;
|
| 167 |
ashish |
10 |
import com.google.gwt.user.client.ui.HTML;
|
|
|
11 |
import com.google.gwt.user.client.ui.Image;
|
|
|
12 |
import com.google.gwt.user.client.ui.SplitLayoutPanel;
|
|
|
13 |
import com.google.gwt.user.client.ui.StackLayoutPanel;
|
| 306 |
ashish |
14 |
import com.google.gwt.user.client.ui.Tree;
|
|
|
15 |
import com.google.gwt.user.client.ui.TreeItem;
|
| 167 |
ashish |
16 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
17 |
|
|
|
18 |
public class InboxWidget extends Composite implements Display{
|
|
|
19 |
|
|
|
20 |
private final HTML commandList = new HTML("Navigation");
|
|
|
21 |
private final HTML messageList = new HTML("Messages are");
|
|
|
22 |
private final HTML messageDetails = new HTML("Message Details");
|
| 306 |
ashish |
23 |
private DockLayoutPanel dpanel = new DockLayoutPanel(Unit.EM);
|
| 167 |
ashish |
24 |
private SplitLayoutPanel sp = new SplitLayoutPanel();
|
| 534 |
chandransh |
25 |
|
|
|
26 |
private Tree orderTree = new Tree();
|
|
|
27 |
private final Anchor allOrders = new Anchor("All");
|
| 487 |
rajveer |
28 |
private final Anchor newOrders = new Anchor("Pending");
|
| 534 |
chandransh |
29 |
private final Anchor acceptedOrders = new Anchor("Accepted");
|
| 306 |
ashish |
30 |
private final Anchor billedOrders = new Anchor("Billed");
|
|
|
31 |
private final Anchor shippedOrders = new Anchor("Shipped");
|
| 530 |
chandransh |
32 |
private final Anchor rejectedOrders = new Anchor("Rejected");
|
| 306 |
ashish |
33 |
private final Anchor notAvailable = new Anchor("No Stock");
|
| 534 |
chandransh |
34 |
|
|
|
35 |
private Tree catalogTree = new Tree();
|
|
|
36 |
private final Anchor allItems = new Anchor("All Items");
|
|
|
37 |
private final Anchor bestSellers = new Anchor("Best Sellers");
|
|
|
38 |
private final Anchor bestDeals = new Anchor("Best Deals");
|
|
|
39 |
private final Anchor latestArrivals = new Anchor("Latest Arrivals");
|
|
|
40 |
|
| 306 |
ashish |
41 |
private final Anchor alerts = new Anchor("Alerts");
|
| 167 |
ashish |
42 |
private final Image image = new Image("img/shop2020.jpg");
|
|
|
43 |
private Widget finalWidget = null;
|
|
|
44 |
private Widget northWidget = null;
|
| 306 |
ashish |
45 |
private TopPanel topPanel = new TopPanel();
|
| 534 |
chandransh |
46 |
|
| 167 |
ashish |
47 |
public InboxWidget(){
|
| 534 |
chandransh |
48 |
//Prepare the order tree
|
|
|
49 |
TreeItem orderRootItem = createOrderTree();
|
|
|
50 |
orderTree.addItem(orderRootItem);
|
|
|
51 |
orderTree.setWidth("200px");
|
|
|
52 |
orderTree.setSelectedItem(orderRootItem.getChild(1)); //FIXME: 1 is the index of the pending orders. Using numbers in code is bad practice. Fix this.
|
|
|
53 |
orderTree.ensureSelectedItemVisible();
|
|
|
54 |
|
|
|
55 |
//Prepare the catalogue tree
|
|
|
56 |
TreeItem catalogRootItem = createCatalogTree();
|
|
|
57 |
catalogTree.addItem(catalogRootItem);
|
|
|
58 |
catalogTree.setWidth("200px");
|
|
|
59 |
catalogTree.setSelectedItem(catalogRootItem.getChild(0)); //FIXME: 0 is the index of All Items. Using numbers in code is bad practice.
|
|
|
60 |
catalogTree.ensureSelectedItemVisible();
|
|
|
61 |
|
|
|
62 |
//Prepare the left panel
|
|
|
63 |
StackLayoutPanel leftPanel = new StackLayoutPanel(Unit.PX);
|
|
|
64 |
leftPanel.add(orderTree, "Orders", 25);
|
|
|
65 |
leftPanel.add(catalogTree, "Catalog", 25);
|
|
|
66 |
leftPanel.add(new HTML("<b>that</b>"), "Reports", 25);
|
|
|
67 |
|
|
|
68 |
// Prepare the lower body of dashboard with the left navigation and the
|
|
|
69 |
// display area on the right.
|
|
|
70 |
sp.addWest(leftPanel, 200);
|
|
|
71 |
sp.add(messageDetails);
|
|
|
72 |
|
|
|
73 |
//Prepare the complete body with the header
|
| 306 |
ashish |
74 |
dpanel.addNorth(topPanel, 5);
|
|
|
75 |
dpanel.add(sp);
|
| 534 |
chandransh |
76 |
|
| 167 |
ashish |
77 |
finalWidget = messageDetails;
|
| 306 |
ashish |
78 |
initWidget(dpanel);
|
| 167 |
ashish |
79 |
|
|
|
80 |
commandList.setHTML("<p> hi, how ae you doing buddy </p><ul><li>one<li>two<li>three</ul>");
|
| 306 |
ashish |
81 |
messageDetails.setText("");
|
| 167 |
ashish |
82 |
}
|
| 534 |
chandransh |
83 |
|
|
|
84 |
private TreeItem createOrderTree(){
|
| 306 |
ashish |
85 |
TreeItem root = new TreeItem("Orders");
|
|
|
86 |
root.addItem(allOrders);
|
|
|
87 |
root.addItem(newOrders);
|
|
|
88 |
root.addItem(acceptedOrders);
|
|
|
89 |
root.addItem(billedOrders);
|
|
|
90 |
root.addItem(shippedOrders);
|
|
|
91 |
root.addItem(rejectedOrders);
|
|
|
92 |
root.addItem(notAvailable);
|
|
|
93 |
root.addItem(alerts);
|
| 486 |
rajveer |
94 |
alerts.setVisible(false);
|
| 306 |
ashish |
95 |
return root;
|
|
|
96 |
}
|
|
|
97 |
|
| 534 |
chandransh |
98 |
private TreeItem createCatalogTree(){
|
|
|
99 |
TreeItem root = new TreeItem("Catalog");
|
|
|
100 |
root.addItem(allItems);
|
|
|
101 |
root.addItem(bestDeals);
|
|
|
102 |
root.addItem(bestSellers);
|
|
|
103 |
root.addItem(latestArrivals);
|
|
|
104 |
return root;
|
|
|
105 |
}
|
| 167 |
ashish |
106 |
@Override
|
|
|
107 |
public Widget asWidget() {
|
|
|
108 |
|
|
|
109 |
return this;
|
|
|
110 |
}
|
|
|
111 |
|
|
|
112 |
@Override
|
| 534 |
chandransh |
113 |
public void updateDetailsPane(Widget details) {
|
|
|
114 |
if(finalWidget != null){
|
|
|
115 |
sp.remove(finalWidget);
|
|
|
116 |
}
|
|
|
117 |
sp.add(details);
|
|
|
118 |
finalWidget = details;
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
@Override
|
|
|
122 |
public void removeDetailsPane() {
|
|
|
123 |
updateDetailsPane(messageDetails);
|
|
|
124 |
}
|
| 167 |
ashish |
125 |
|
|
|
126 |
@Override
|
|
|
127 |
public void updateOrderList(OrderList orderList) {
|
|
|
128 |
if(finalWidget != null){
|
|
|
129 |
sp.remove(finalWidget);
|
|
|
130 |
}
|
|
|
131 |
if(northWidget != null){
|
|
|
132 |
sp.remove(northWidget);
|
|
|
133 |
}
|
|
|
134 |
sp.addNorth(orderList, 200);
|
|
|
135 |
this.northWidget = orderList;
|
|
|
136 |
|
|
|
137 |
sp.add(finalWidget);
|
|
|
138 |
}
|
| 534 |
chandransh |
139 |
|
|
|
140 |
@Override
|
|
|
141 |
public void changeGreeting(String greeting) {
|
|
|
142 |
topPanel.changeGreeting(greeting);
|
|
|
143 |
}
|
|
|
144 |
|
|
|
145 |
@Override
|
|
|
146 |
public HasClickHandlers getMessageBox() {
|
|
|
147 |
return null;
|
|
|
148 |
}
|
| 167 |
ashish |
149 |
|
|
|
150 |
@Override
|
|
|
151 |
public HasClickHandlers getAcceptedOrdersAnchor() {
|
|
|
152 |
return acceptedOrders;
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
@Override
|
| 486 |
rajveer |
156 |
public HasClickHandlers getRejectedOrdersAnchor() {
|
|
|
157 |
return rejectedOrders;
|
|
|
158 |
}
|
|
|
159 |
|
|
|
160 |
@Override
|
| 167 |
ashish |
161 |
public HasClickHandlers getBilledOrdersAnchor() {
|
|
|
162 |
return billedOrders;
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
@Override
|
|
|
166 |
public HasClickHandlers getNewOrdersAnchor() {
|
|
|
167 |
return newOrders;
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
@Override
|
|
|
171 |
public HasClickHandlers getShippedOrdersAnchor() {
|
|
|
172 |
return shippedOrders;
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
@Override
|
| 306 |
ashish |
176 |
public HasClickHandlers getSignOutLink() {
|
|
|
177 |
return topPanel.getSignOutLink();
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
@Override
|
|
|
181 |
public HasClickHandlers getAllOrdersAnchor() {
|
|
|
182 |
return allOrders;
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
@Override
|
|
|
186 |
public HasClickHandlers getAlertsAnchor() {
|
|
|
187 |
return alerts;
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
@Override
|
|
|
191 |
public HasClickHandlers getNotAvailableAnchor() {
|
|
|
192 |
return notAvailable;
|
|
|
193 |
}
|
|
|
194 |
|
| 167 |
ashish |
195 |
}
|