コード例 #1
0
 private void addData() {
   DBType dbType =
       (DBType)
           JOptionPane.showInputDialog(
               null,
               "请选择模版:",
               "数据库类型",
               JOptionPane.PLAIN_MESSAGE,
               null,
               DBType.values(),
               DBType.valueOf("MYSQL"));
   if (dbType == null) {
     return;
   }
   DBConnectionInfo dbInfo = ConfigDbUtil.init().getInitDBConnectionInfo(dbType);
   tmDbInfo.addRow(dbInfo);
   jtDbinfo.updateUI();
 }
コード例 #2
0
 @Override
 public void setValueAt(Object value, int row, int col) {
   DBConnectionInfo tmp = dbConnectionInfoList.get(row);
   if (tmp == null || value == null) {
     return;
   }
   switch (col) {
     case 0:
       tmp.setDbCode(value.toString());
       break;
     case 1:
       tmp.setDbAddress(value.toString());
       break;
     case 2:
       tmp.setDbPort(value.toString());
       break;
     case 3:
       tmp.setDbType(DBType.valueOf(value.toString()));
       break;
     case 4:
       tmp.setDbName(value.toString());
       break;
     case 5:
       tmp.setDbUsername(value.toString());
       break;
     case 6:
       tmp.setDbPassword(value.toString());
       break;
     case 7:
       tmp.setDbTestSQL(value.toString());
       break;
     case 8:
       tmp.setMaxConnectionNum(Integer.valueOf(value.toString()));
       break;
     case 9:
       tmp.setMinConnectionNum(Integer.valueOf(value.toString()));
       break;
   }
   DBType dbtype = tmp.getDbType() == null ? DBType.MYSQL : tmp.getDbType();
   tmp.initConnectionString(ConfigDbUtil.init().getConnectionStringFormat(dbtype));
   for (int i = 0; i < title.length; i++) {
     this.fireTableCellUpdated(row, i);
   }
 }