| 585 |
chandransh |
1 |
package in.shop2020.hotspot.dashbaord.client.inbox;
|
|
|
2 |
|
| 586 |
chandransh |
3 |
import java.util.Date;
|
|
|
4 |
import java.util.GregorianCalendar;
|
|
|
5 |
|
| 585 |
chandransh |
6 |
import in.shop2020.hotspot.dashbaord.shared.actions.Item;
|
|
|
7 |
|
|
|
8 |
import org.enunes.gwt.mvp.client.EventBus;
|
|
|
9 |
|
|
|
10 |
import com.google.gwt.core.client.GWT;
|
| 586 |
chandransh |
11 |
import com.google.gwt.resources.client.CssResource;
|
| 585 |
chandransh |
12 |
import com.google.gwt.uibinder.client.UiBinder;
|
|
|
13 |
import com.google.gwt.uibinder.client.UiField;
|
| 586 |
chandransh |
14 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
|
|
15 |
import com.google.gwt.user.client.ui.Label;
|
|
|
16 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
|
|
17 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 585 |
chandransh |
18 |
import com.google.gwt.user.client.ui.Widget;
|
|
|
19 |
|
| 586 |
chandransh |
20 |
public class ItemDetails extends ResizeComposite {
|
| 585 |
chandransh |
21 |
|
|
|
22 |
private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);
|
|
|
23 |
|
|
|
24 |
interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {
|
|
|
25 |
}
|
| 586 |
chandransh |
26 |
|
| 585 |
chandransh |
27 |
private final EventBus eventbus;
|
|
|
28 |
private final Item item;
|
|
|
29 |
|
| 586 |
chandransh |
30 |
@UiField Label itemId, brand, modelNumber, modelName;
|
|
|
31 |
@UiField Label category, comments;
|
|
|
32 |
@UiField Label catalogItemId, vendorItemId;
|
|
|
33 |
@UiField Label mrp, mop, sellingPrice, weight;
|
| 587 |
chandransh |
34 |
@UiField Label addedOn, startDate, retireDate;
|
| 585 |
chandransh |
35 |
|
|
|
36 |
public ItemDetails(EventBus eventbus, Item item){
|
|
|
37 |
this.eventbus = eventbus;
|
|
|
38 |
this.item = item;
|
|
|
39 |
initWidget(uiBinder.createAndBindUi(this));
|
| 586 |
chandransh |
40 |
initItemDetails(this.item);
|
| 585 |
chandransh |
41 |
}
|
|
|
42 |
|
| 586 |
chandransh |
43 |
private void initItemDetails(Item item){
|
|
|
44 |
itemId.setText(item.getId()+"");
|
|
|
45 |
brand.setText(item.getManufacturerName());
|
|
|
46 |
modelNumber.setText(item.getModelNumber());
|
|
|
47 |
modelName.setText(item.getModelName());
|
|
|
48 |
|
|
|
49 |
category.setText(item.getCategory());
|
|
|
50 |
comments.setText(item.getComments());
|
|
|
51 |
catalogItemId.setText(item.getCatalogItemId() + "");
|
|
|
52 |
vendorItemId.setText(item.getVendorItemId()+"");
|
|
|
53 |
|
|
|
54 |
mrp.setText(item.getMrp()+"");
|
|
|
55 |
mop.setText(item.getMop()+"");
|
|
|
56 |
sellingPrice.setText(item.getSellingPrice()+"");
|
|
|
57 |
weight.setText(item.getWeight()+"");
|
| 587 |
chandransh |
58 |
|
|
|
59 |
addedOn.setText(getDisplayableDate(item.getAddedOn()));
|
|
|
60 |
startDate.setText(getDisplayableDate(item.getStartDate()));
|
|
|
61 |
retireDate.setText(getDisplayableDate(item.getRetireDate()));
|
| 585 |
chandransh |
62 |
}
|
| 586 |
chandransh |
63 |
|
|
|
64 |
//TODO: This code is duplicated between here and OrderList. Move it to a Utility class.
|
| 587 |
chandransh |
65 |
private String getDisplayableDate(Long millis){
|
|
|
66 |
Date date = new Date();
|
|
|
67 |
date.setTime(millis);
|
| 586 |
chandransh |
68 |
String dateString = date.toString();
|
|
|
69 |
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
|
|
|
70 |
dateString = dateString.substring(0, dateString.lastIndexOf(" "));
|
|
|
71 |
return dateString;
|
| 585 |
chandransh |
72 |
}
|
|
|
73 |
}
|