OSDN Git Service

検索対象ディレクトリのコンフィグ読み込み・保存
authoryukihane <yukihane.feather@gmail.com>
Fri, 2 Sep 2011 01:28:03 +0000 (10:28 +0900)
committeryukihane <yukihane.feather@gmail.com>
Fri, 9 Sep 2011 11:38:50 +0000 (20:38 +0900)
frontend/src/yukihane/inqubus/gui/ConfigDialog.java
frontend/src/yukihane/inqubus/gui/DirectoryRegisterPanel.java

index d6d81da..583cfb8 100644 (file)
@@ -1018,6 +1018,12 @@ public class ConfigDialog extends JDialog {
         pnlNgId.init(ngIds);
 
         /*
+         * 検索
+         */
+        pnlSearchVideo.init(p.getSearchVideoDirs());
+        pnlSearchComment.init(p.getSearchCommentDirs());
+
+        /*
          * システム
          */
         fldSystemThreadDownload.setText(Integer.toString(p.getSystemDownloadThread()));
@@ -1119,6 +1125,12 @@ public class ConfigDialog extends JDialog {
         p.setNgIds(pnlNgId.getAllElements());
 
         /*
+         * 検索
+         */
+        p.setSearchVideoDirs(pnlSearchVideo.getAllElements());
+        p.setSearchCommentDirs(pnlSearchComment.getAllElements());
+
+        /*
          * システム
          */
         p.setSystemDownloadThread(Integer.parseInt(fldSystemThreadDownload.getText()));
index dc051b8..33eb3a6 100644 (file)
@@ -7,6 +7,7 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.File;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -32,6 +33,21 @@ class DirectoryRegisterPanel extends JPanel {
     private final JButton btnSearchVideoAdd = new JButton("追加...");
     private final JButton btnSearchVideoDel = new JButton("削除");
 
+    List<String> getAllElements() {
+        List<String> res = new ArrayList<>(mdlSearchVideo.getSize());
+        for (int i = 0; i < mdlSearchVideo.getSize(); i++) {
+            res.add(mdlSearchVideo.get(i));
+        }
+        return res;
+    }
+
+    void init(List<String> dirs) {
+        mdlSearchVideo.clear();
+        for (String s : dirs) {
+            mdlSearchVideo.addElement(s);
+        }
+    }
+
     DirectoryRegisterPanel() {
         lstSearchVideo.setTransferHandler(new DirectoryTransferHandler(mdlSearchVideo));
         btnSearchVideoAdd.addActionListener(new AddActionListener());