// 获得单元格的值
 @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;
 }
  /** 添加一行 */
  public void addRow() {
    TShopCharge tShopCharge = new TShopCharge();
    tShopCharge.setSelect(true);
    tShopCharge.setIsValid(true);
    tShopCharge.setOperatorName(ApplicationContext.OPERATOR_NAME);
    tShopCharge.setOperator(ApplicationContext.OPERATOR_ID);
    tShopCharge.setHappenTime(new Date());
    tShopCharge.setHappenTimeStr(
        DateUtil.format(tShopCharge.getHappenTime(), DateUtil.TYPE_DATETIME));
    tShopCharge.setType("1、充值xx送xx");

    tShopChargeList.add(tShopCharge);
    this.fireTableRowsInserted(tShopChargeList.size() - 1, tShopChargeList.size() - 1);
  }
Exemplo n.º 3
0
 // 条件查询
 protected void termQuery(final int currentPage) {
   final TShopCharge tshopcharge = new TShopCharge();
   // tshopcharge.setChargeID(cardNumTF.getText().getText().trim());
   tshopcharge.setStartTime(startTimeTF.getDate());
   tshopcharge.setEndTime(timeTF.getDate());
   new Thread() {
     public void run() {
       tableJsp.getViewport().remove(table);
       tableJsp.getViewport().add(waitComponent);
       try {
         pageView.setCurrentPage(currentPage);
         PageModel<TShopCharge> pageModel =
             tShopChargeService.getScrollService(
                 pageView.getFirstResult(), pageView.getMaxResult(), tshopcharge);
         pageView.setPageModel(pageModel);
         pageView.setPageIndex(
             PageIndex.getPageIndex(
                 pageView.getPageCode(), pageView.getCurrentPage(), pageView.getTotalPage()));
         if (pageModel != null) {
           Util.clearTableRowSorter(table);
           memberQueryShopChargeModel.setRowData(pageModel.getResultList());
           SwingUtilities.invokeLater(
               new Runnable() {
                 @Override
                 public void run() {
                   tableJsp.getViewport().remove(waitComponent);
                   tableJsp.getViewport().add(table);
                   //									Util.setJTabelAutoClumnWidth(table);
                   pagingComponent.show();
                 }
               });
         } else {
           // 没有优惠卷信息
           tableJsp.getViewport().remove(waitComponent);
           tableJsp.getViewport().add(table);
           memberQueryShopChargeModel.clear();
         }
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }.start();
 }
 @Override
 public void keyReleased(KeyEvent e) {
   if (e.getSource() == fillMoneyTF.getText()) {
     if (e.getKeyCode() == KeyEvent.VK_ENTER) {
       TShopCharge tShopCharge = new TShopCharge();
       tShopCharge.setAMount(Double.parseDouble(fillMoneyTF.getText().getText()));
       try {
         PageModel<TShopCharge> pageModel =
             tShopChargeService.getTShopChargeService(0, 2, tShopCharge);
         if (pageModel != null) {
           giftMoneyTF.getText().setText(pageModel.getResultList().get(0).getGiftAmount() + "");
         } else {
           giftMoneyTF.getText().setText(0 + "");
         }
       } catch (Exception e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
       }
     }
   }
 }
 // 设置单元格的值
 @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);
   }
 }