OSDN Git Service

fixed: GUIを一新した
[importpicture/importpicture.git] / src / osm / jp / gpx / matchtime / gui / restamp / CardPerformFile.java
1 package osm.jp.gpx.matchtime.gui.restamp;
2
3 import java.awt.BorderLayout;
4 import java.io.File;
5 import java.util.ArrayList;
6 import javax.swing.BoxLayout;
7 import javax.swing.JButton;
8 import javax.swing.JLabel;
9 import javax.swing.JPanel;
10 import javax.swing.JTabbedPane;
11 import osm.jp.gpx.matchtime.gui.AdjustTime;
12 import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
13 import osm.jp.gpx.matchtime.gui.Card;
14 import osm.jp.gpx.matchtime.gui.PanelAction;
15 import osm.jp.gpx.matchtime.gui.ParameterPanelTime;
16
17 /**
18  * [基準画像(開始/終了)]選択パネル
19  * @author yuu
20  */
21 public class CardPerformFile extends Card  implements PanelAction {
22     //JPanel argsPanel;         // パラメータ設定パネル       (上部)
23     ParameterPanelTime arg1_basetime;
24     ParameterPanelTime arg2_basetime;
25     JButton doButton;       // [処理実行]ボタン
26     
27     /**
28      * コンストラクタ
29      * @param tabbe parent panel
30      * @param arg1_basetime             // 開始画像の基準時刻:
31      * @param arg2_basetime             // 開始画像の基準時刻:
32      */
33     public CardPerformFile(
34             JTabbedPane tabbe,
35             ParameterPanelTime arg1_basetime,
36             ParameterPanelTime arg2_basetime
37     ) {
38         super(tabbe, AdjustTime.i18n.getString("tab.restamp.400"), 2, 4);
39         this.arg1_basetime = arg1_basetime;
40         this.arg2_basetime = arg2_basetime;
41         
42         JPanel argsPanel = new JPanel();
43         argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.PAGE_AXIS));
44         argsPanel.add(packLine(new JLabel(i18n.getString("label.200")), new JPanel()));
45
46         // [処理実行]ボタン
47         doButton = new JButton(
48             i18n.getString("button.execute"),
49             AdjustTime.createImageIcon("images/media_playback_start.png")
50         );
51         argsPanel.add(doButton);
52                 
53         this.mainPanel.add(argsPanel, BorderLayout.CENTER);
54
55         //{{REGISTER_LISTENERS
56         SymAction lSymAction = new SymAction();
57         doButton.addActionListener(lSymAction);
58         //}}
59     }
60     
61     class SymAction implements java.awt.event.ActionListener {
62         @Override
63         public void actionPerformed(java.awt.event.ActionEvent event) {
64             Object object = event.getSource();
65             if (object == doButton) {
66                 doButton_Action(event);
67             }
68         }
69     }
70     
71     /**
72      * [実行]ボタンをクリックしたときの動作
73      * @param event
74      */
75     @SuppressWarnings("UseSpecificCatch")
76     void doButton_Action(java.awt.event.ActionEvent event) {
77         ArrayList<String> arry = new ArrayList<>();
78         File file = arg1_basetime.getImageFile().getImageFile();
79         File dir = file.getParentFile();
80         arry.add(dir.getAbsolutePath());
81         arry.add(file.getName());
82         arry.add(arg1_basetime.argField.getText());
83         file = arg2_basetime.getImageFile().getImageFile();
84         arry.add(file.getName());
85         arry.add(arg2_basetime.argField.getText());
86         String[] argv = arry.toArray(new String[arry.size()]);
87         (new DoRestamp(argv)).setVisible(true);
88     }
89
90     /**
91      *  入力条件が満たされているかどうか
92      * @return
93      */
94     @Override
95     public boolean isEnable() {
96        return (arg1_basetime.isEnable() && arg2_basetime.isEnable());
97     }
98     
99     @Override
100     @SuppressWarnings("empty-statement")
101     public void openAction() {
102        ; // 何もしない
103     }
104 }