OSDN Git Service

2a058c0a76e8ea36096e524f4563032e608351c9
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / MainFrame.java
1 /*
2  * MainFrame.java
3  *
4  * Created on 2011/05/28, 18:14:51
5  */
6 package yukihane.inqubus.gui;
7
8 import java.awt.Image;
9 import java.awt.ItemSelectable;
10 import java.awt.Toolkit;
11 import java.awt.datatransfer.DataFlavor;
12 import java.awt.datatransfer.Transferable;
13 import java.awt.event.ActionEvent;
14 import java.awt.event.ActionListener;
15 import java.awt.event.ItemEvent;
16 import java.awt.event.ItemListener;
17 import java.awt.event.KeyEvent;
18 import java.beans.PropertyChangeEvent;
19 import java.beans.PropertyChangeListener;
20 import java.io.File;
21 import java.io.FilenameFilter;
22 import java.io.IOException;
23 import java.net.URL;
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.List;
27 import java.util.logging.Level;
28 import java.util.logging.Logger;
29 import java.util.regex.Matcher;
30 import java.util.regex.Pattern;
31 import javax.swing.BorderFactory;
32 import javax.swing.DropMode;
33 import javax.swing.GroupLayout;
34 import javax.swing.GroupLayout.Alignment;
35 import javax.swing.JButton;
36 import javax.swing.JCheckBox;
37 import javax.swing.JFrame;
38 import javax.swing.JLabel;
39 import javax.swing.JMenu;
40 import javax.swing.JMenuBar;
41 import javax.swing.JMenuItem;
42 import javax.swing.JOptionPane;
43 import javax.swing.JPanel;
44 import javax.swing.JScrollPane;
45 import javax.swing.JTabbedPane;
46 import javax.swing.JTable;
47 import javax.swing.JTextField;
48 import javax.swing.KeyStroke;
49 import javax.swing.LayoutStyle.ComponentPlacement;
50 import javax.swing.SwingUtilities;
51 import javax.swing.TransferHandler;
52 import javax.swing.WindowConstants;
53 import javax.swing.border.BevelBorder;
54 import org.apache.commons.lang.StringUtils;
55 import org.apache.commons.lang.builder.ToStringBuilder;
56 import saccubus.FfmpegOption;
57 import saccubus.MainFrame_AboutBox;
58 import saccubus.OptionComboBoxModel;
59 import saccubus.util.WayBackTimeParser;
60 import saccubus.worker.impl.convert.ConvertProgress;
61 import saccubus.worker.impl.download.DownloadProgress;
62 import saccubus.worker.WorkerListener;
63 import saccubus.worker.impl.convert.ConvertResult;
64 import saccubus.worker.impl.download.DownloadResult;
65 import saccubus.worker.profile.CommentProfile;
66 import saccubus.worker.profile.ConvertProfile;
67 import saccubus.worker.profile.DownloadProfile;
68 import saccubus.worker.profile.FfmpegProfile;
69 import saccubus.worker.profile.GeneralProfile;
70 import saccubus.worker.profile.LoginProfile;
71 import saccubus.worker.profile.OutputProfile;
72 import saccubus.worker.profile.ProxyProfile;
73 import saccubus.worker.profile.VideoProfile;
74 import yukihane.Util;
75 import yukihane.inqubus.Config;
76 import yukihane.inqubus.manager.RequestProcess;
77 import yukihane.inqubus.manager.TaskKind;
78 import yukihane.inqubus.manager.TaskManage;
79 import yukihane.inqubus.manager.TaskManageListener;
80 import yukihane.inqubus.manager.TaskStatus;
81 import yukihane.inqubus.model.Target;
82 import yukihane.inqubus.model.TargetsTableModel;
83
84 /**
85  *
86  * @author yuki
87  */
88 public class MainFrame extends JFrame {
89
90     private static final long serialVersionUID = 1L;
91     private static final Logger logger = Logger.getLogger(MainFrame.class.getName());
92     private static final String ID_FIELD_TOOLTIP = "動画のIDまたはURLを入力します。";
93     private static final String FILE_LOCALBUTTON_TOOLTIP
94             = "ダウンロードする場合はチェックを外します。ローカルファイルを使用する場合はチェックを入れます。";
95     private static final String FILE_INPUTFIELD_TOOLTIP
96             = "ダウンロードする場合はファイル命名規則を入力します。"
97             + "ローカルファイルを使用する場合はパスを含むファイル名を入力します。";
98     private static final String FILE_OUTPUTFIELD_TOOLTIP
99             = "ファイル命名規則入力します。";
100     private final TargetsTableModel targetModel = new TargetsTableModel();
101     private final TaskManage taskManager;
102
103     /** Creates new form MainFrame */
104     public MainFrame() {
105         final URL url = MainFrame_AboutBox.class.getResource("icon.png");
106         final Image icon1 = Toolkit.getDefaultToolkit().createImage(url);
107         final URL url32 = MainFrame_AboutBox.class.getResource("icon32.png");
108         final Image icon2 = Toolkit.getDefaultToolkit().createImage(url32);
109         final List<Image> images = new ArrayList<Image>(2);
110         images.add(icon1);
111         images.add(icon2);
112         setIconImages(images);
113
114         final JPanel pnlMain = new JPanel();
115         final JScrollPane scrDisplay = new JScrollPane();
116         tblDisplay = new JTable(targetModel, new TargetsColumnModel());
117         tblDisplay.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
118         final JPanel pnlButton = new JPanel();
119         final JTabbedPane tbpInput = new JTabbedPane();
120         final JPanel pnlInputMain = new JPanel();
121         final JLabel lblId = new JLabel();
122         fldId.setToolTipText(ID_FIELD_TOOLTIP);
123         final JLabel lblVideo = new JLabel();
124         cbVideoLocal = new JCheckBox();
125         cbVideoLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
126         fldVideo = new JTextField();
127         fldVideo.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
128         btnVideo = new JButton();
129         final JLabel lblComment = new JLabel();
130
131         fldBackLog.setToolTipText("YYYY/MM/DD hh:mm:ss形式、あるいは1970/01/01からの経過秒を入力します。");
132         cbBackLog.addItemListener(new ItemListener() {
133
134             @Override
135             public void itemStateChanged(ItemEvent e) {
136                 final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
137                 fldBackLog.setEnabled(selected);
138             }
139         });
140         cbBackLog.addPropertyChangeListener("enabled", new PropertyChangeListener() {
141
142             @Override
143             public void propertyChange(PropertyChangeEvent evt) {
144                 final boolean enabled = ((Boolean) evt.getNewValue()).booleanValue();
145                 final boolean fldEnabled = enabled ? cbBackLog.isSelected() : false;
146                 fldBackLog.setEnabled(fldEnabled);
147             }
148         });
149         cbBackLogReduce.setToolTipText("「コメントの量を減らす」場合はチェックを付けます。");
150
151         cbCommentLocal = new JCheckBox();
152         cbCommentLocal.setToolTipText(FILE_LOCALBUTTON_TOOLTIP);
153         cbCommentLocal.addItemListener(new ItemListener() {
154
155             @Override
156             public void itemStateChanged(ItemEvent e) {
157                 final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
158                 cbBackLogReduce.setEnabled(!selected);
159                 cbBackLog.setEnabled(!selected);
160             }
161         });
162         fldComment = new JTextField();
163         fldComment.setToolTipText(FILE_INPUTFIELD_TOOLTIP);
164         btnComment = new JButton();
165         final JLabel lblOutput = new JLabel();
166         cbOutputEnable = new JCheckBox();
167         fldOutput = new JTextField();
168         fldOutput.setToolTipText(FILE_OUTPUTFIELD_TOOLTIP);
169
170         setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
171
172         btnStop.addActionListener(new StopActionListener());
173         btnApply.addActionListener(new ApplyActionListener());
174
175         pnlMain.setBorder(BorderFactory.createEtchedBorder());
176
177         tblDisplay.setDropMode(DropMode.INSERT_ROWS);
178         scrDisplay.setViewportView(tblDisplay);
179
180         pnlButton.setBorder(BorderFactory.createEtchedBorder());
181
182         GroupLayout gl_pnlButton = new GroupLayout(pnlButton);
183         pnlButton.setLayout(gl_pnlButton);
184         gl_pnlButton.setHorizontalGroup(
185             gl_pnlButton.createParallelGroup(Alignment.LEADING)
186             .addGroup(gl_pnlButton.createSequentialGroup()
187                 .addContainerGap()
188                 .addComponent(btnStart)
189                 .addPreferredGap(ComponentPlacement.RELATED)
190                 .addComponent(btnStop)
191                 .addPreferredGap(ComponentPlacement.RELATED, 250, Short.MAX_VALUE)
192                 .addComponent(btnDeselect)
193                 .addContainerGap())
194         );
195         gl_pnlButton.setVerticalGroup(
196             gl_pnlButton.createParallelGroup(Alignment.LEADING)
197             .addGroup(gl_pnlButton.createSequentialGroup()
198                 .addContainerGap()
199                 .addGroup(gl_pnlButton.createParallelGroup(Alignment.BASELINE)
200                     .addComponent(btnStart)
201                     .addComponent(btnStop)
202                     .addComponent(btnDeselect))
203                 .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
204         );
205
206         lblId.setText("ID");
207
208         fldId.addFocusListener(new java.awt.event.FocusAdapter() {
209
210             public void focusLost(java.awt.event.FocusEvent evt) {
211                 idFieldFocusLost(evt);
212             }
213         });
214
215         lblVideo.setText("動画");
216
217         cbVideoLocal.setText("local");
218         cbVideoLocal.addItemListener(new java.awt.event.ItemListener() {
219
220             public void itemStateChanged(java.awt.event.ItemEvent evt) {
221                 useMovieLocalCheckBoxItemStateChanged(evt);
222             }
223         });
224
225         btnVideo.setText("...");
226
227         lblComment.setText("コメント");
228
229         cbCommentLocal.setText("local");
230         cbCommentLocal.addItemListener(new java.awt.event.ItemListener() {
231
232             public void itemStateChanged(java.awt.event.ItemEvent evt) {
233                 useMovieLocalCheckBoxItemStateChanged(evt);
234             }
235         });
236
237         btnComment.setText("...");
238
239         lblOutput.setText("出力");
240
241         cbOutputEnable.setText("変換");
242         cbOutputEnable.addItemListener(new java.awt.event.ItemListener() {
243
244             public void itemStateChanged(java.awt.event.ItemEvent evt) {
245                 outputConvertCheckBoxItemStateChanged(evt);
246             }
247         });
248
249
250         final GroupLayout glInputMain = new GroupLayout(pnlInputMain);
251         pnlInputMain.setLayout(glInputMain);
252         glInputMain.setHorizontalGroup(
253             glInputMain.createParallelGroup(Alignment.LEADING)
254             .addGroup(glInputMain.createSequentialGroup()
255                 .addContainerGap()
256                 .addComponent(lblId)
257                 .addPreferredGap(ComponentPlacement.RELATED)
258                 .addComponent(fldId, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE)
259                 .addPreferredGap(ComponentPlacement.UNRELATED)
260                 .addComponent(cbBackLogReduce)
261                 .addPreferredGap(ComponentPlacement.UNRELATED)
262                 .addComponent(cbBackLog)
263                 .addPreferredGap(ComponentPlacement.RELATED)
264                 .addComponent(fldBackLog, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
265                 .addContainerGap()
266             )
267             .addGroup(glInputMain.createSequentialGroup()
268                 .addContainerGap()
269                 .addGroup(glInputMain.createParallelGroup(Alignment.LEADING)
270                     .addGroup(glInputMain.createSequentialGroup()
271                         .addGroup(glInputMain.createParallelGroup(Alignment.LEADING)
272                             .addComponent(lblVideo)
273                             .addComponent(lblComment)
274                             .addComponent(lblOutput))
275                         .addPreferredGap(ComponentPlacement.RELATED)
276                         .addGroup(glInputMain.createParallelGroup(Alignment.LEADING)
277                             .addGroup(glInputMain.createSequentialGroup()
278                                 .addComponent(cbVideoLocal)
279                                 .addPreferredGap(ComponentPlacement.RELATED)
280                                 .addComponent(fldVideo, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)
281                                 .addPreferredGap(ComponentPlacement.RELATED)
282                                 .addComponent(btnVideo))
283                             .addGroup(Alignment.TRAILING, glInputMain.createSequentialGroup()
284                                 .addGroup(glInputMain.createParallelGroup(Alignment.TRAILING)
285                                     .addGroup(Alignment.LEADING, glInputMain.createSequentialGroup()
286                                         .addComponent(cbOutputEnable)
287                                         .addPreferredGap(ComponentPlacement.RELATED)
288                                         .addComponent(fldOutput, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
289                                     .addGroup(glInputMain.createSequentialGroup()
290                                         .addComponent(cbCommentLocal)
291                                         .addPreferredGap(ComponentPlacement.RELATED)
292                                         .addComponent(fldComment, GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE)))
293                                 .addPreferredGap(ComponentPlacement.RELATED)
294                                 .addComponent(btnComment))))
295                     )
296                 .addContainerGap())
297         );
298         glInputMain.setVerticalGroup(
299             glInputMain.createParallelGroup(Alignment.LEADING)
300             .addGroup(glInputMain.createSequentialGroup()
301                 .addContainerGap()
302                 .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
303                     .addComponent(fldId, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
304                     .addComponent(lblId)
305                     .addComponent(cbBackLogReduce)
306                     .addComponent(cbBackLog)
307                     .addComponent(fldBackLog)
308                 )
309                 .addPreferredGap(ComponentPlacement.RELATED)
310                 .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
311                     .addComponent(lblVideo)
312                     .addComponent(fldVideo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
313                     .addComponent(btnVideo)
314                     .addComponent(cbVideoLocal))
315                 .addPreferredGap(ComponentPlacement.RELATED)
316                 .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
317                     .addComponent(lblComment)
318                     .addComponent(fldComment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
319                     .addComponent(btnComment)
320                     .addComponent(cbCommentLocal))
321                 .addPreferredGap(ComponentPlacement.RELATED)
322                 .addGroup(glInputMain.createParallelGroup(Alignment.BASELINE)
323                     .addComponent(lblOutput)
324                     .addComponent(fldOutput, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
325                     .addComponent(cbOutputEnable))
326             )
327         );
328
329         // ffmpeg入力パネル
330         pnlInputFfmpeg.fldFfmpegOptionResizeWidth.setEnabled(false);
331         pnlInputFfmpeg.fldFfmpegOptionResizeHeight.setEnabled(false);
332         pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(false);
333         pnlInputFfmpeg.cbFfmpegOptionResize.addItemListener(new ItemListener() {
334
335             @Override
336             public void itemStateChanged(ItemEvent e) {
337                 final boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
338                 pnlInputFfmpeg.fldFfmpegOptionResizeWidth.setEnabled(selected);
339                 pnlInputFfmpeg.fldFfmpegOptionResizeHeight.setEnabled(selected);
340                 pnlInputFfmpeg.cbFfmpegOptionKeepAspect.setEnabled(selected);
341             }
342         });
343
344
345         tbpInput.add("メイン", pnlInputMain);
346         tbpInput.add("ffmpeg", pnlInputFfmpeg);
347
348         // 入力部のボタンやメッセージ表示部
349         fldInputMessage.setEditable(false);
350         fldInputMessage.setEnabled(false);
351         fldInputMessage.setBorder(BorderFactory.createEmptyBorder());
352
353         final JPanel pnlInputButton = new JPanel();
354         final GroupLayout glInputButton = new GroupLayout(pnlInputButton);
355         pnlInputButton.setLayout(glInputButton);
356         glInputButton.setHorizontalGroup(glInputButton.createSequentialGroup()
357             .addContainerGap()
358             .addComponent(fldInputMessage, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
359             .addPreferredGap(ComponentPlacement.UNRELATED)
360             .addComponent(btnApply)
361             .addContainerGap()
362         );
363         glInputButton.setVerticalGroup(glInputButton.createSequentialGroup()
364             .addContainerGap()
365             .addGroup(glInputButton.createParallelGroup(Alignment.BASELINE)
366                 .addComponent(fldInputMessage, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
367                 .addComponent(btnApply)
368             )
369             .addContainerGap()
370         );
371
372         // 画面下半分の入力部分
373         final JPanel pnlInputAll = new JPanel();
374         pnlInputAll.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
375         final GroupLayout glInputAll = new GroupLayout(pnlInputAll);
376         pnlInputAll.setLayout(glInputAll);
377         glInputAll.setHorizontalGroup(glInputAll.createParallelGroup()
378             .addComponent(tbpInput)
379             .addComponent(pnlInputButton)
380         );
381         glInputAll.setVerticalGroup(glInputAll.createSequentialGroup()
382             .addComponent(tbpInput)
383             .addComponent(pnlInputButton)
384         );
385
386         GroupLayout gl_pnlMain = new GroupLayout(pnlMain);
387         pnlMain.setLayout(gl_pnlMain);
388         gl_pnlMain.setHorizontalGroup(
389             gl_pnlMain.createParallelGroup(Alignment.LEADING)
390             .addGroup(Alignment.TRAILING, gl_pnlMain.createSequentialGroup()
391                 .addContainerGap()
392                 .addGroup(gl_pnlMain.createParallelGroup(Alignment.TRAILING)
393                     .addComponent(scrDisplay, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
394                     .addComponent(pnlButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
395                     .addComponent(pnlInputAll, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
396                 )
397                 .addContainerGap())
398         );
399         gl_pnlMain.setVerticalGroup(
400             gl_pnlMain.createParallelGroup(Alignment.LEADING)
401             .addGroup(Alignment.TRAILING, gl_pnlMain.createSequentialGroup()
402                 .addContainerGap()
403                 .addComponent(scrDisplay, GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
404                 .addPreferredGap(ComponentPlacement.RELATED)
405                 .addComponent(pnlButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
406                 .addPreferredGap(ComponentPlacement.RELATED)
407                 .addComponent(pnlInputAll, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
408                 .addContainerGap()
409             )
410         );
411
412
413         JMenuBar menuBar = initMenuBar();
414         setJMenuBar(menuBar);
415
416         GroupLayout layout = new GroupLayout(getContentPane());
417         getContentPane().setLayout(layout);
418         layout.setHorizontalGroup(
419             layout.createParallelGroup(Alignment.LEADING)
420             .addComponent(pnlMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
421         );
422         layout.setVerticalGroup(
423             layout.createParallelGroup(Alignment.LEADING)
424             .addComponent(pnlMain, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
425         );
426
427         pack();
428         initInputPanel();
429         pnlMain.setTransferHandler(new DownloadListTransferHandler());
430         tblDisplay.setTransferHandler(new TableTransferHandler());
431
432         final Config p = Config.INSTANCE;
433         final int thDownload = p.getSystemDownloadThread();
434         final int secDownload = p.getSystemDownloadWait();
435         final int thConvert = p.getSystemConvertThread();
436         taskManager = new TaskManage(thDownload, secDownload,thConvert, new GuiTaskManageListener());
437     }
438
439     private class GuiTaskManageListener implements TaskManageListener {
440
441         @Override
442         public void process(final int id, final TaskKind kind, final TaskStatus status, final double percentage,
443                 final String message) {
444             SwingUtilities.invokeLater(new Runnable() {
445
446                 @Override
447                 public void run() {
448                     targetModel.setStatus(id, kind, status, percentage, message);
449                 }
450             });
451         }
452     }
453
454     private class StopActionListener implements ActionListener {
455
456         @Override
457         public void actionPerformed(ActionEvent e) {
458             final int row = tblDisplay.getSelectedRow();
459             final Target t = targetModel.getTarget(row);
460             final boolean res = taskManager.cancel(t.getRowId());
461             logger.log(Level.FINE, "停止: {0} {1}", new Object[]{t.getVideoId(), res});
462             if (res) {
463                 targetModel.setStatus(t.getRowId(), null, TaskStatus.CANCELLED, -1.0, "キャンセル");
464             }
465         }
466     }
467
468     private class ApplyActionListener implements ActionListener {
469
470         @Override
471         public void actionPerformed(ActionEvent e) {
472             try {
473                 final DownloadProfile downProf = new InqubusDownloadProfile();
474                 final String id = Util.getVideoId(fldId.getText());
475                 final InqubusConvertProfile convProf = new InqubusConvertProfile();
476                 logger.log(Level.INFO, downProf.toString());
477                 logger.log(Level.INFO, convProf.toString());
478                 final RequestProcess rp = new RequestProcess(downProf, id, convProf);
479                 taskManager.add(rp);
480                 targetModel.addTarget(new Target(rp));
481                 initInputPanel();
482             } catch (Throwable th) {
483                 logger.log(Level.SEVERE, null, th);
484                 JOptionPane.showMessageDialog(MainFrame.this, th.getMessage(), "中断しました", JOptionPane.ERROR_MESSAGE);
485             }
486         }
487     }
488
489     private File searchFileMatchId(final File dir, final String id) {
490         // TODO 候補は複数返すようにして、その後の対処は呼び出しもとで行ってもらった方が良いかも
491         if (id.isEmpty()) {
492             return null;
493         }
494
495         final File[] lists = dir.listFiles(new FilenameFilter() {
496
497             final Pattern pattern = Pattern.compile(id + "\\D");
498
499             @Override
500             public boolean accept(File dir, String name) {
501                 return pattern.matcher(name).find();
502             }
503         });
504
505         if (lists.length == 1) {
506             return lists[0];
507         } else if (lists.length > 1) {
508             throw new UnsupportedOperationException();
509         } else {
510             return null;
511         }
512     }
513
514     /**
515      * 動画, コメントの"local"チェックボックス更新時の処理.
516      */
517     private void useMovieLocalCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_useMovieLocalCheckBoxItemStateChanged
518         final Config p = Config.INSTANCE;
519
520         final ItemSelectable source = evt.getItemSelectable();
521
522         JButton btn;
523         JTextField field;
524         File dir;
525         if (source == cbVideoLocal) {
526             btn = btnVideo;
527             field = fldVideo;
528             dir = new File(p.getVideoDir());
529         } else {
530             btn = btnComment;
531             field = fldComment;
532             dir = new File(p.getCommentDir());
533         }
534
535         final boolean useLocal = (evt.getStateChange() == ItemEvent.SELECTED);
536         btn.setEnabled(useLocal);
537
538         String text;
539         if (useLocal) {
540             final File f = searchFileMatchId(dir, fldId.getText());
541             if (f != null) {
542                 text = f.getPath();
543             } else {
544                 text = "";
545             }
546         } else {
547             text = p.getVideoFileNamePattern();
548         }
549         field.setText(text);
550
551     }//GEN-LAST:event_useMovieLocalCheckBoxItemStateChanged
552
553     private void outputConvertCheckBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_outputConvertCheckBoxItemStateChanged
554         final boolean convert = (evt.getStateChange() == ItemEvent.SELECTED);
555         fldOutput.setEnabled(convert);
556     }//GEN-LAST:event_outputConvertCheckBoxItemStateChanged
557
558     private void idFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_idFieldFocusLost
559         final Config p = Config.INSTANCE;
560         final String id = fldId.getText();
561         if (id.isEmpty()) {
562             return;
563         }
564
565         if (cbVideoLocal.isSelected() && fldVideo.getText().isEmpty()) {
566             final File dir = new File(p.getVideoDir());
567             final File file = searchFileMatchId(dir, id);
568             if (file != null) {
569                 fldVideo.setText(file.getPath());
570             }
571         }
572
573         if (cbCommentLocal.isSelected() && fldComment.getText().isEmpty()) {
574             final File dir = new File(p.getCommentDir());
575             final File file = searchFileMatchId(dir, id);
576             if (file != null) {
577                 fldComment.setText(file.getPath());
578             }
579         }
580
581     }//GEN-LAST:event_idFieldFocusLost
582     // Variables declaration - do not modify//GEN-BEGIN:variables
583     private final JTable tblDisplay;
584     // ボタン領域
585     private final JButton btnStart = new JButton("開始");
586     private final JButton btnStop = new JButton("停止");
587     private final JButton btnDeselect = new JButton("選択解除");
588     // 入力領域 - メイン
589     private final JTextField fldId = new JTextField();
590     private final JCheckBox cbBackLogReduce = new JCheckBox("コメ数減少");
591     private final JCheckBox cbBackLog = new JCheckBox("過去ログ");
592     private final JTextField fldBackLog = new JTextField();
593     private final JCheckBox cbVideoLocal;
594     private final JTextField fldVideo;
595     private final JButton btnVideo;
596     private final JCheckBox cbCommentLocal;
597     private final JTextField fldComment;
598     private final JButton btnComment;
599     private final JCheckBox cbOutputEnable;
600     private final JTextField fldOutput;
601     // 入力領域 - ffmpeg
602     private final FfmpegParamPanel pnlInputFfmpeg = new FfmpegParamPanel();
603     // 適用
604     private final JTextField fldInputMessage = new JTextField();
605     private final JButton btnApply = new JButton("適用");
606     // End of variables declaration//GEN-END:variables
607
608     private void initInputPanel() {
609         initMainTab();
610         initFfmpegTab();
611     }
612
613     private void initMainTab() {
614         final Config p = Config.INSTANCE;
615
616         fldId.setText("");
617         fldBackLog.setEnabled(false);
618         cbBackLog.setEnabled(true);
619
620         final boolean movieLocal = p.getVideoUseLocal();
621         cbVideoLocal.setSelected(movieLocal);
622         btnVideo.setEnabled(movieLocal);
623         if (!movieLocal) {
624             fldVideo.setText(p.getVideoFileNamePattern());
625         }
626
627         final boolean commentLocal = p.getCommentUseLocal();
628         cbCommentLocal.setSelected(commentLocal);
629         btnComment.setEnabled(commentLocal);
630         if (!commentLocal) {
631             fldComment.setText(p.getCommentFileNamePattern());
632         }
633
634         final boolean convert = p.getOutputEnable();
635         cbOutputEnable.setSelected(convert);
636         fldOutput.setEnabled(convert);
637         fldOutput.setText(p.getOutputFileNamePattern());
638     }
639
640     private void initFfmpegTab() {
641         pnlInputFfmpeg.init(Config.INSTANCE);
642     }
643
644     private JMenuBar initMenuBar() {
645         final JMenuBar menuBar = new JMenuBar();
646
647         final JMenu mnFile = new JMenu("ファイル(F)");
648         menuBar.add(mnFile);
649
650         final JMenuItem itExit = new JMenuItem("終了(X)", KeyEvent.VK_X);
651         itExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
652         itExit.addActionListener(new ActionListener() {
653
654             @Override
655             public void actionPerformed(ActionEvent e) {
656                 throw new UnsupportedOperationException("Not supported yet.");
657             }
658         });
659         mnFile.add(itExit);
660
661         final JMenu mnTool = new JMenu("ツール(T)");
662         menuBar.add(mnTool);
663
664         final JMenuItem itOption = new JMenuItem("オプション(O)...", KeyEvent.VK_O);
665         // TODO ショートカットキー
666         itOption.addActionListener(new ActionListener() {
667
668             @Override
669             public void actionPerformed(ActionEvent e) {
670                 final yukihane.inqubus.gui.ConfigDialog dlg = new yukihane.inqubus.gui.ConfigDialog(MainFrame.this);
671                 dlg.setLocationRelativeTo(MainFrame.this);
672                 dlg.setModal(true);
673                 dlg.setVisible(true);
674             }
675         });
676         mnTool.add(itOption);
677
678         final JMenu mnHelp = new JMenu("ヘルプ(H)");
679         menuBar.add(mnHelp);
680
681         final JMenuItem itAbout = new JMenuItem("このソフトウェアについて(A)...", KeyEvent.VK_A);
682         itAbout.addActionListener(new ActionListener() {
683
684             @Override
685             public void actionPerformed(ActionEvent e) {
686                 MainFrame_AboutBox dlg = new MainFrame_AboutBox(MainFrame.this);
687                 dlg.pack();
688                 dlg.setLocationRelativeTo(MainFrame.this);
689                 dlg.setModal(true);
690                 dlg.setVisible(true);
691             }
692         });
693         mnHelp.add(itAbout);
694
695         return menuBar;
696     }
697
698     private class DownloadProgressListener implements WorkerListener<DownloadResult, DownloadProgress> {
699
700         @Override
701         public void process(DownloadProgress progress) {
702             throw new UnsupportedOperationException("Not supported yet.");
703         }
704
705         @Override
706         public void cancelled() {
707             throw new UnsupportedOperationException("Not supported yet.");
708         }
709
710         @Override
711         public void done(DownloadResult result) {
712             throw new UnsupportedOperationException("Not supported yet.");
713         }
714
715         @Override
716         public void error(Throwable th) {
717             throw new UnsupportedOperationException("Not supported yet.");
718         }
719     }
720
721     private class ConvertProgressListener implements WorkerListener<ConvertResult, ConvertProgress> {
722
723         @Override
724         public void process(ConvertProgress progress) {
725             throw new UnsupportedOperationException("Not supported yet.");
726         }
727
728         @Override
729         public void cancelled() {
730             throw new UnsupportedOperationException("Not supported yet.");
731         }
732
733         @Override
734         public void done(ConvertResult result) {
735             throw new UnsupportedOperationException("Not supported yet.");
736         }
737
738         @Override
739         public void error(Throwable th) {
740             throw new UnsupportedOperationException("Not supported yet.");
741         }
742     }
743
744
745
746     private class DownloadListTransferHandler extends TransferHandler {
747
748         private static final long serialVersionUID = 1L;
749         private final Pattern movieIdPattern = Pattern.compile("(\\w\\w\\d+)");
750
751         @Override
752         public boolean canImport(TransferHandler.TransferSupport support) {
753             Transferable transferable = support.getTransferable();
754             if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)
755                     || transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
756                 return true;
757             }
758             return false;
759         }
760
761         @Override
762         public boolean importData(TransferHandler.TransferSupport support) {
763 //            try {
764 //                Transferable transferable = support.getTransferable();
765 //                if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
766 //                    @SuppressWarnings("unchecked")
767 //                    final List<File> data = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
768 //                    Collection<Target> targets = Target.from(data);
769 //                    targetModel.addTarget(targets);
770 //                } else if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
771 //                    String data = (String) transferable.getTransferData(DataFlavor.stringFlavor);
772 //                    Matcher matcher = movieIdPattern.matcher(data);
773 //                    if (matcher.find()) {
774 //                        String movieId = matcher.group(1);
775 //                        Target target = Target.fromId(movieId);
776 //                        targetModel.addTarget(target);
777 //                    } else {
778 //                        return false;
779 //                    }
780 //
781 //                }
782 //                return false;
783 //            } catch (Exception e) {
784 //                logger.log(Level.SEVERE, null, e);
785 //                return false;
786 //            }
787             // TODO 上記実装見直し(Locationは削除された)
788             return false;
789         }
790     }
791
792     private class TableTransferHandler extends DownloadListTransferHandler {
793
794         private static final long serialVersionUID = 1L;
795
796         @Override
797         public boolean canImport(TransferHandler.TransferSupport support) {
798             return super.canImport(support);
799         }
800
801         @Override
802         public boolean importData(TransferHandler.TransferSupport support) {
803             return super.importData(support);
804         }
805     }
806
807     /*
808      * ここからDownloadProfile作成用クラスの定義
809      */
810
811     private class InqubusDownloadProfile implements DownloadProfile {
812
813         private final LoginProfile loginProfile;
814         private final ProxyProfile proxyProfile;
815         private final VideoProfile videoProfile;
816         private final CommentProfile commentProfile;
817         private final GeneralProfile generalProfile;
818
819         private InqubusDownloadProfile() {
820             this.loginProfile = new InqubusLoginProfile();
821             this.proxyProfile = new InqubusProxyProfile();
822             this.videoProfile = new InqubusVideoProfile();
823             this.commentProfile = new InqubusCommentProfile();
824             this.generalProfile = new InqubusGeneralProfile();
825         }
826
827         @Override
828         public LoginProfile getLoginInfo() {
829             return this.loginProfile;
830         }
831
832         @Override
833         public ProxyProfile getProxyProfile() {
834             return this.proxyProfile;
835         }
836
837         @Override
838         public VideoProfile getVideoProfile() {
839             return this.videoProfile;
840         }
841
842         @Override
843         public CommentProfile getCommentProfile() {
844             return this.commentProfile;
845         }
846
847         @Override
848         public GeneralProfile getGeneralProfile() {
849             return this.generalProfile;
850         }
851
852         @Override
853         public String toString(){
854             return ToStringBuilder.reflectionToString(this);
855         }
856     }
857
858     private class InqubusLoginProfile implements LoginProfile {
859         private final String mail;
860         private final String password;
861
862         private InqubusLoginProfile(){
863             final Config p = Config.INSTANCE;
864             this.mail = p.getId();
865             this.password = p.getPassword();
866         }
867
868         @Override
869         public String getMail() {
870             return this.mail;
871         }
872
873         @Override
874         public String getPassword() {
875             return this.password;
876         }
877
878         @Override
879         public String toString(){
880             return ToStringBuilder.reflectionToString(this);
881         }
882     }
883
884     private class InqubusProxyProfile implements ProxyProfile {
885         private final boolean use;
886         private final String host;
887         private final int port;
888
889         private InqubusProxyProfile(){
890             final Config p = Config.INSTANCE;
891             this.use = p.getProxyUse();
892             this.host = p.getProxyHost();
893             final String pp = p.getProxyPort();
894             this.port = StringUtils.isBlank(pp) ? -1 : Integer.parseInt(pp);
895         }
896
897         @Override
898         public boolean use() {
899             return this.use;
900         }
901
902         @Override
903         public String getHost() {
904             return this.host;
905         }
906
907         @Override
908         public int getPort() {
909             return this.port;
910         }
911
912         @Override
913         public String toString(){
914             return ToStringBuilder.reflectionToString(this);
915         }
916     }
917
918     private class InqubusVideoProfile implements VideoProfile {
919         private final boolean download;
920         private final File dir;
921         private final String fileName;
922         private final File localFile;
923
924         private InqubusVideoProfile(){
925             final Config p = Config.INSTANCE;
926             this.download = !cbVideoLocal.isSelected();
927             if (this.download) {
928                 this.dir = new File(p.getVideoDir());
929                 this.fileName = fldVideo.getText();
930                 this.localFile = null;
931             } else {
932                 this.dir = null;
933                 this.fileName = null;
934                 this.localFile = new File(fldVideo.getText());
935             }
936         }
937
938         @Override
939         public boolean isDownload() {
940             return this.download;
941         }
942
943         @Override
944         public File getDir() {
945             return this.dir;
946         }
947
948         @Override
949         public String getFileName() {
950             return this.fileName;
951         }
952
953         @Override
954         public File getLocalFile() {
955             return this.localFile;
956         }
957
958         @Override
959         public String toString(){
960             return ToStringBuilder.reflectionToString(this);
961         }
962     }
963
964     private class InqubusCommentProfile implements CommentProfile {
965         private final boolean download;
966         private final File dir;
967         private final String fileName;
968         private final File localFile;
969         private final int lengthRelatedCommentSize;
970         private final boolean disablePerMinComment;
971         private final int perMinCommentSize;
972         private final long backLogPoint;
973
974         private InqubusCommentProfile() {
975             final Config p = Config.INSTANCE;
976             this.download = !cbCommentLocal.isSelected();
977             if (this.download) {
978                 this.dir = new File(p.getCommentDir());
979                 this.fileName = fldComment.getText();
980                 this.localFile = null;
981             } else {
982                 this.dir = null;
983                 this.fileName = null;
984                 this.localFile = new File(fldComment.getText());
985             }
986
987             if(cbBackLog.isSelected()) {
988                 try {
989                     this.backLogPoint = WayBackTimeParser.parse(fldBackLog.getText());
990                 } catch (IOException ex) {
991                     throw new IllegalArgumentException("過去ログ時刻指定が誤っています。", ex);
992                 }
993             } else {
994                 this.backLogPoint = -1L;
995             }
996
997             this.disablePerMinComment = cbBackLogReduce.isSelected();
998             this.lengthRelatedCommentSize
999                     = (p.getCommentSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentSizeManual());
1000             this.perMinCommentSize
1001                     = (p.getCommentMinSizeAutosize()) ? -1 : Integer.parseInt(p.getCommentMinSizeManual());
1002         }
1003
1004         @Override
1005         public boolean isDownload() {
1006             return this.download;
1007         }
1008
1009         @Override
1010         public File getDir() {
1011             return this.dir;
1012         }
1013
1014         @Override
1015         public String getFileName() {
1016             return this.fileName;
1017         }
1018
1019         @Override
1020         public File getLocalFile() {
1021             return this.localFile;
1022         }
1023
1024         @Override
1025         public int getLengthRelatedCommentSize() {
1026             return this.lengthRelatedCommentSize;
1027         }
1028
1029         @Override
1030         public boolean isDisablePerMinComment() {
1031             return this.disablePerMinComment;
1032         }
1033
1034         @Override
1035         public int getPerMinCommentSize() {
1036             return this.perMinCommentSize;
1037         }
1038
1039         @Override
1040         public long getBackLogPoint() {
1041             return this.backLogPoint;
1042         }
1043
1044         @Override
1045         public String toString(){
1046             return ToStringBuilder.reflectionToString(this);
1047         }
1048     }
1049
1050     private class InqubusGeneralProfile implements GeneralProfile {
1051         private final String replaceFrom;
1052         private final String replaceTo;
1053         private InqubusGeneralProfile() {
1054             final Config p = Config.INSTANCE;
1055             this.replaceFrom = p.getReplaceFrom();
1056             this.replaceTo = p.getReplaceTo();
1057         }
1058
1059         @Override
1060         public String getReplaceFrom() {
1061             return this.replaceFrom;
1062         }
1063
1064         @Override
1065         public String getReplaceTo() {
1066             return this.replaceTo;
1067         }
1068
1069         @Override
1070         public String toString(){
1071             return ToStringBuilder.reflectionToString(this);
1072         }
1073     }
1074
1075     /*
1076      * ここからConvertProfile作成用クラスの定義
1077      */
1078     private class InqubusConvertProfile implements ConvertProfile {
1079         private final OutputProfile outputProfile;
1080         private final GeneralProfile generalProfile;
1081         private final FfmpegProfile ffmpegProfile;
1082         private final boolean convert;
1083         private final File ffmpeg;
1084         private final boolean vhookDisabled;
1085         private final boolean commentOverlay;
1086         private final File vhook;
1087         private final File tmpDir;
1088         private final File font;
1089         private final int fontIndex;
1090         private final boolean commentOpaque;
1091         private final boolean disableFontSizeArrange;
1092         private final int shadowIndex;
1093         private final boolean showConvrting;
1094         private final int maxNumOfComment;
1095         private final HideCondition ngSetting;
1096
1097         private InqubusConvertProfile() throws IOException {
1098             final Config p = Config.INSTANCE;
1099             this.outputProfile = new InqubusOutputProfile();
1100             this.generalProfile = new InqubusGeneralProfile();
1101             this.ffmpegProfile = new InqubusFfmpegProfile();
1102             this.convert = cbOutputEnable.isSelected();
1103             this.ffmpeg = new File(p.getFfmpegPath());
1104             // TODO コンフィグに設定なし
1105             this.vhookDisabled = false;
1106             this.commentOverlay = p.getOutputCommentOverlay();
1107             this.vhook = new File(p.getFfmpegDllPath());
1108             this.tmpDir = new File(p.getSystemTempDir());
1109             this.font = new File(p.getFontPath());
1110             this.fontIndex = Integer.parseInt(p.getFontIndex());
1111             this.commentOpaque = p.getCommentOpaque();
1112             this.disableFontSizeArrange = p.getFontSizeArrangeDisable();
1113             this.shadowIndex = p.getFontShadow();
1114             // TODO コンフィグに設定なし
1115             this.showConvrting = true;
1116             this.maxNumOfComment = (p.getCommentDisplaySizeDefault()) ? -1 : Integer.parseInt(p.
1117                     getCommentDisplaySizeManual());
1118             this.ngSetting = new InqubusHideCondition();
1119         }
1120
1121         @Override
1122         public OutputProfile getOutputProfile() {
1123             return this.outputProfile;
1124         }
1125
1126         @Override
1127         public GeneralProfile getGeneralProfile() {
1128             return this.generalProfile;
1129         }
1130
1131         @Override
1132         public FfmpegProfile getFfmpegOption() {
1133             return this.ffmpegProfile;
1134         }
1135
1136         @Override
1137         public boolean isConvert() {
1138             return this.convert;
1139         }
1140
1141         @Override
1142         public File getFfmpeg() {
1143             return this.ffmpeg;
1144         }
1145
1146         @Override
1147         public boolean isVhookDisabled() {
1148             return this.vhookDisabled;
1149         }
1150
1151         @Override
1152         public boolean isCommentOverlay() {
1153             return this.commentOverlay;
1154         }
1155
1156         @Override
1157         public File getVhook() {
1158             return this.vhook;
1159         }
1160
1161         @Override
1162         public File getTempDir() {
1163             return this.tmpDir;
1164         }
1165
1166         @Override
1167         public File getFont() {
1168             return this.font;
1169         }
1170
1171         @Override
1172         public int getFontIndex() {
1173             return this.fontIndex;
1174         }
1175
1176         @Override
1177         public boolean isCommentOpaque() {
1178             return this.commentOpaque;
1179         }
1180
1181         @Override
1182         public boolean isDisableFontSizeArrange() {
1183             return this.disableFontSizeArrange;
1184         }
1185
1186         @Override
1187         public int getShadowIndex() {
1188             return this.shadowIndex;
1189         }
1190
1191         @Override
1192         public boolean isShowConverting() {
1193             return this.showConvrting;
1194         }
1195
1196         @Override
1197         public int getMaxNumOfComment() {
1198             return this.maxNumOfComment;
1199         }
1200
1201         @Override
1202         public HideCondition getNgSetting() {
1203             return this.ngSetting;
1204         }
1205
1206         @Override
1207         public String toString(){
1208             return ToStringBuilder.reflectionToString(this);
1209         }
1210     }
1211
1212     private class InqubusOutputProfile implements OutputProfile {
1213         private final File dir;
1214         private final String fileName;
1215         private final String videoId;
1216         private final String title;
1217
1218
1219         private InqubusOutputProfile(){
1220             final Config p = Config.INSTANCE;
1221             this.dir = new File(p.getOutputDir());
1222             this.fileName = fldOutput.getText();
1223             // TODO この時点でのID/Titleはどうするか…
1224             this.videoId = "";
1225             this.title = "";
1226         }
1227
1228         @Override
1229         public File getDir() {
1230             return this.dir;
1231         }
1232
1233         @Override
1234         public String getFileName() {
1235             return this.fileName;
1236         }
1237
1238         @Override
1239         public String getVideoId() {
1240             return this.videoId;
1241         }
1242
1243         @Override
1244         public String getTitile() {
1245             return this.title;
1246         }
1247
1248         @Override
1249         public String toString(){
1250             return ToStringBuilder.reflectionToString(this);
1251         }
1252     }
1253
1254     private class InqubusFfmpegProfile implements FfmpegProfile {
1255         private final String extOption;
1256         private final String inOption;
1257         private final String mainOption;
1258         private final String outOption;
1259         private final String avOption;
1260         private final boolean resize;
1261         private final int resizeWidth;
1262         private final int resizeHeight;
1263         private final boolean adjustRatio;
1264
1265         private InqubusFfmpegProfile() throws IOException {
1266             // TODO FFMPEGオプションは、後でメイン画面でも設定できるようにするかも
1267             final Config p = Config.INSTANCE;
1268             final String opf = p.getFfmpegOptionFile();
1269             if (StringUtils.isNotEmpty(opf)) {
1270                 final File file = new File(opf);
1271                 final FfmpegOption ffop = FfmpegOption.load(file);
1272                 this.extOption = ffop.getExtOption();
1273                 this.inOption = ffop.getInOption();
1274                 this.mainOption = ffop.getMainOption();
1275                 this.outOption = ffop.getMainOption();
1276                 this.avOption = ffop.getAvfilterOption();
1277                 this.resize = ffop.isResize();
1278                 this.resizeWidth = ffop.getResizeWidth();
1279                 this.resizeHeight = ffop.getResizeHeight();
1280                 this.adjustRatio = ffop.isAdjustRatio();
1281                 return;
1282             }
1283             this.extOption = p.getFfmpegExtension();
1284             this.inOption = p.getFfmpegInOption();
1285             this.mainOption = p.getFfmpegMainOption();
1286             this.outOption = p.getFfmpegOutOption();
1287             this.avOption = p.getFfmpegAvOption();
1288             this.resize = p.getFfmpegResizeEnable();
1289             this.resizeWidth = Integer.parseInt(p.getFfmpegResizeWidth());
1290             this.resizeHeight = Integer.parseInt(p.getFfmpegResizeHeight());
1291             this.adjustRatio = p.getFfmpegKeepAspect();
1292         }
1293
1294         @Override
1295         public String getExtOption() {
1296             return this.extOption;
1297         }
1298
1299         @Override
1300         public String getInOption() {
1301             return this.inOption;
1302         }
1303
1304         @Override
1305         public String getMainOption() {
1306             return this.mainOption;
1307         }
1308
1309         @Override
1310         public String getOutOption() {
1311             return this.outOption;
1312         }
1313
1314         @Override
1315         public String getAvfilterOption() {
1316             return this.avOption;
1317         }
1318
1319         @Override
1320         public boolean isResize() {
1321             return this.resize;
1322         }
1323
1324         @Override
1325         public int getResizeWidth() {
1326             return this.resizeWidth;
1327         }
1328
1329         @Override
1330         public int getResizeHeight() {
1331             return this.resizeHeight;
1332         }
1333
1334         @Override
1335         public boolean isAdjustRatio() {
1336             return this.adjustRatio;
1337         }
1338
1339         @Override
1340         public String toString(){
1341             return ToStringBuilder.reflectionToString(this);
1342         }
1343     }
1344
1345     private class InqubusHideCondition implements ConvertProfile.HideCondition{
1346
1347         @Override
1348         public String getWord() {
1349             // TODO
1350             return "";
1351         }
1352
1353         @Override
1354         public String getId() {
1355             // TODO
1356             return "";
1357         }
1358
1359         @Override
1360         public String toString(){
1361             return ToStringBuilder.reflectionToString(this);
1362         }
1363     }
1364 }