OSDN Git Service

コンフィグ読み書きテストケース
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / MainFrame.java
index 884014a..eeb464e 100644 (file)
@@ -1,26 +1,28 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-/*
  * MainFrame.java
  *
  * Created on 2011/05/28, 18:14:51
  */
 package yukihane.inqubus.gui;
 
+import java.awt.ItemSelectable;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
+import java.awt.event.ItemEvent;
 import java.io.File;
+import java.io.FilenameFilter;
 import java.util.Collection;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import javax.swing.JButton;
+import javax.swing.JTextField;
 import javax.swing.TransferHandler;
 import javax.swing.UIManager;
 import javax.swing.UIManager.LookAndFeelInfo;
-import yukihane.inqubus.model.SourceTypeComboBoxModel;
+import yukihane.inqubus.config.Properties;
 import yukihane.inqubus.model.Target;
 import yukihane.inqubus.model.TargetsTableModel;
 
@@ -30,11 +32,14 @@ import yukihane.inqubus.model.TargetsTableModel;
  */
 public class MainFrame extends javax.swing.JFrame {
 
+    private static final long serialVersionUID = 1L;
+    private static final Logger logger = Logger.getLogger(MainFrame.class.getName());
     private final TargetsTableModel targetModel = new TargetsTableModel();
 
     /** Creates new form MainFrame */
     public MainFrame() {
         initComponents();
+        initInputPanel();
         jPanel1.setTransferHandler(new DownloadListTransferHandler());
         jTable1.setTransferHandler(new TableTransferHandler());
     }
@@ -56,18 +61,20 @@ public class MainFrame extends javax.swing.JFrame {
         jButton3 = new javax.swing.JButton();
         jButton4 = new javax.swing.JButton();
         jPanel3 = new javax.swing.JPanel();
-        jButton1 = new javax.swing.JButton();
-        jLabel1 = new javax.swing.JLabel();
-        jLabel2 = new javax.swing.JLabel();
-        jLabel3 = new javax.swing.JLabel();
-        jComboBox1 = new javax.swing.JComboBox();
-        jComboBox2 = new javax.swing.JComboBox();
-        jComboBox3 = new javax.swing.JComboBox();
-        jCheckBox1 = new javax.swing.JCheckBox();
-        jCheckBox2 = new javax.swing.JCheckBox();
-        jTextField1 = new javax.swing.JTextField();
-        jTextField2 = new javax.swing.JTextField();
-        jTextField3 = new javax.swing.JTextField();
+        idLabel = new javax.swing.JLabel();
+        idField = new javax.swing.JTextField();
+        movieLabel = new javax.swing.JLabel();
+        useMovieLocalCheckBox = new javax.swing.JCheckBox();
+        movieFileField = new javax.swing.JTextField();
+        movieFileSelectButton = new javax.swing.JButton();
+        commentLabel = new javax.swing.JLabel();
+        useCommentLocalCheckBox = new javax.swing.JCheckBox();
+        commentFileField = new javax.swing.JTextField();
+        commentFileSelectButton = new javax.swing.JButton();
+        outputLabel = new javax.swing.JLabel();
+        outputConvertCheckBox = new javax.swing.JCheckBox();
+        outputFileField = new javax.swing.JTextField();
+        applyButton = new javax.swing.JButton();
         jMenuBar1 = new javax.swing.JMenuBar();
         jMenu1 = new javax.swing.JMenu();
         jMenu2 = new javax.swing.JMenu();
@@ -114,29 +121,46 @@ public class MainFrame extends javax.swing.JFrame {
 
         jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
 
-        jButton1.setText("適用");
-
-        jLabel1.setText("動画");
+        idLabel.setText("ID");
 
-        jLabel2.setText("コメント");
+        idField.addFocusListener(new java.awt.event.FocusAdapter() {
+            public void focusLost(java.awt.event.FocusEvent evt) {
+                idFieldFocusLost(evt);
+            }
+        });
 
-        jLabel3.setText("投コメ");
+        movieLabel.setText("動画");
 
-        jComboBox1.setModel(new SourceTypeComboBoxModel());
+        useMovieLocalCheckBox.setText("local");
+        useMovieLocalCheckBox.addItemListener(new java.awt.event.ItemListener() {
+            public void itemStateChanged(java.awt.event.ItemEvent evt) {
+                useMovieLocalCheckBoxItemStateChanged(evt);
+            }
+        });
 
-        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
+        movieFileSelectButton.setText("...");
 
-        jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
+        commentLabel.setText("コメント");
 
-        jCheckBox1.setText("変換を行う");
+        useCommentLocalCheckBox.setText("local");
+        useCommentLocalCheckBox.addItemListener(new java.awt.event.ItemListener() {
+            public void itemStateChanged(java.awt.event.ItemEvent evt) {
+                useMovieLocalCheckBoxItemStateChanged(evt);
+            }
+        });
 
-        jCheckBox2.setText("自動で処理開始");
+        commentFileSelectButton.setText("...");
 
-        jTextField1.setText("jTextField1");
+        outputLabel.setText("出力");
 
-        jTextField2.setText("jTextField2");
+        outputConvertCheckBox.setText("変換");
+        outputConvertCheckBox.addItemListener(new java.awt.event.ItemListener() {
+            public void itemStateChanged(java.awt.event.ItemEvent evt) {
+                outputConvertCheckBoxItemStateChanged(evt);
+            }
+        });
 
-        jTextField3.setText("jTextField3");
+        applyButton.setText("適用");
 
         javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
         jPanel3.setLayout(jPanel3Layout);
@@ -147,29 +171,32 @@ public class MainFrame extends javax.swing.JFrame {
                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(jPanel3Layout.createSequentialGroup()
                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                            .addComponent(jLabel3)
-                            .addComponent(jLabel2)
-                            .addComponent(jLabel1))
+                            .addComponent(commentLabel)
+                            .addComponent(movieLabel)
+                            .addComponent(idLabel)
+                            .addComponent(outputLabel))
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                             .addGroup(jPanel3Layout.createSequentialGroup()
-                                .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addComponent(useMovieLocalCheckBox)
                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                                .addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE))
-                            .addGroup(jPanel3Layout.createSequentialGroup()
-                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addComponent(movieFileField, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)
                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                                .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 352, Short.MAX_VALUE))
-                            .addGroup(jPanel3Layout.createSequentialGroup()
-                                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                                .addComponent(movieFileSelectButton))
+                            .addComponent(idField, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
+                                        .addComponent(outputConvertCheckBox)
+                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                        .addComponent(outputFileField, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
+                                    .addGroup(jPanel3Layout.createSequentialGroup()
+                                        .addComponent(useCommentLocalCheckBox)
+                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                                        .addComponent(commentFileField, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)))
                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                                .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE))))
-                    .addGroup(jPanel3Layout.createSequentialGroup()
-                        .addComponent(jCheckBox1)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
-                        .addComponent(jCheckBox2)
-                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 209, Short.MAX_VALUE)
-                        .addComponent(jButton1)))
+                                .addComponent(commentFileSelectButton))))
+                    .addComponent(applyButton, javax.swing.GroupLayout.Alignment.TRAILING))
                 .addContainerGap())
         );
         jPanel3Layout.setVerticalGroup(
@@ -177,24 +204,27 @@ public class MainFrame extends javax.swing.JFrame {
             .addGroup(jPanel3Layout.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(jLabel1)
-                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addComponent(idField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(idLabel))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(jLabel2)
-                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+                    .addComponent(movieLabel)
+                    .addComponent(movieFileField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(movieFileSelectButton)
+                    .addComponent(useMovieLocalCheckBox))
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(jLabel3)
-                    .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
-                .addGap(18, 18, 18)
+                    .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)
-                    .addComponent(jCheckBox1)
-                    .addComponent(jCheckBox2)
-                    .addComponent(jButton1))
+                    .addComponent(outputLabel)
+                    .addComponent(outputFileField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addComponent(outputConvertCheckBox))
+                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+                .addComponent(applyButton)
                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
         );
 
@@ -205,8 +235,8 @@ public class MainFrame extends javax.swing.JFrame {
             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
-                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
                     .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
                     .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                 .addContainerGap())
         );
@@ -214,12 +244,12 @@ public class MainFrame extends javax.swing.JFrame {
             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                 .addContainerGap()
-                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 188, Short.MAX_VALUE)
+                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                 .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addContainerGap())
+                .addGap(24, 24, 24))
         );
 
         jMenu1.setText("File");
@@ -244,6 +274,96 @@ public class MainFrame extends javax.swing.JFrame {
         pack();
     }// </editor-fold>//GEN-END:initComponents
 
+    private File searchFileMatchId(final File dir, final String id) throws UnsupportedOperationException {
+        // TODO 候補は複数返すようにして、その後の対処は呼び出しもとで行ってもらった方が良いかも
+        if (id.isEmpty()) {
+            return null;
+        }
+
+        final File[] lists = dir.listFiles(new FilenameFilter() {
+
+            final Pattern pattern = Pattern.compile(id + "\\D");
+
+            @Override
+            public boolean accept(File dir, String name) {
+                return pattern.matcher(name).find();
+            }
+        });
+
+        if (lists.length == 1) {
+            return lists[0];
+        } else if (lists.length > 1) {
+            throw new UnsupportedOperationException();
+        } else {
+            return null;
+        }
+    }
+
+private void useMovieLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useMovieLocalCheckBoxItemStateChanged
+    final Properties p = Properties.INSTANCE;
+
+    final ItemSelectable source = evt.getItemSelectable();
+
+    JButton btn;
+    JTextField field;
+    File dir;
+    if (source == useMovieLocalCheckBox) {
+        btn = movieFileSelectButton;
+        field = movieFileField;
+        dir = new File(p.getVideoDir());
+    } else {
+        btn = commentFileSelectButton;
+        field = commentFileField;
+        dir = new File(p.getCommentDir());
+    }
+
+    final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
+    btn.setEnabled(useLocal);
+
+    String text;
+    if (useLocal) {
+        final File f = searchFileMatchId(dir, idField.getText());
+        if (f != null) {
+            text = f.getPath();
+        } else {
+            text = "";
+        }
+    } else {
+        text = p.getVideoFileNamePattern();
+    }
+    field.setText(text);
+}//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged
+
+private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged
+    final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED);
+    outputFileField.setEnabled(convert);
+}//GEN-LAST:event_outputConvertCheckBoxItemStateChanged
+
+private void idFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_idFieldFocusLost
+    final Properties p = Properties.INSTANCE;
+    final String id = idField.getText();
+    if (id.isEmpty()) {
+        return;
+    }
+
+    if (useMovieLocalCheckBox.isSelected() && movieFileField.getText().isEmpty()) {
+        final File dir = new File(p.getVideoDir());
+        final File file = searchFileMatchId(dir, id);
+        if (file != null) {
+            movieFileField.setText(file.getPath());
+        }
+    }
+
+    if (useCommentLocalCheckBox.isSelected() && commentFileField.getText().isEmpty()) {
+        final File dir = new File(p.getCommentDir());
+        final File file = searchFileMatchId(dir, id);
+        if (file != null) {
+            commentFileField.setText(file.getPath());
+        }
+    }
+
+}//GEN-LAST:event_idFieldFocusLost
+
     /**
      * @param args the command line arguments
      */
@@ -269,18 +389,15 @@ public class MainFrame extends javax.swing.JFrame {
         });
     }
     // Variables declaration - do not modify//GEN-BEGIN:variables
-    private javax.swing.JButton jButton1;
+    private javax.swing.JButton applyButton;
+    private javax.swing.JTextField commentFileField;
+    private javax.swing.JButton commentFileSelectButton;
+    private javax.swing.JLabel commentLabel;
+    private javax.swing.JTextField idField;
+    private javax.swing.JLabel idLabel;
     private javax.swing.JButton jButton2;
     private javax.swing.JButton jButton3;
     private javax.swing.JButton jButton4;
-    private javax.swing.JCheckBox jCheckBox1;
-    private javax.swing.JCheckBox jCheckBox2;
-    private javax.swing.JComboBox jComboBox1;
-    private javax.swing.JComboBox jComboBox2;
-    private javax.swing.JComboBox jComboBox3;
-    private javax.swing.JLabel jLabel1;
-    private javax.swing.JLabel jLabel2;
-    private javax.swing.JLabel jLabel3;
     private javax.swing.JMenu jMenu1;
     private javax.swing.JMenu jMenu2;
     private javax.swing.JMenuBar jMenuBar1;
@@ -289,13 +406,45 @@ public class MainFrame extends javax.swing.JFrame {
     private javax.swing.JPanel jPanel3;
     private javax.swing.JScrollPane jScrollPane1;
     private javax.swing.JTable jTable1;
-    private javax.swing.JTextField jTextField1;
-    private javax.swing.JTextField jTextField2;
-    private javax.swing.JTextField jTextField3;
+    private javax.swing.JTextField movieFileField;
+    private javax.swing.JButton movieFileSelectButton;
+    private javax.swing.JLabel movieLabel;
+    private javax.swing.JCheckBox outputConvertCheckBox;
+    private javax.swing.JTextField outputFileField;
+    private javax.swing.JLabel outputLabel;
+    private javax.swing.JCheckBox useCommentLocalCheckBox;
+    private javax.swing.JCheckBox useMovieLocalCheckBox;
     // End of variables declaration//GEN-END:variables
 
+    private void initInputPanel() {
+        idField.setText("");
+
+        final Properties p = Properties.INSTANCE;
+
+        final boolean movieLocal = p.getVideoUseLocal();
+        useMovieLocalCheckBox.setSelected(movieLocal);
+        movieFileSelectButton.setEnabled(movieLocal);
+        if (!movieLocal) {
+            movieFileField.setText(p.getVideoFileNamePattern());
+        }
+
+        final boolean commentLocal = p.getCommentUseLocal();
+        useCommentLocalCheckBox.setSelected(commentLocal);
+        commentFileSelectButton.setEnabled(commentLocal);
+        if (!commentLocal) {
+            commentFileField.setText(p.getCommentFileNamePattern());
+        }
+
+        final boolean convert = p.getOutputEnable();
+        outputConvertCheckBox.setSelected(convert);
+        outputFileField.setEnabled(convert);
+        outputFileField.setText(p.getOutputFileNamePattern());
+
+    }
+
     private class DownloadListTransferHandler extends TransferHandler {
 
+        private static final long serialVersionUID = 1L;
         private final Pattern movieIdPattern = Pattern.compile("(\\w\\w\\d+)");
 
         @Override
@@ -313,7 +462,8 @@ public class MainFrame extends javax.swing.JFrame {
             try {
                 Transferable transferable = support.getTransferable();
                 if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
-                    List<File> data = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
+                    @SuppressWarnings("unchecked")
+                    final List<File> data = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
                     Collection<Target> targets = Target.from(data);
                     targetModel.addTarget(targets);
                 } else if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
@@ -330,13 +480,14 @@ public class MainFrame extends javax.swing.JFrame {
                 }
                 return false;
             } catch (Exception e) {
-                e.printStackTrace();
+                logger.log(Level.SEVERE, null, e);
                 return false;
             }
         }
     }
 
     private class TableTransferHandler extends DownloadListTransferHandler {
+        private static final long serialVersionUID = 1L;
 
         @Override
         public boolean canImport(TransferHandler.TransferSupport support) {