public boolean saveList(String path) {
   Properties properties = LocalResourcesUtil.getProperties(path);
   Iterator<Object> dbsKeys = properties.keySet().iterator();
   String dbsPath = path.substring(0, path.lastIndexOf(File.separator) + 1);
   while (dbsKeys.hasNext()) {
     String key = dbsKeys.next().toString().trim();
     String value = properties.getProperty(key).trim();
     FileUtils.deleteFile(StringUtils.unite(dbsPath, value));
   }
   for (int i = 0; i < dbConnectionInfoList.size(); i++) {
     DBConnectionInfo dbConnectionInfo = dbConnectionInfoList.get(i);
     String key = dbConnectionInfo.getDbCode();
     try {
       String name = StringUtils.unite(key, "DBConfig.properties");
       if (properties.get(key) != null) {
         name = properties.getProperty(key);
       }
       FileOutputStream fos = new FileOutputStream(StringUtils.unite(dbsPath, name));
       fos.write(dbConnectionInfo.toString().getBytes());
       fos.close();
     } catch (IOException e) {
       logger.error(e.getMessage(), e);
     }
   }
   return true;
 }
 private void saveData() {
   String path = jtfConfigPath.getText();
   if (path == null || path.length() < 1) {
     JOptionPane.showMessageDialog(this, "文件目录不能为空!");
     return;
   }
   List<String> addList = new ArrayList<>();
   List<String> upList = new ArrayList<>();
   Properties config = LocalResourcesUtil.getProperties(path);
   for (int i = 0; i < tmDbInfo.getRowCount(); i++) {
     String code = tmDbInfo.getValueAt(i, 0).toString();
     if (config.containsKey(code)) {
       upList.add(config.getProperty(code));
       config.remove(code);
     } else {
       addList.add(StringUtils.unite(code, "DBConfig.properties"));
     }
   }
   StringBuilder sb = new StringBuilder();
   sb.append(StringUtils.unite("本次\r\n新增:", addList, "\r\n"));
   sb.append(StringUtils.unite("修改:", upList, "\r\n"));
   sb.append(StringUtils.unite("删除:", config.values(), "\r\n"));
   int isOk =
       JOptionPane.showConfirmDialog(this, sb.toString(), "确认要保存吗?", JOptionPane.OK_CANCEL_OPTION);
   if (isOk == 0) {
     if (tmDbInfo.saveList(path)) {
       JOptionPane.showMessageDialog(this, "保存成功!");
     } else {
       JOptionPane.showMessageDialog(this, "保存失败。");
     }
   }
 }
 public void loadFile() {
   if (jtfConfigPath.getText().trim().length() < 1) {
     JOptionPane.showMessageDialog(this, "文件目录不能为空!");
     return;
   }
   new Thread() {
     public void run() {
       load();
     }
   }.start();
   Properties properties = LocalResourcesUtil.getProperties(jtfConfigPath.getText());
   Iterator<Object> dbsKeys = properties.keySet().iterator();
   String path = jtfConfigPath.getText();
   path = path.substring(0, path.lastIndexOf(File.separator) + 1);
   while (dbsKeys.hasNext()) {
     String key = dbsKeys.next().toString().trim();
     String value = properties.getProperty(key).trim();
     Properties dbConfig = LocalResourcesUtil.getProperties(StringUtils.unite(path, value));
     DBConnectionInfo dbinfo = new DBConnectionInfo(key, dbConfig);
     tmDbInfo.addRow(dbinfo);
   }
   jtDbinfo.updateUI();
   jpbLoading.setValue(100);
 }