コード例 #1
0
ファイル: ManageRack.java プロジェクト: dsmeel/InventoryPro
 // this method every time load the rackList from database and then display
 // it in table
 public void loadTableData() {
   int j = 0;
   while (j < tableModel.getRowCount()) {
     tableModel.removeRow(j);
   }
   rackList = dbValue.getRackDetail(tableid.getStoreId(comboBox1.getSelectedItem().toString()));
   for (int i = 0; i < rackList.size(); i++) {
     RackModel rack = rackList.get(i);
     tableModel.addRow(new Object[] {i + 1, rack.getRackName()});
   }
 }
コード例 #2
0
ファイル: ManageRack.java プロジェクト: dsmeel/InventoryPro
  // used to save a new record
  private void save() {
    // check validation for empty field
    boolean status = true;
    if (valid.isEmpty(textField1.getText())) {
      status = false;
      new ValidationMSG(this, "Please Insert Rack Name");
    }

    // /insert rack when all inputs are valid
    if (status) {
      RackModel rack = new RackModel();
      rack.setRackId(0);
      rack.setRackName(textField1.getText());
      if (!valid.isEmpty(textArea1.getText())) rack.setRackDesc(textArea1.getText());
      rack.setFirmId(1);
      rack.setStoreId(tableid.getStoreId(comboBox1.getSelectedItem().toString()));
      dbinsert.insertRack(rack);
      rack.setDefault();

      loadTableData();
      reset();
    }
  }