// 获得单元格的值 @Override public Object getValueAt(int row, int column) { if (tShopChargeList != null) { TShopCharge tShopCharge = tShopChargeList.get(row); switch (column) { case 0: return "*"; case 1: return tShopCharge.isSelect(); case 2: return tShopCharge.getAMount(); case 3: return tShopCharge.getGiftAmount(); case 4: return tShopCharge.getType(); case 5: return tShopCharge.getOperatorName(); case 6: return tShopCharge.getStartTimeStr(); case 7: return tShopCharge.getEndTimeStr(); case 8: return tShopCharge.getHappenTimeStr(); case 9: return tShopCharge.isIsValid(); } } return null; }
// 设置单元格的值 @Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { TShopCharge tShopCharge = tShopChargeList.get(rowIndex); if (tShopCharge != null && aValue != null) { switch (columnIndex) { case 0: break; case 1: tShopCharge.setSelect(!tShopCharge.isSelect()); return; case 2: if (aValue != null && !aValue.toString().equals("") && MatcherFormatUtil.MatcherPriceScheme(aValue.toString()) && aValue.toString().length() < 10) { tShopCharge.setAMount(Double.parseDouble(aValue.toString())); } break; case 3: if (aValue != null && !aValue.toString().equals("") && MatcherFormatUtil.MatcherPriceScheme(aValue.toString()) && aValue.toString().length() < 10) { tShopCharge.setGiftAmount(Double.parseDouble(aValue.toString())); } break; case 4: tShopCharge.setType(aValue.toString()); break; case 5: return; case 6: tShopCharge.setStartTimeStr(aValue.toString()); try { tShopCharge.setStartTime(DateUtil.getDate(aValue.toString(), DateUtil.TYPE_DATE)); } catch (ParseException e) { e.printStackTrace(); } break; case 7: tShopCharge.setEndTimeStr(aValue.toString()); try { tShopCharge.setEndTime(DateUtil.getDate(aValue.toString(), DateUtil.TYPE_DATE)); } catch (ParseException e) { e.printStackTrace(); } break; case 9: tShopCharge.setIsValid(!tShopCharge.isIsValid()); break; } tShopCharge.setSelect(true); fireTableCellUpdated(rowIndex, 1); } }