| 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;
|
| 584 |
chandransh |
12 |
import com.google.gwt.user.client.ui.Label;
|
|
|
13 |
import com.google.gwt.user.client.ui.SimplePanel;
|
| 167 |
ashish |
14 |
import com.google.gwt.user.client.ui.SplitLayoutPanel;
|
|
|
15 |
import com.google.gwt.user.client.ui.StackLayoutPanel;
|
| 306 |
ashish |
16 |
import com.google.gwt.user.client.ui.Tree;
|
|
|
17 |
import com.google.gwt.user.client.ui.TreeItem;
|
| 167 |
ashish |
18 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
19 |
|
|
|
20 |
public class InboxWidget extends Composite implements Display{
|
|
|
21 |
|
|
|
22 |
private final HTML commandList = new HTML("Navigation");
|
|
|
23 |
private final HTML messageList = new HTML("Messages are");
|
|
|
24 |
private final HTML messageDetails = new HTML("Message Details");
|
| 306 |
ashish |
25 |
private DockLayoutPanel dpanel = new DockLayoutPanel(Unit.EM);
|
| 167 |
ashish |
26 |
private SplitLayoutPanel sp = new SplitLayoutPanel();
|
| 534 |
chandransh |
27 |
|
|
|
28 |
private Tree orderTree = new Tree();
|
|
|
29 |
private final Anchor allOrders = new Anchor("All");
|
| 487 |
rajveer |
30 |
private final Anchor newOrders = new Anchor("Pending");
|
| 534 |
chandransh |
31 |
private final Anchor acceptedOrders = new Anchor("Accepted");
|
| 306 |
ashish |
32 |
private final Anchor billedOrders = new Anchor("Billed");
|
|
|
33 |
private final Anchor shippedOrders = new Anchor("Shipped");
|
| 530 |
chandransh |
34 |
private final Anchor rejectedOrders = new Anchor("Rejected");
|
| 306 |
ashish |
35 |
private final Anchor notAvailable = new Anchor("No Stock");
|
| 1193 |
chandransh |
36 |
private final Anchor printPending = new Anchor("Print Pending");
|
| 534 |
chandransh |
37 |
|
| 597 |
chandransh |
38 |
private Label orderTreeHeader = new Label("Orders");
|
| 584 |
chandransh |
39 |
private Label catalogTreeHeader = new Label("Catalog");
|
| 760 |
chandransh |
40 |
private Label providerTreeHeader = new Label("Couriers");
|
|
|
41 |
|
| 534 |
chandransh |
42 |
private Tree catalogTree = new Tree();
|
|
|
43 |
private final Anchor allItems = new Anchor("All Items");
|
|
|
44 |
private final Anchor bestSellers = new Anchor("Best Sellers");
|
|
|
45 |
private final Anchor bestDeals = new Anchor("Best Deals");
|
|
|
46 |
private final Anchor latestArrivals = new Anchor("Latest Arrivals");
|
|
|
47 |
|
| 760 |
chandransh |
48 |
private Tree providerTree = new Tree();
|
|
|
49 |
private final Anchor allProviders = new Anchor("All Couriers");
|
|
|
50 |
|
| 306 |
ashish |
51 |
private final Anchor alerts = new Anchor("Alerts");
|
| 167 |
ashish |
52 |
private final Image image = new Image("img/shop2020.jpg");
|
|
|
53 |
private Widget finalWidget = null;
|
|
|
54 |
private Widget northWidget = null;
|
| 306 |
ashish |
55 |
private TopPanel topPanel = new TopPanel();
|
| 534 |
chandransh |
56 |
|
| 167 |
ashish |
57 |
public InboxWidget(){
|
| 534 |
chandransh |
58 |
//Prepare the order tree
|
|
|
59 |
TreeItem orderRootItem = createOrderTree();
|
|
|
60 |
orderTree.addItem(orderRootItem);
|
|
|
61 |
orderTree.setWidth("200px");
|
| 967 |
chandransh |
62 |
orderTree.setSelectedItem(orderRootItem.getChild(0)); //FIXME: 0 is the index of the pending orders. Using numbers in code is bad practice. Fix this.
|
| 534 |
chandransh |
63 |
orderTree.ensureSelectedItemVisible();
|
|
|
64 |
|
|
|
65 |
//Prepare the catalogue tree
|
|
|
66 |
TreeItem catalogRootItem = createCatalogTree();
|
|
|
67 |
catalogTree.addItem(catalogRootItem);
|
|
|
68 |
catalogTree.setWidth("200px");
|
|
|
69 |
catalogTree.setSelectedItem(catalogRootItem.getChild(0)); //FIXME: 0 is the index of All Items. Using numbers in code is bad practice.
|
|
|
70 |
catalogTree.ensureSelectedItemVisible();
|
| 760 |
chandransh |
71 |
|
|
|
72 |
TreeItem providerRootItem = createProviderTree();
|
|
|
73 |
providerTree.addItem(providerRootItem);
|
|
|
74 |
providerTree.setWidth("200px");
|
|
|
75 |
providerTree.setSelectedItem(providerRootItem.getChild(0));
|
|
|
76 |
providerTree.ensureSelectedItemVisible();
|
| 584 |
chandransh |
77 |
|
| 534 |
chandransh |
78 |
//Prepare the left panel
|
|
|
79 |
StackLayoutPanel leftPanel = new StackLayoutPanel(Unit.PX);
|
| 597 |
chandransh |
80 |
leftPanel.add(orderTree, orderTreeHeader, 25);
|
| 584 |
chandransh |
81 |
leftPanel.add(catalogTree, catalogTreeHeader, 25);
|
| 760 |
chandransh |
82 |
leftPanel.add(providerTree, providerTreeHeader, 25);
|
| 534 |
chandransh |
83 |
leftPanel.add(new HTML("<b>that</b>"), "Reports", 25);
|
|
|
84 |
|
|
|
85 |
// Prepare the lower body of dashboard with the left navigation and the
|
|
|
86 |
// display area on the right.
|
|
|
87 |
sp.addWest(leftPanel, 200);
|
|
|
88 |
sp.add(messageDetails);
|
|
|
89 |
|
|
|
90 |
//Prepare the complete body with the header
|
| 306 |
ashish |
91 |
dpanel.addNorth(topPanel, 5);
|
|
|
92 |
dpanel.add(sp);
|
| 534 |
chandransh |
93 |
|
| 167 |
ashish |
94 |
finalWidget = messageDetails;
|
| 306 |
ashish |
95 |
initWidget(dpanel);
|
| 167 |
ashish |
96 |
|
|
|
97 |
commandList.setHTML("<p> hi, how ae you doing buddy </p><ul><li>one<li>two<li>three</ul>");
|
| 306 |
ashish |
98 |
messageDetails.setText("");
|
| 167 |
ashish |
99 |
}
|
| 534 |
chandransh |
100 |
|
|
|
101 |
private TreeItem createOrderTree(){
|
| 306 |
ashish |
102 |
TreeItem root = new TreeItem("Orders");
|
| 967 |
chandransh |
103 |
//root.addItem(allOrders);
|
| 306 |
ashish |
104 |
root.addItem(newOrders);
|
|
|
105 |
root.addItem(acceptedOrders);
|
|
|
106 |
root.addItem(billedOrders);
|
|
|
107 |
root.addItem(shippedOrders);
|
|
|
108 |
root.addItem(rejectedOrders);
|
|
|
109 |
root.addItem(notAvailable);
|
|
|
110 |
root.addItem(alerts);
|
| 1193 |
chandransh |
111 |
root.addItem(printPending);
|
| 486 |
rajveer |
112 |
alerts.setVisible(false);
|
| 306 |
ashish |
113 |
return root;
|
|
|
114 |
}
|
|
|
115 |
|
| 534 |
chandransh |
116 |
private TreeItem createCatalogTree(){
|
|
|
117 |
TreeItem root = new TreeItem("Catalog");
|
|
|
118 |
root.addItem(allItems);
|
|
|
119 |
root.addItem(bestDeals);
|
|
|
120 |
root.addItem(bestSellers);
|
|
|
121 |
root.addItem(latestArrivals);
|
|
|
122 |
return root;
|
|
|
123 |
}
|
| 760 |
chandransh |
124 |
|
|
|
125 |
private TreeItem createProviderTree(){
|
|
|
126 |
TreeItem root = new TreeItem("Courier");
|
|
|
127 |
root.addItem(allProviders);
|
|
|
128 |
return root;
|
|
|
129 |
}
|
|
|
130 |
|
| 167 |
ashish |
131 |
@Override
|
|
|
132 |
public Widget asWidget() {
|
|
|
133 |
|
|
|
134 |
return this;
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
@Override
|
| 534 |
chandransh |
138 |
public void updateDetailsPane(Widget details) {
|
|
|
139 |
if(finalWidget != null){
|
|
|
140 |
sp.remove(finalWidget);
|
|
|
141 |
}
|
|
|
142 |
sp.add(details);
|
|
|
143 |
finalWidget = details;
|
|
|
144 |
}
|
|
|
145 |
|
|
|
146 |
@Override
|
|
|
147 |
public void removeDetailsPane() {
|
|
|
148 |
updateDetailsPane(messageDetails);
|
|
|
149 |
}
|
| 167 |
ashish |
150 |
|
|
|
151 |
@Override
|
|
|
152 |
public void updateOrderList(OrderList orderList) {
|
|
|
153 |
if(finalWidget != null){
|
|
|
154 |
sp.remove(finalWidget);
|
|
|
155 |
}
|
|
|
156 |
if(northWidget != null){
|
|
|
157 |
sp.remove(northWidget);
|
|
|
158 |
}
|
|
|
159 |
sp.addNorth(orderList, 200);
|
|
|
160 |
this.northWidget = orderList;
|
|
|
161 |
|
|
|
162 |
sp.add(finalWidget);
|
|
|
163 |
}
|
| 584 |
chandransh |
164 |
|
|
|
165 |
@Override
|
|
|
166 |
public void updateItemList(ItemList itemList) {
|
|
|
167 |
if(finalWidget != null){
|
|
|
168 |
sp.remove(finalWidget);
|
|
|
169 |
}
|
|
|
170 |
if(northWidget != null){
|
|
|
171 |
sp.remove(northWidget);
|
|
|
172 |
}
|
|
|
173 |
sp.addNorth(itemList, 200);
|
|
|
174 |
this.northWidget = itemList;
|
|
|
175 |
|
|
|
176 |
sp.add(finalWidget);
|
|
|
177 |
}
|
| 760 |
chandransh |
178 |
|
|
|
179 |
@Override
|
|
|
180 |
public void updateProviderList(ProivderList providerList) {
|
|
|
181 |
if(finalWidget != null){
|
|
|
182 |
sp.remove(finalWidget);
|
|
|
183 |
}
|
|
|
184 |
if(northWidget != null){
|
|
|
185 |
sp.remove(northWidget);
|
|
|
186 |
}
|
|
|
187 |
sp.addNorth(providerList, 200);
|
|
|
188 |
this.northWidget = providerList;
|
|
|
189 |
|
|
|
190 |
sp.add(finalWidget);
|
|
|
191 |
}
|
| 534 |
chandransh |
192 |
|
|
|
193 |
@Override
|
|
|
194 |
public void changeGreeting(String greeting) {
|
|
|
195 |
topPanel.changeGreeting(greeting);
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
@Override
|
|
|
199 |
public HasClickHandlers getMessageBox() {
|
|
|
200 |
return null;
|
|
|
201 |
}
|
| 167 |
ashish |
202 |
|
|
|
203 |
@Override
|
|
|
204 |
public HasClickHandlers getAcceptedOrdersAnchor() {
|
|
|
205 |
return acceptedOrders;
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
@Override
|
| 486 |
rajveer |
209 |
public HasClickHandlers getRejectedOrdersAnchor() {
|
|
|
210 |
return rejectedOrders;
|
|
|
211 |
}
|
|
|
212 |
|
|
|
213 |
@Override
|
| 167 |
ashish |
214 |
public HasClickHandlers getBilledOrdersAnchor() {
|
|
|
215 |
return billedOrders;
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
@Override
|
|
|
219 |
public HasClickHandlers getNewOrdersAnchor() {
|
|
|
220 |
return newOrders;
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
@Override
|
|
|
224 |
public HasClickHandlers getShippedOrdersAnchor() {
|
|
|
225 |
return shippedOrders;
|
|
|
226 |
}
|
|
|
227 |
|
|
|
228 |
@Override
|
| 306 |
ashish |
229 |
public HasClickHandlers getSignOutLink() {
|
|
|
230 |
return topPanel.getSignOutLink();
|
|
|
231 |
}
|
|
|
232 |
|
|
|
233 |
@Override
|
|
|
234 |
public HasClickHandlers getAllOrdersAnchor() {
|
|
|
235 |
return allOrders;
|
|
|
236 |
}
|
|
|
237 |
|
|
|
238 |
@Override
|
|
|
239 |
public HasClickHandlers getAlertsAnchor() {
|
|
|
240 |
return alerts;
|
|
|
241 |
}
|
|
|
242 |
|
|
|
243 |
@Override
|
|
|
244 |
public HasClickHandlers getNotAvailableAnchor() {
|
|
|
245 |
return notAvailable;
|
|
|
246 |
}
|
|
|
247 |
|
| 760 |
chandransh |
248 |
@Override
|
| 597 |
chandransh |
249 |
public HasClickHandlers getOrdersTreeHeader(){
|
|
|
250 |
return orderTreeHeader;
|
|
|
251 |
}
|
|
|
252 |
|
| 760 |
chandransh |
253 |
@Override
|
| 597 |
chandransh |
254 |
public HasClickHandlers getAllItemsAnchor(){
|
|
|
255 |
return allItems;
|
|
|
256 |
}
|
|
|
257 |
|
| 760 |
chandransh |
258 |
@Override
|
| 597 |
chandransh |
259 |
public HasClickHandlers getBestDealsAnchor(){
|
|
|
260 |
return bestDeals;
|
|
|
261 |
}
|
|
|
262 |
|
| 760 |
chandransh |
263 |
@Override
|
| 597 |
chandransh |
264 |
public HasClickHandlers getBestSellersAnchor(){
|
|
|
265 |
return bestSellers;
|
|
|
266 |
}
|
|
|
267 |
|
| 760 |
chandransh |
268 |
@Override
|
| 597 |
chandransh |
269 |
public HasClickHandlers getLatestArrivalsAnchor(){
|
|
|
270 |
return latestArrivals;
|
|
|
271 |
}
|
|
|
272 |
|
| 760 |
chandransh |
273 |
@Override
|
| 584 |
chandransh |
274 |
public HasClickHandlers getCatalogTreeHeader(){
|
|
|
275 |
return catalogTreeHeader;
|
|
|
276 |
}
|
|
|
277 |
|
| 760 |
chandransh |
278 |
@Override
|
|
|
279 |
public HasClickHandlers getProviderTreeHeader(){
|
|
|
280 |
return providerTreeHeader;
|
|
|
281 |
}
|
|
|
282 |
|
|
|
283 |
@Override
|
|
|
284 |
public HasClickHandlers getAllProvidersAnchor(){
|
|
|
285 |
return allProviders;
|
|
|
286 |
}
|
| 1193 |
chandransh |
287 |
|
|
|
288 |
@Override
|
|
|
289 |
public HasClickHandlers getPrintPendingAnchor() {
|
|
|
290 |
return printPending;
|
|
|
291 |
}
|
| 167 |
ashish |
292 |
}
|