Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
	}
26
 
586 chandransh 27
	interface SelectionStyle extends CssResource{
28
		String blueLabel();
29
		String greenLabel();
30
	}
31
 
585 chandransh 32
	private final EventBus eventbus;
33
	private final Item item;
34
 
586 chandransh 35
	@UiField Label itemId, brand, modelNumber, modelName;
36
	@UiField Label category, comments;
37
	@UiField Label catalogItemId, vendorItemId;
38
	@UiField Label mrp, mop, sellingPrice, weight;
39
	private long addedOn;
40
	private long startDate;
41
	private long retireDate;
585 chandransh 42
 
43
	public ItemDetails(EventBus eventbus, Item item){
44
		this.eventbus = eventbus;
45
		this.item = item;
46
		initWidget(uiBinder.createAndBindUi(this));
586 chandransh 47
		initItemDetails(this.item);
585 chandransh 48
	}
49
 
586 chandransh 50
	private void initItemDetails(Item item){
51
		itemId.setText(item.getId()+"");
52
		brand.setText(item.getManufacturerName());
53
		modelNumber.setText(item.getModelNumber());
54
		modelName.setText(item.getModelName());
55
 
56
		category.setText(item.getCategory());
57
		comments.setText(item.getComments());
58
		catalogItemId.setText(item.getCatalogItemId() + "");
59
		vendorItemId.setText(item.getVendorItemId()+"");
60
 
61
		mrp.setText(item.getMrp()+"");
62
		mop.setText(item.getMop()+"");
63
		sellingPrice.setText(item.getSellingPrice()+"");
64
		weight.setText(item.getWeight()+"");
585 chandransh 65
	}
586 chandransh 66
 
67
	//TODO: This code is duplicated between here and OrderList. Move it to a Utility class.
68
	private String getDisplayableDate(Date date){
69
		GregorianCalendar cal = new GregorianCalendar();
70
		//cal.setTimeInMillis(millis);
585 chandransh 71
 
586 chandransh 72
		String dateString = date.toString();
73
		dateString = dateString.substring(0, dateString.lastIndexOf(" "));
74
		dateString = dateString.substring(0, dateString.lastIndexOf(" "));
75
		return dateString;		
585 chandransh 76
	}
77
}