OSDN Git Service

動画ファイル保存設定のパネルを外だし
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / ConfigDialog.java
index c6d89ce..b8cb84d 100644 (file)
@@ -65,13 +65,6 @@ public class ConfigDialog extends JDialog {
         fldProxyHost = new JTextField();
         fldProxyPort = new JTextField();
         final JPanel pnlFile = new JPanel();
-        final JPanel pnlFileVideo = new JPanel();
-        final JLabel lblVideoDir = new JLabel();
-        final JLabel lblVideoFileNamepattern = new JLabel();
-        fldVideoDir = new JTextField();
-        fldVideoFileNamePattern = new JTextField();
-        btnVideoDir = new JButton();
-        cbVideoLocal = new JCheckBox();
         final JPanel pnlFileComment = new JPanel();
         final JLabel lblCommentDir = new JLabel();
         final JLabel lblCommentFileNamePattern = new JLabel();
@@ -231,50 +224,6 @@ public class ConfigDialog extends JDialog {
 
         pnlFileVideo.setBorder(BorderFactory.createTitledBorder("動画"));
 
-        lblVideoDir.setText("保存フォルダ");
-
-        lblVideoFileNamepattern.setText("ファイル名規則");
-
-        btnVideoDir.setText("...");
-
-        cbVideoLocal.setText("local");
-
-        GroupLayout gl_pnlFileVideo = new GroupLayout(pnlFileVideo);
-        pnlFileVideo.setLayout(gl_pnlFileVideo);
-        gl_pnlFileVideo.setHorizontalGroup(
-            gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
-            .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileVideo.createSequentialGroup()
-                .addContainerGap()
-                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
-                    .addComponent(lblVideoFileNamepattern)
-                    .addComponent(lblVideoDir))
-                .addPreferredGap(ComponentPlacement.RELATED)
-                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
-                    .addGroup(gl_pnlFileVideo.createSequentialGroup()
-                        .addComponent(fldVideoDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
-                        .addPreferredGap(ComponentPlacement.RELATED)
-                        .addComponent(btnVideoDir))
-                    .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileVideo.createSequentialGroup()
-                        .addComponent(fldVideoFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
-                        .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
-                        .addComponent(cbVideoLocal)))
-                .addContainerGap())
-        );
-        gl_pnlFileVideo.setVerticalGroup(
-            gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
-            .addGroup(gl_pnlFileVideo.createSequentialGroup()
-                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.BASELINE)
-                    .addComponent(lblVideoDir)
-                    .addComponent(fldVideoDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                    .addComponent(btnVideoDir))
-                .addPreferredGap(ComponentPlacement.RELATED)
-                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.BASELINE)
-                    .addComponent(lblVideoFileNamepattern)
-                    .addComponent(fldVideoFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-                    .addComponent(cbVideoLocal))
-                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
-        );
-
         pnlFileComment.setBorder(BorderFactory.createTitledBorder("コメント"));
 
         lblCommentDir.setText("保存フォルダ");
@@ -878,10 +827,7 @@ public class ConfigDialog extends JDialog {
     private final JTextField fldProxyPort;
     // ファイル
     // ファイル - 動画
-    private final JTextField fldVideoDir;
-    private final JButton btnVideoDir;
-    private final JTextField fldVideoFileNamePattern;
-    private final JCheckBox cbVideoLocal;
+    private final FileVideoPanel pnlFileVideo = new FileVideoPanel();
     // ファイル - コメント
     private final JTextField fldCommentDir;
     private final JButton btnCommentDir;
@@ -960,9 +906,9 @@ public class ConfigDialog extends JDialog {
         /*
          * ファイル - 動画
          */
-        fldVideoDir.setText(p.getVideoDir());
-        fldVideoFileNamePattern.setText(p.getVideoFileNamePattern());
-        cbVideoLocal.setSelected(p.getVideoUseLocal());
+        pnlFileVideo.fldVideoDir.setText(p.getVideoDir());
+        pnlFileVideo.fldVideoFileNamePattern.setText(p.getVideoFileNamePattern());
+        pnlFileVideo.cbVideoLocal.setSelected(p.getVideoUseLocal());
 
         /*
          * ファイル - コメント
@@ -1059,9 +1005,9 @@ public class ConfigDialog extends JDialog {
         /*
          * ファイル - 動画
          */
-        p.setVideoDir(fldVideoDir.getText());
-        p.setVideoFileNamePattern(fldVideoFileNamePattern.getText());
-        p.setVideoUseLocal(cbVideoLocal.isSelected());
+        p.setVideoDir(pnlFileVideo.fldVideoDir.getText());
+        p.setVideoFileNamePattern(pnlFileVideo.fldVideoFileNamePattern.getText());
+        p.setVideoUseLocal(pnlFileVideo.cbVideoLocal.isSelected());
 
         /*
          * ファイル - コメント
@@ -1152,3 +1098,56 @@ public class ConfigDialog extends JDialog {
         }
     }
 }
+
+class FileVideoPanel extends JPanel {
+    final JTextField fldVideoDir = new JTextField();
+    final JButton btnVideoDir = new JButton("...");
+    final JTextField fldVideoFileNamePattern = new JTextField();
+    final JCheckBox cbVideoLocal = new JCheckBox("local");
+
+    FileVideoPanel(){
+        super();
+
+        final JLabel lblVideoDir = new JLabel("保存フォルダ");
+
+        final JLabel lblVideoFileNamepattern = new JLabel("ファイル名規則");
+
+
+        GroupLayout gl_pnlFileVideo = new GroupLayout(this);
+        setLayout(gl_pnlFileVideo);
+        gl_pnlFileVideo.setHorizontalGroup(
+            gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
+            .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileVideo.createSequentialGroup()
+                .addContainerGap()
+                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
+                    .addComponent(lblVideoFileNamepattern)
+                    .addComponent(lblVideoDir))
+                .addPreferredGap(ComponentPlacement.RELATED)
+                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
+                    .addGroup(gl_pnlFileVideo.createSequentialGroup()
+                        .addComponent(fldVideoDir, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
+                        .addPreferredGap(ComponentPlacement.RELATED)
+                        .addComponent(btnVideoDir))
+                    .addGroup(GroupLayout.Alignment.TRAILING, gl_pnlFileVideo.createSequentialGroup()
+                        .addComponent(fldVideoFileNamePattern, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE)
+                        .addPreferredGap(ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
+                        .addComponent(cbVideoLocal)))
+                .addContainerGap())
+        );
+        gl_pnlFileVideo.setVerticalGroup(
+            gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.LEADING)
+            .addGroup(gl_pnlFileVideo.createSequentialGroup()
+                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.BASELINE)
+                    .addComponent(lblVideoDir)
+                    .addComponent(fldVideoDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                    .addComponent(btnVideoDir))
+                .addPreferredGap(ComponentPlacement.RELATED)
+                .addGroup(gl_pnlFileVideo.createParallelGroup(GroupLayout.Alignment.BASELINE)
+                    .addComponent(lblVideoFileNamepattern)
+                    .addComponent(fldVideoFileNamePattern, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                    .addComponent(cbVideoLocal))
+                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+        );
+
+    }
+}