OSDN Git Service

入力パネルの起動時の初期状態
authoryukihane <yukihane.feather@gmail.com>
Wed, 17 Aug 2011 03:52:38 +0000 (12:52 +0900)
committeryukihane <yukihane.feather@gmail.com>
Wed, 17 Aug 2011 03:52:38 +0000 (12:52 +0900)
frontend/src/yukihane/inqubus/conifg/Properties.java
frontend/src/yukihane/inqubus/gui/MainFrame.form
frontend/src/yukihane/inqubus/gui/MainFrame.java

index 3ab532a..97924be 100644 (file)
@@ -1,5 +1,6 @@
 package yukihane.inqubus.conifg;
 
+import java.io.File;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
@@ -185,4 +186,24 @@ public enum Properties implements Config {
         field.setAccessible(true);
         return (String) field.get(this);
     }
+
+    public boolean getUseMovieFileLocal() {
+        // TODO
+        return false;
+    }
+
+    public boolean getCommentFileLocal() {
+        // TODO
+        return false;
+    }
+
+    public boolean getOutputConvert() {
+        // TODO
+        return true;
+    }
+
+    public File getOutputFile() {
+        // TODO
+        return new File("out/_converted");
+    }
 }
index 7e9fff5..6649dde 100644 (file)
                           <Component id="useMovieLocalCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
                       </Group>
                       <EmptySpace max="-2" attributes="0"/>
-                      <Group type="103" groupAlignment="0" attributes="0">
-                          <Group type="103" groupAlignment="3" attributes="0">
-                              <Component id="commentLabel" alignment="3" min="-2" max="-2" attributes="0"/>
-                              <Component id="commentFileField" alignment="3" min="-2" max="-2" attributes="0"/>
-                              <Component id="commentFileSelectButton" alignment="3" min="-2" max="-2" attributes="0"/>
-                          </Group>
-                          <Component id="useCommentLocalCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="commentLabel" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="commentFileField" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="commentFileSelectButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                          <Component id="useCommentLocalCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
                       </Group>
                       <EmptySpace max="-2" attributes="0"/>
                       <Group type="103" groupAlignment="3" attributes="0">
               <Properties>
                 <Property name="text" type="java.lang.String" value="local"/>
               </Properties>
+              <Events>
+                <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="useMovieLocalCheckBoxItemStateChanged"/>
+              </Events>
             </Component>
             <Component class="javax.swing.JTextField" name="movieFileField">
             </Component>
               <Properties>
                 <Property name="text" type="java.lang.String" value="local"/>
               </Properties>
+              <Events>
+                <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="useCommentLocalCheckBoxItemStateChanged"/>
+              </Events>
             </Component>
             <Component class="javax.swing.JTextField" name="commentFileField">
             </Component>
               <Properties>
                 <Property name="text" type="java.lang.String" value="&#x5909;&#x63db;"/>
               </Properties>
+              <Events>
+                <EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="outputConvertCheckBoxItemStateChanged"/>
+              </Events>
             </Component>
             <Component class="javax.swing.JTextField" name="outputFileField">
             </Component>
index 8ea8227..0fc7e92 100644 (file)
@@ -7,6 +7,7 @@ package yukihane.inqubus.gui;
 
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
+import java.awt.event.ItemEvent;
 import java.io.File;
 import java.util.Collection;
 import java.util.List;
@@ -15,6 +16,7 @@ import java.util.regex.Pattern;
 import javax.swing.TransferHandler;
 import javax.swing.UIManager;
 import javax.swing.UIManager.LookAndFeelInfo;
+import org.apache.commons.io.FilenameUtils;
 import yukihane.inqubus.conifg.Properties;
 import yukihane.inqubus.model.Target;
 import yukihane.inqubus.model.TargetsTableModel;
@@ -119,18 +121,33 @@ public class MainFrame extends javax.swing.JFrame {
         movieLabel.setText("動画");
 
         useMovieLocalCheckBox.setText("local");
+        useMovieLocalCheckBox.addItemListener(new java.awt.event.ItemListener() {
+            public void itemStateChanged(java.awt.event.ItemEvent evt) {
+                useMovieLocalCheckBoxItemStateChanged(evt);
+            }
+        });
 
         movieFileSelectButton.setText("...");
 
         commentLabel.setText("コメント");
 
         useCommentLocalCheckBox.setText("local");
+        useCommentLocalCheckBox.addItemListener(new java.awt.event.ItemListener() {
+            public void itemStateChanged(java.awt.event.ItemEvent evt) {
+                useCommentLocalCheckBoxItemStateChanged(evt);
+            }
+        });
 
         commentFileSelectButton.setText("...");
 
         outputLabel.setText("出力");
 
         outputConvertCheckBox.setText("変換");
+        outputConvertCheckBox.addItemListener(new java.awt.event.ItemListener() {
+            public void itemStateChanged(java.awt.event.ItemEvent evt) {
+                outputConvertCheckBoxItemStateChanged(evt);
+            }
+        });
 
         outputFileSelectButton.setText("...");
 
@@ -187,11 +204,10 @@ public class MainFrame extends javax.swing.JFrame {
                     .addComponent(movieFileSelectButton)
                     .addComponent(useMovieLocalCheckBox))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                        .addComponent(commentLabel)
-                        .addComponent(commentFileField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                        .addComponent(commentFileSelectButton))
+                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(commentLabel)
+                    .addComponent(commentFileField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(commentFileSelectButton)
                     .addComponent(useCommentLocalCheckBox))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@@ -250,6 +266,22 @@ public class MainFrame extends javax.swing.JFrame {
         pack();
     }// </editor-fold>//GEN-END:initComponents
 
+private void useMovieLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useMovieLocalCheckBoxItemStateChanged
+    final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
+    movieFileSelectButton.setEnabled(useLocal);
+}//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged
+
+private void useCommentLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useCommentLocalCheckBoxItemStateChanged
+    final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
+    commentFileSelectButton.setEnabled(useLocal);
+}//GEN-LAST:event_useCommentLocalCheckBoxItemStateChanged
+
+private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged
+    final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED);
+    outputFileField.setEnabled(convert);
+    outputFileSelectButton.setEnabled(convert);
+}//GEN-LAST:event_outputConvertCheckBoxItemStateChanged
+
     /**
      * @param args the command line arguments
      */
@@ -304,7 +336,24 @@ public class MainFrame extends javax.swing.JFrame {
     // End of variables declaration//GEN-END:variables
 
     private void initInputPanel() {
-//        Properties.INSTANCE.getUseMovieFileLocal();
+        idField.setText("");
+
+        final Properties p = Properties.INSTANCE;
+
+        final boolean movieLocal = p.getUseMovieFileLocal();
+        useMovieLocalCheckBox.setSelected(movieLocal);
+        movieFileSelectButton.setEnabled(movieLocal);
+
+        final boolean commentLocal = p.getCommentFileLocal();
+        useCommentLocalCheckBox.setSelected(commentLocal);
+        commentFileSelectButton.setEnabled(commentLocal);
+
+        final boolean convert = p.getOutputConvert();
+        outputConvertCheckBox.setSelected(convert);
+        outputFileField.setEnabled(convert);
+        outputFileField.setText(p.getOutputFile().toString());
+        outputFileSelectButton.setEnabled(convert);
+
     }
 
     private class DownloadListTransferHandler extends TransferHandler {