| Line 28... |
Line 28... |
| 28 |
import com.google.gwt.user.client.ui.ListBox;
|
28 |
import com.google.gwt.user.client.ui.ListBox;
|
| 29 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
29 |
import com.google.gwt.user.client.ui.ResizeComposite;
|
| 30 |
import com.google.gwt.user.client.ui.TextBox;
|
30 |
import com.google.gwt.user.client.ui.TextBox;
|
| 31 |
import com.google.gwt.user.client.ui.Widget;
|
31 |
import com.google.gwt.user.client.ui.Widget;
|
| 32 |
import com.google.gwt.user.datepicker.client.DateBox;
|
32 |
import com.google.gwt.user.datepicker.client.DateBox;
|
| - |
|
33 |
import com.google.gwt.uibinder.client.UiHandler;
|
| 33 |
|
34 |
|
| 34 |
/**
|
35 |
/**
|
| 35 |
* Panel contains fields for item details. Some of these fields are editable.
|
36 |
* Panel contains fields for item details. Some of these fields are editable.
|
| 36 |
* It also contains vendor item pricings, vendor item keys, and item availability in tabular format.
|
37 |
* It also contains vendor item pricings, vendor item keys, and item availability in tabular format.
|
| 37 |
* Item availability is made invisible for time being
|
38 |
* Item availability is made invisible for time being
|
| 38 |
*/
|
39 |
*/
|
| 39 |
public class ItemDetails extends ResizeComposite {
|
40 |
public class ItemDetails extends ResizeComposite implements ComingSoon {
|
| 40 |
|
41 |
|
| 41 |
private final int TABLE_INDEX_MAPPING_VENDOR_DESC = 0,
|
42 |
private final int TABLE_INDEX_MAPPING_VENDOR_DESC = 0,
|
| 42 |
TABLE_INDEX_MAPPING_ITEM_KEY = 1,
|
43 |
TABLE_INDEX_MAPPING_ITEM_KEY = 1,
|
| 43 |
TABLE_INDEX_MAPPING_BUTTON = 2,
|
44 |
TABLE_INDEX_MAPPING_BUTTON = 2,
|
| 44 |
TABLE_INDEX_MAPPING_VENDORID = 3,
|
45 |
TABLE_INDEX_MAPPING_VENDORID = 3,
|
| Line 104... |
Line 105... |
| 104 |
@UiField FlexTable headerVendorPrices, tableVendorPrices;
|
105 |
@UiField FlexTable headerVendorPrices, tableVendorPrices;
|
| 105 |
@UiField FlexTable headerSourcePrices, tableSourcePrices;
|
106 |
@UiField FlexTable headerSourcePrices, tableSourcePrices;
|
| 106 |
@UiField TextBox bestSellingRank;
|
107 |
@UiField TextBox bestSellingRank;
|
| 107 |
@UiField TextBox expectedDelay;
|
108 |
@UiField TextBox expectedDelay;
|
| 108 |
@UiField CheckBox defaultForEntity, risky, warehouseStickiness;
|
109 |
@UiField CheckBox defaultForEntity, risky, warehouseStickiness;
|
| 109 |
@UiField DateBox startDate;
|
110 |
@UiField DateBox startDate, expectedArrivalDate, comingSoonStartDate;
|
| 110 |
@UiField FlexTable headerSimilarItems, tableSimilarItems;
|
111 |
@UiField FlexTable headerSimilarItems, tableSimilarItems;
|
| 111 |
@UiField ListBox preferredVendor, preferredWarehouse, defaultWarehouse;
|
112 |
@UiField ListBox preferredVendor, preferredWarehouse, defaultWarehouse;
|
| - |
|
113 |
@UiField Button comingSoonButton;
|
| 112 |
|
114 |
|
| 113 |
public ItemDetails(Item item){
|
115 |
public ItemDetails(Item item){
|
| 114 |
this();
|
116 |
this();
|
| 115 |
setItemDetails(item);
|
117 |
setItemDetails(item);
|
| 116 |
}
|
118 |
}
|
| Line 212... |
Line 214... |
| 212 |
weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
|
214 |
weight.setText(item.getWeight() != null ? item.getWeight()+"" : "");
|
| 213 |
expectedDelay.setValue(item.getExpectedDelay()+"");
|
215 |
expectedDelay.setValue(item.getExpectedDelay()+"");
|
| 214 |
warehouseStickiness.setValue(item.isWarehouseStickiness());
|
216 |
warehouseStickiness.setValue(item.isWarehouseStickiness());
|
| 215 |
|
217 |
|
| 216 |
startDate.setValue(new Date(item.getStartDate()));
|
218 |
startDate.setValue(new Date(item.getStartDate()));
|
| - |
|
219 |
if(item.getComingSoonStartDate() != null){
|
| - |
|
220 |
comingSoonStartDate.setValue(new Date(item.getComingSoonStartDate()));
|
| - |
|
221 |
}else {
|
| - |
|
222 |
comingSoonStartDate.setValue(null);
|
| - |
|
223 |
}
|
| - |
|
224 |
|
| - |
|
225 |
if(item.getExpectedArrivalDate() != null){
|
| - |
|
226 |
expectedArrivalDate.setValue(new Date(item.getExpectedArrivalDate()));
|
| - |
|
227 |
}else {
|
| - |
|
228 |
expectedArrivalDate.setValue(null);
|
| - |
|
229 |
}
|
| 217 |
addedOn.setText(Utils.getDisplayableDate(item.getAddedOn()));
|
230 |
addedOn.setText(Utils.getDisplayableDate(item.getAddedOn()));
|
| 218 |
retireDate.setText(Utils.getDisplayableDate(item.getRetireDate()));
|
231 |
retireDate.setText(Utils.getDisplayableDate(item.getRetireDate()));
|
| 219 |
updatedOn.setText(Utils.getDisplayableDate(item.getUpdatedOn()));
|
232 |
updatedOn.setText(Utils.getDisplayableDate(item.getUpdatedOn()));
|
| 220 |
|
233 |
|
| 221 |
bestDealsText.setText(item.getBestDealsText());
|
234 |
bestDealsText.setText(item.getBestDealsText());
|
| Line 914... |
Line 927... |
| 914 |
} catch(Exception ex) {
|
927 |
} catch(Exception ex) {
|
| 915 |
Window.alert("Invalid start date format");
|
928 |
Window.alert("Invalid start date format");
|
| 916 |
return false;
|
929 |
return false;
|
| 917 |
}
|
930 |
}
|
| 918 |
newItem.setBestDealsText(bestDealsText.getText().trim());
|
931 |
newItem.setBestDealsText(bestDealsText.getText().trim());
|
| - |
|
932 |
Date comingSoonStartDt = comingSoonStartDate.getValue();
|
| - |
|
933 |
Date expectedArrivalDt = expectedArrivalDate.getValue();
|
| - |
|
934 |
if(comingSoonStartDt == null){
|
| - |
|
935 |
newItem.setComingSoonStartDate(null);
|
| - |
|
936 |
}else {
|
| - |
|
937 |
newItem.setComingSoonStartDate(comingSoonStartDt.getTime());
|
| - |
|
938 |
}
|
| - |
|
939 |
if(expectedArrivalDt == null){
|
| - |
|
940 |
newItem.setExpectedArrivalDate(null);
|
| - |
|
941 |
}else {
|
| - |
|
942 |
newItem.setExpectedArrivalDate(expectedArrivalDt.getTime());
|
| - |
|
943 |
}
|
| 919 |
try {
|
944 |
try {
|
| 920 |
if(!bestDealsValue.getText().trim().equals("")) {
|
945 |
if(!bestDealsValue.getText().trim().equals("")) {
|
| 921 |
double bdValue = Double.parseDouble(bestDealsValue.getText().trim());
|
946 |
double bdValue = Double.parseDouble(bestDealsValue.getText().trim());
|
| 922 |
if(bdValue < 0) {
|
947 |
if(bdValue < 0) {
|
| 923 |
throw new NumberFormatException("Negative value of BestDealValue");
|
948 |
throw new NumberFormatException("Negative value of BestDealValue");
|
| Line 1162... |
Line 1187... |
| 1162 |
sb.append("\n-Risky Flag");
|
1187 |
sb.append("\n-Risky Flag");
|
| 1163 |
}
|
1188 |
}
|
| 1164 |
if(!checkParameterIfEqual(newItem.getStartDate(), item.getStartDate())) {
|
1189 |
if(!checkParameterIfEqual(newItem.getStartDate(), item.getStartDate())) {
|
| 1165 |
sb.append("\n-Start Date");
|
1190 |
sb.append("\n-Start Date");
|
| 1166 |
}
|
1191 |
}
|
| - |
|
1192 |
if(!checkParameterIfEqual(newItem.getExpectedArrivalDate(), item.getExpectedArrivalDate())) {
|
| - |
|
1193 |
sb.append("\n-Expected Arrival Date");
|
| - |
|
1194 |
}
|
| - |
|
1195 |
if(!checkParameterIfEqual(newItem.getComingSoonStartDate(), item.getComingSoonStartDate())) {
|
| - |
|
1196 |
sb.append("\n-Coming Soon Start Date");
|
| - |
|
1197 |
}
|
| 1167 |
if(!checkParameterIfEqual(newItem.getExpectedDelay(), item.getExpectedDelay())) {
|
1198 |
if(!checkParameterIfEqual(newItem.getExpectedDelay(), item.getExpectedDelay())) {
|
| 1168 |
sb.append("\n-Expected Delay");
|
1199 |
sb.append("\n-Expected Delay");
|
| 1169 |
}
|
1200 |
}
|
| 1170 |
if(!checkParameterIfEqual(newItem.getPreferredWarehouse(), item.getPreferredWarehouse())) {
|
1201 |
if(!checkParameterIfEqual(newItem.getPreferredWarehouse(), item.getPreferredWarehouse())) {
|
| 1171 |
sb.append("\n-Preferred Warehouse");
|
1202 |
sb.append("\n-Preferred Warehouse");
|
| Line 1466... |
Line 1497... |
| 1466 |
caught.printStackTrace();
|
1497 |
caught.printStackTrace();
|
| 1467 |
Window.alert("Error while adding the event");
|
1498 |
Window.alert("Error while adding the event");
|
| 1468 |
}
|
1499 |
}
|
| 1469 |
});
|
1500 |
});
|
| 1470 |
}
|
1501 |
}
|
| - |
|
1502 |
|
| - |
|
1503 |
@Override
|
| - |
|
1504 |
public void setComingSoonStartDate(Date date) {
|
| - |
|
1505 |
this.comingSoonStartDate.setValue(date);
|
| - |
|
1506 |
|
| - |
|
1507 |
}
|
| - |
|
1508 |
|
| - |
|
1509 |
@Override
|
| - |
|
1510 |
public void setBestDealsText(String bestDealsText) {
|
| - |
|
1511 |
this.bestDealsText.setValue(bestDealsText);
|
| - |
|
1512 |
|
| - |
|
1513 |
}
|
| - |
|
1514 |
|
| - |
|
1515 |
@Override
|
| - |
|
1516 |
public void setExpectedArrivalDate(Date date) {
|
| - |
|
1517 |
this.expectedArrivalDate.setValue(date);
|
| - |
|
1518 |
|
| - |
|
1519 |
}
|
| - |
|
1520 |
|
| - |
|
1521 |
@Override
|
| - |
|
1522 |
public String getBestDealsText() {
|
| - |
|
1523 |
return this.bestDealsText.getValue();
|
| - |
|
1524 |
}
|
| - |
|
1525 |
|
| - |
|
1526 |
@Override
|
| - |
|
1527 |
public Date getComingSoonStartDate() {
|
| - |
|
1528 |
return this.comingSoonStartDate.getValue();
|
| - |
|
1529 |
}
|
| - |
|
1530 |
|
| - |
|
1531 |
@Override
|
| - |
|
1532 |
public Date getExpectedArrivalDate() {
|
| - |
|
1533 |
return this.expectedArrivalDate.getValue();
|
| - |
|
1534 |
}
|
| - |
|
1535 |
@UiHandler("comingSoonButton")
|
| - |
|
1536 |
void onComingSoonButtonClick(ClickEvent event) {
|
| - |
|
1537 |
ComingSoonDialog cd = new ComingSoonDialog(this);
|
| - |
|
1538 |
cd.show();
|
| - |
|
1539 |
}
|
| 1471 |
}
|
1540 |
}
|