Rev 2313 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.hotspot.dashbaord.client.inbox;import java.util.Date;import in.shop2020.hotspot.dashbaord.shared.actions.Item;import org.enunes.gwt.mvp.client.EventBus;import com.google.gwt.core.client.GWT;import com.google.gwt.uibinder.client.UiBinder;import com.google.gwt.uibinder.client.UiField;import com.google.gwt.user.client.ui.Label;import com.google.gwt.user.client.ui.ResizeComposite;import com.google.gwt.user.client.ui.Widget;public class ItemDetails extends ResizeComposite {private static ItemDetailsUiBinder uiBinder = GWT.create(ItemDetailsUiBinder.class);interface ItemDetailsUiBinder extends UiBinder<Widget, ItemDetails> {}private final Item item;@UiField Label itemId, productGroup, brand, modelNumber, modelName, color;@UiField Label category, comments;@UiField Label catalogItemId;@UiField Label mrp, mop, sellingPrice, dealerPrice, weight;@UiField Label addedOn, startDate, retireDate, updatedOn;@UiField Label bestDealsText, bestDealsValue;public ItemDetails(EventBus eventbus, Item item){this.item = item;initWidget(uiBinder.createAndBindUi(this));initItemDetails(this.item);}private void initItemDetails(Item item){itemId.setText(item.getId()+"");productGroup.setText(item.getProductGroup());brand.setText(item.getBrand());modelNumber.setText(item.getModelNumber());modelName.setText(item.getModelName());color.setText(item.getColor());category.setText(item.getCategory()+"");comments.setText(item.getComments());catalogItemId.setText(item.getCatalogItemId() + "");mrp.setText(item.getMrp()+"");mop.setText("");sellingPrice.setText(item.getSellingPrice()+"");dealerPrice.setText("");weight.setText(item.getWeight()+"");addedOn.setText(getDisplayableDate(item.getAddedOn()));startDate.setText(getDisplayableDate(item.getStartDate()));retireDate.setText(getDisplayableDate(item.getRetireDate()));updatedOn.setText(getDisplayableDate(item.getUpdatedOn()));bestDealsText.setText(item.getBestDealsText());bestDealsValue.setText(item.getBestDealsValue()+"");}//TODO: This code is duplicated between here and OrderList. Move it to a Utility class.private String getDisplayableDate(Long millis){Date date = new Date();date.setTime(millis);String dateString = date.toString();dateString = dateString.substring(0, dateString.lastIndexOf(" "));dateString = dateString.substring(0, dateString.lastIndexOf(" "));return dateString;}}