+++ /dev/null
-package osm.jp.gpx.matchtime.gui;
-
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.io.File;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.ResourceBundle;
-import java.util.TimeZone;
-import javax.swing.*;
-import osm.jp.gpx.*;
-import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.common.ImageMetadata;
-import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
-import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
-import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants;
-
-/**
- * 本プログラムのメインクラス
- */
-@SuppressWarnings("serial")
-public class AdjustTime extends JFrame
-{
- public static final String PROGRAM_NAME = "AdjustTime for JOSM";
- public static final String PROGRAM_VARSION = "4.01";
- public static final String PROGRAM_UPDATE = "2018/09/17";
-
- AppParameters params;
- SimpleDateFormat dfjp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
-
- // Used for addNotify check.
- boolean fComponentsAdjusted = false;
- public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
-
- //{{DECLARE_CONTROLS
- JPanel cardPanel; // ウィザード形式パネル(カード型)
- JPanel[] cards;
- int cardPanelNo = 0;
- JPanel argsPanel; // パラメータ設定パネル (上部)
- JScrollPane imageSPane; // スクロールパネル
- JLabel imageLabel; // 基準時刻画像表示
- ButtonGroup baseTimeGroup; // 基準時刻の指定グループ
- JRadioButton exifBase; // EXIF日時を基準にする/ !(ファイル更新日時を基準にする)
- JRadioButton fupdateBase; // File更新日時を基準にする/ !(EXIF日時を基準にする)
- JCheckBox noFirstNode; // GPX: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
- JCheckBox gpxReuse; // 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
- JTextArea textArea; // 実行結果表示領域
- //ImagePreview imagePane; // 基準時刻画像表示
- ParameterPanelFolder arg1_srcFolder;
- ParameterPanelImageFile arg2_baseTimeImg;
- ParameterPanel arg3_basetime; // 基準時刻:
- JCheckBox outputIMG; // IMGの変換 する/しない
- JCheckBox outputIMG_all; // 'out of GPX time'でもIMGの変換をする {ON | OFF}
- JCheckBox exifON; // EXIF 書き出しモード / !(EXIFの書き換えはしない)
- JCheckBox gpxOutputWpt; // GPXに<WPT>を書き出す
- JCheckBox gpxOverwriteMagvar; // ソースGPXの<MAGVAR>を無視する
- JCheckBox gpxOutputSpeed; // GPXに<SPEED>を書き出す
- ParameterPanelFolder arg5_outputFolder; // EXIF 書き出しフォルダ
- ParameterPanelGpx arg4_gpxFolder; // GPXファイル・フォルダ
-
- JPanel buttonPanel; // ボタンパネル (下部)
- JButton openButton; // [Fit]ボタン
- JButton zoomInButton; // [Zoom in]ボタン
- JButton zoomOutButton; // [Zoom out]ボタン
-
- JButton nextButton; // [次へ]ボタン
- JButton backButton; // [戻る]ボタン
- JButton doButton; // [処理実行]ボタン
- //}}
-
- //{{DECLARE_MENUS
- java.awt.MenuBar mainMenuBar;
- java.awt.Menu menu1;
- java.awt.MenuItem miDoNewFileList;
- java.awt.MenuItem miDoDirSize;
- java.awt.MenuItem miDoReadXML;
- java.awt.MenuItem miExit;
- java.awt.Menu menu3;
- java.awt.MenuItem miAbout;
- //}}
-
- class SymWindow extends java.awt.event.WindowAdapter {
- /**
- * このFrameが閉じられるときの動作。
- * このパネルが閉じられたら、このアプリケーションも終了させる。
- */
- @Override
- public void windowClosing(java.awt.event.WindowEvent event) {
- Object object = event.getSource();
- if (object == AdjustTime.this) {
- DbMang_WindowClosing(event);
- }
- }
- }
-
- class SymAction implements java.awt.event.ActionListener {
- @Override
- public void actionPerformed(java.awt.event.ActionEvent event) {
- Object object = event.getSource();
- if (object == miAbout) {
- miAbout_Action(event);
- }
- else if (object == miExit) {
- miExit_Action(event);
- }
- else if (object == openButton) {
- imageView_Action(event);
- }
- else if (object == zoomInButton) {
- zoomin_Action(event);
- }
- else if (object == zoomOutButton) {
- zoomout_Action(event);
- }
- else if (object == arg2_baseTimeImg.argField) {
- imageView_Action(event);
- }
- else if (object == arg2_baseTimeImg.openButton) {
- selectImage_Action(event);
- imageView_Action(event);
- }
- else if (object == outputIMG) {
- outputIMG_Action(event);
- }
- else if (object == outputIMG_all) {
- outputIMGall_Action(event);
- }
- else if (object == exifON) {
- exifON_Action(event);
- }
- else if (object == gpxOutputWpt) {
- gpxOutputWpt_Action(event);
- }
- else if (object == gpxOutputSpeed) {
- gpxOutputSpeed_Action(event);
- }
- else if (object == doButton) {
- doButton_Action(event);
- }
- else if (object == nextButton) {
- nextButton_Action(event);
- }
- else if (object == backButton) {
- backButton_Action(event);
- }
- }
- }
-
- /**
- * データベース内のテーブルを一覧で表示するFrame
- * @throws IOException
- */
- @SuppressWarnings("OverridableMethodCallInConstructor")
- public AdjustTime() throws IOException
- {
- dfjp.setTimeZone(TimeZone.getTimeZone("JST"));
-
- // INIT_CONTROLS
- Container container = getContentPane();
- container.setLayout(new BorderLayout());
- setSize(
- getInsets().left + getInsets().right + 720,
- getInsets().top + getInsets().bottom + 480
- );
- setTitle(AdjustTime.PROGRAM_NAME +" v"+ AdjustTime.PROGRAM_VARSION);
-
- //---- CENTER -----
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new BorderLayout());
- container.add(mainPanel, BorderLayout.CENTER);
-
- //---- SOUTH -----
- JPanel southPanel = new JPanel(new BorderLayout());
- southPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
- southPanel.add(Box.createVerticalStrut(10), BorderLayout.NORTH);
- container.add(southPanel, BorderLayout.SOUTH);
-
- //---- SPACE -----
- container.add(Box.createVerticalStrut(30), BorderLayout.NORTH);
- container.add(Box.createHorizontalStrut(10), BorderLayout.WEST);
- container.add(Box.createHorizontalStrut(10), BorderLayout.EAST);
-
- params = new AppParameters();
-
- //---------------------------------------------------------------------
- cardPanel = new JPanel();
- cardPanel.setLayout(new CardLayout());
- mainPanel.add(cardPanel, BorderLayout.CENTER);
-
- nextButton = new JButton(i18n.getString("button.next"));
- southPanel.add(nextButton, BorderLayout.EAST);
-
- backButton = new JButton(i18n.getString("button.previous"));
- southPanel.add(backButton, BorderLayout.WEST);
-
- cards = new JPanel[5];
- for (int i=0; i < 5; i++) {
- cards[i] = new JPanel();
- cardPanel.add(cards[i], String.valueOf(i));
- }
- cardPanelNo = 0;
-
- //---------------------------------------------------------------------
- // 1.[対象フォルダ]設定パネル
- int cardNo = 0;
- cards[cardNo].setLayout(new BorderLayout());
- JLabel label1 = new JLabel();
- label1.setText(i18n.getString("label.100"));
- cards[cardNo].add(label1, BorderLayout.NORTH);
-
- argsPanel = new JPanel();
- argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
- arg1_srcFolder = new ParameterPanelFolder(i18n.getString("label.110") +": ", params.getProperty(AppParameters.IMG_SOURCE_FOLDER));
- argsPanel.add(arg1_srcFolder);
- cards[cardNo].add(argsPanel, BorderLayout.CENTER);
-
- //---------------------------------------------------------------------
- // 2.[基準時刻画像]設定パネル
- cardNo++;
- cards[cardNo].setLayout(new BorderLayout());
- JLabel label2 = new JLabel();
- label2.setText(i18n.getString("label.200"));
- cards[cardNo].add(label2, BorderLayout.NORTH);
-
- argsPanel = new JPanel();
-
- // 基準時刻画像
- argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
- arg2_baseTimeImg = new ParameterPanelImageFile(i18n.getString("label.210") +": ", params.getProperty(AppParameters.IMG_BASE_FILE), arg1_srcFolder);
- argsPanel.add(arg2_baseTimeImg);
-
- baseTimeGroup = new ButtonGroup();
-
- // EXIFの日時を基準にする
- exifBase = new JRadioButton(i18n.getString("label.220"));
-
- // ファイル更新日時を基準にする
- fupdateBase = new JRadioButton(i18n.getString("label.230"));
- baseTimeGroup.add(exifBase);
- baseTimeGroup.add(fupdateBase);
- argsPanel.add(exifBase);
- argsPanel.add(fupdateBase);
- if (params.getProperty(AppParameters.GPX_BASETIME).equals("EXIF_TIME")) {
- fupdateBase.setSelected(false);
- exifBase.setSelected(true);
- }
- else {
- fupdateBase.setSelected(true);
- exifBase.setSelected(false);
- }
- cards[cardNo].add(argsPanel, BorderLayout.CENTER);
-
- //---------------------------------------------------------------------
- // 3.基準時刻の入力画面
- cardNo++;
- cards[cardNo].setLayout(new BorderLayout());
- argsPanel = new JPanel();
- argsPanel.setLayout(new GridLayout(2, 1));
-
- // 3. 正確な撮影時刻を入力してください。
- // カメラの時計が正確ならば、設定を変更する必要はありません。
- JLabel label3 = new JLabel();
- label3.setText(i18n.getString("label.300"));
- argsPanel.add(label3);
-
- // 基準時刻:
- String str310 = String.format(" %s: ", i18n.getString("label.310"));
- arg3_basetime = new ParameterPanel(str310, ImportPicture.TIME_FORMAT_STRING);
- argsPanel.add(arg3_basetime);
- cards[cardNo].add(argsPanel, BorderLayout.NORTH);
-
- // 参考画像
- imageLabel = new JLabel();
- imageSPane = new JScrollPane(imageLabel);
- cards[cardNo].add(imageSPane, BorderLayout.CENTER);
-
- // 画像ファイル選択ダイアログを起動するボタン
- buttonPanel = new JPanel();
- buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
- openButton = new JButton(createImageIcon("images/Fit16.gif"));
- buttonPanel.add(openButton);
- zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
- buttonPanel.add(zoomInButton);
- zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
- buttonPanel.add(zoomOutButton);
- cards[cardNo].add(buttonPanel, BorderLayout.SOUTH);
-
- //---------------------------------------------------------------------
- // 4.GPXファイル設定画面
- cardNo++;
- cards[cardNo].setLayout(new BorderLayout());
-
- // 4. ヒモ付を行うGPXファイルを選択してください。
- // - フォルダを指定すると、フォルダ内のすべてのGPXファイルを対象とします。
- JLabel label4 = new JLabel();
- label4.setText(i18n.getString("label.400"));
- cards[cardNo].add(label4, BorderLayout.NORTH);
-
- JPanel tmpPanel4a = new JPanel();
- tmpPanel4a.setLayout(new BoxLayout(tmpPanel4a, BoxLayout.Y_AXIS));
-
- // "GPXフォルダ: "
- arg4_gpxFolder = new ParameterPanelGpx(
- i18n.getString("label.410") + ": ",
- params.getProperty(AppParameters.GPX_SOURCE_FOLDER)
- );
- tmpPanel4a.add(arg4_gpxFolder);
-
- // "セグメント'trkseg'の最初の1ノードは無視する。"
- noFirstNode = new JCheckBox(
- i18n.getString("label.420"),
- params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON")
- );
- tmpPanel4a.add(noFirstNode);
-
- // "生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も変換の対象にする"
- gpxReuse = new JCheckBox(
- i18n.getString("label.430"),
- params.getProperty(AppParameters.GPX_REUSE).equals("ON")
- );
- gpxReuse.setEnabled(true);
- tmpPanel4a.add(gpxReuse);
- cards[cardNo].add(tmpPanel4a, BorderLayout.CENTER);
-
- //---------------------------------------------------------------------
- // 5.EXIF更新設定画面
- cardNo++;
- cards[cardNo].setLayout(new BorderLayout());
-
- // 5. EXIF変換を行うかどうかを選択してください。
- // - EXIF変換を行う場合には、変換ファイルを出力するフォルダも指定する必要があります。
- // - 出力フォルダには、書き込み権限と、十分な空き容量が必要です。
- JLabel label5 = new JLabel();
- label5.setText(
- String.format(
- "<html><p>5. %s</p><ul><li>%s</li><li>%s</li></ul>",
- i18n.getString("label.500"),
- i18n.getString("label.501"),
- i18n.getString("label.502")
- )
- );
- cards[cardNo].add(label5, BorderLayout.NORTH);
-
- JPanel tmpPanel5 = new JPanel();
- tmpPanel5.setLayout(new BoxLayout(tmpPanel5, BoxLayout.Y_AXIS));
-
- // "IMGの変換をする"
- outputIMG = new JCheckBox(
- i18n.getString("label.510"),
- Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT))
- );
- tmpPanel5.add(outputIMG);
-
- // "GPXファイル時間外のファイルもコピーする"
- outputIMG_all = new JCheckBox(
- i18n.getString("label.520"),
- Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_ALL))
- );
- tmpPanel5.add(outputIMG_all);
-
- // "出力フォルダ: "
- arg5_outputFolder = new ParameterPanelFolder(
- i18n.getString("label.530") + ": ",
- params.getProperty(AppParameters.IMG_OUTPUT_FOLDER)
- );
- tmpPanel5.add(arg5_outputFolder);
-
- // "EXIFの変換をする"
- exifON = new JCheckBox(
- i18n.getString("label.540"),
- Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_EXIF))
- );
- tmpPanel5.add(exifON);
-
- // "ポイントマーカー<WPT>をGPXファイルに出力する"
- gpxOutputWpt = new JCheckBox(
- i18n.getString("label.550"),
- Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT))
- );
- gpxOutputWpt.setEnabled(true);
- tmpPanel5.add(gpxOutputWpt);
-
- // "ソースGPXの<MAGVAR>を無視する"
- gpxOverwriteMagvar = new JCheckBox(
- i18n.getString("label.560"),
- Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OVERWRITE_MAGVAR))
- );
- gpxOverwriteMagvar.setEnabled(true);
- tmpPanel5.add(gpxOverwriteMagvar);
-
- // "出力GPXに<SPEED>を上書きする"
- gpxOutputSpeed = new JCheckBox(
- i18n.getString("label.570"),
- Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_SPEED))
- );
- gpxOutputSpeed.setEnabled(true);
- tmpPanel5.add(gpxOutputSpeed);
-
- cards[cardNo].add(tmpPanel5, BorderLayout.CENTER);
-
- // "処理実行"
- doButton = new JButton(
- i18n.getString("button.execute"),
- AdjustTime.createImageIcon("images/media_playback_start.png")
- );
- cards[cardNo].add(doButton, BorderLayout.SOUTH);
-
-
- //---------------------------------------------------------------------
- // INIT_MENUS
- menu1 = new java.awt.Menu("File");
- miExit = new java.awt.MenuItem(i18n.getString("menu.quit"));
- miExit.setFont(new Font("Dialog", Font.PLAIN, 12));
- menu1.add(miExit);
-
- miAbout = new java.awt.MenuItem("About...");
- miAbout.setFont(new Font("Dialog", Font.PLAIN, 12));
-
- menu3 = new java.awt.Menu("Help");
- menu3.setFont(new Font("Dialog", Font.PLAIN, 12));
- menu3.add(miAbout);
-
- mainMenuBar = new java.awt.MenuBar();
- mainMenuBar.setHelpMenu(menu3);
- mainMenuBar.add(menu1);
- mainMenuBar.add(menu3);
- setMenuBar(mainMenuBar);
-
- //{{REGISTER_LISTENERS
- SymWindow aSymWindow = new SymWindow();
- this.addWindowListener(aSymWindow);
- SymAction lSymAction = new SymAction();
- miAbout.addActionListener(lSymAction);
- miExit.addActionListener(lSymAction);
- openButton.addActionListener(lSymAction);
- zoomOutButton.addActionListener(lSymAction);
- zoomInButton.addActionListener(lSymAction);
- arg2_baseTimeImg.argField.addActionListener(lSymAction);
- arg2_baseTimeImg.openButton.addActionListener(lSymAction);
- doButton.addActionListener(lSymAction);
- outputIMG_all.addActionListener(lSymAction);
- exifON.addActionListener(lSymAction);
- gpxOutputSpeed.addActionListener(lSymAction);
- noFirstNode.addActionListener(lSymAction);
- gpxReuse.addActionListener(lSymAction);
- //arg1Panel_4.field.addActionListener(lSymAction);
- nextButton.addActionListener(lSymAction);
- backButton.addActionListener(lSymAction);
- //}}
- }
-
- /**
- * Shows or hides the component depending on the boolean flag b.
- * @param b trueのときコンポーネントを表示; その他のとき, componentを隠す.
- * @see java.awt.Component#isVisible
- */
- @Override
- public void setVisible(boolean b) {
- if(b) {
- setLocation(50, 50);
- }
- super.setVisible(b);
- }
-
- /**
- * このクラスをインスタンスを生成して表示する。
- * コマンドラインの引数はありません。
- * @param args
- */
- @SuppressWarnings("UseSpecificCatch")
- static public void main(String args[]) {
- SwingUtilities.invokeLater(() -> {
- try {
- createAndShowGUI();
- } catch (Exception e) {
- e.printStackTrace();
- }
- });
- }
- private static void createAndShowGUI() throws IOException {
- (new AdjustTime()).setVisible(true);
- }
-
- @Override
- public void addNotify() {
- // Record the size of the window prior to calling parents addNotify.
- Dimension d = getSize();
-
- super.addNotify();
-
- if (fComponentsAdjusted)
- return;
-
- // Adjust components according to the insets
- setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
- Component components[] = getComponents();
- for (Component component : components) {
- Point p = component.getLocation();
- p.translate(getInsets().left, getInsets().top);
- component.setLocation(p);
- }
- fComponentsAdjusted = true;
- }
-
- void DbMang_WindowClosing(java.awt.event.WindowEvent event) {
- setVisible(false); // hide the Manager
- dispose(); // free the system resources
- System.exit(0); // close the application
- }
-
- void miAbout_Action(java.awt.event.ActionEvent event) {
- // Action from About Create and show as modal
- (new AboutDialog(this, true)).setVisible(true);
- }
-
- void miExit_Action(java.awt.event.ActionEvent event) {
- // Action from Exit Create and show as modal
- //(new hayashi.yuu.tools.gui.QuitDialog(this, true)).setVisible(true);
- (new QuitDialog(this, true)).setVisible(true);
- }
-
- ImageIcon refImage;
-
- /**
- * 選択された画像ファイルを表示する
- * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
- * @param ev
- */
- @SuppressWarnings("UseSpecificCatch")
- public void imageView_Action(ActionEvent ev) {
- String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
-
- File timeFile = new File(path);
- if (exifBase.isSelected()) {
- try {
- ImageMetadata meta = Imaging.getMetadata(timeFile);
- JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
- if (jpegMetadata != null) {
- TiffImageMetadata exif = jpegMetadata.getExif();
- if (exif != null) {
- String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];
- long lastModifyTime = (new SimpleDateFormat("yyyy:MM:dd HH:mm:ss")).parse(dateTimeOriginal).getTime();
- arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime)));
- }
- else {
- arg3_basetime.argField.setText("exif == null");
- }
- }
- }
- catch (Exception e) {}
- }
- else {
- long lastModifyTime = timeFile.lastModified();
- arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime)));
- }
-
- int size_x = imageSPane.getWidth() - 8;
- ImageIcon tmpIcon = new ImageIcon(path);
- refImage = tmpIcon;
- if (tmpIcon.getIconWidth() > size_x) {
- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT));
- }
- imageLabel.setIcon(refImage);
- repaint();
- }
-
- public void zoomin_Action(ActionEvent ev) {
- if (refImage != null) {
- int size_x = imageLabel.getWidth();
- String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
- ImageIcon tmpIcon = new ImageIcon(path);
- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT));
- imageLabel.setIcon(refImage);
- repaint();
- }
- }
-
- public void zoomout_Action(ActionEvent ev) {
- if (refImage != null) {
- int size_x = imageLabel.getWidth();
- ImageIcon tmpIcon = refImage;
- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT));
- imageLabel.setIcon(refImage);
- repaint();
- }
- }
-
- /**
- * ソースディレクトリが選択された時のアクション
- * → AdjustTime.ini に書き込む
- * @param ev
- */
- public void selectSource_Action(ActionEvent ev) {
- }
-
- public void selectImage_Action(ActionEvent ev) {
- JFileChooser fc;
-
- //Set up the file chooser.
- File sdir = new File(arg1_srcFolder.getText());
- System.out.println(sdir.getPath());
- if (sdir.isDirectory()) {
- fc = new JFileChooser(sdir);
- }
- else {
- fc = new JFileChooser();
- }
-
- //Add a custom file filter and disable the default
- //(Accept All) file filter.
- fc.addChoosableFileFilter(new ImageFilter());
- fc.setAcceptAllFileFilterUsed(false);
-
- //Add custom icons for file types.
- fc.setFileView(new ImageFileView());
-
- //Add the preview pane.
- fc.setAccessory(new ImagePreview(fc));
-
- //Show it. "選択"
- int returnVal = fc.showDialog(this, i18n.getString("dialog.select"));
-
- //Process the results.
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- arg2_baseTimeImg.argField.setText(file.getName());
- }
-
- //Reset the file chooser for the next time it's shown.
- fc.setSelectedFile(null);
- }
-
- /** Returns an ImageIcon, or null if the path was invalid.
- * @param path
- * @return */
- public static ImageIcon createImageIcon(String path) {
- java.net.URL imgURL = AdjustTime.class.getResource(path);
- if (imgURL != null) {
- return new ImageIcon(imgURL);
- } else {
- System.err.println("Couldn't find file: " + path);
- return null;
- }
- }
-
- /**
- * checkbox[IMG変換]を変更した場合のアクション
- * ON ー> IMG出力フォルダのフィールドを有効にする
- * OFF -> IMG出力フォルダのフィールドを無効にする
- * @param event
- */
- void outputIMG_Action (ActionEvent event) {
- arg5_outputFolder.setEnabled(outputIMG.isEnabled());
- }
-
- /**
- * checkbox[GPXファイル時間外のファイルもコピーする]を変更した場合のアクション
- * @param event
- */
- void outputIMGall_Action (ActionEvent event) {
- }
-
- /**
- * checkbox[EXIF書き出し]を変更した場合のアクション
- * @param event
- */
- void exifON_Action (ActionEvent event) {
- }
-
- /**
- * checkbox[GPXの<WPT>を出力する]を変更した場合のアクション
- * @param event
- */
- void gpxOutputWpt_Action (ActionEvent event) {
- }
-
- /**
- * checkbox[GPXの<SPPED>を書き換える]を変更した場合のアクション
- * @param event
- */
- void gpxOutputSpeed_Action (ActionEvent event) {
- }
-
- /**
- * [実行]ボタンをクリックしたときの動作
- * @param event
- */
- @SuppressWarnings("UseSpecificCatch")
- void doButton_Action(java.awt.event.ActionEvent event) {
- doButton.setEnabled(false);
-
- String[] argv = new String[0];
- /*
- argv[0] = arg1_srcFolder.getText();
- argv[1] = arg2_baseTimeImg.getText();
- argv[2] = arg3_basetiome.getText();
- argv[3] = arg5_outputFolder.getText();
- argv[4] = arg4_gpxFolder.getText();
- */
- this.params.setProperty(AppParameters.GPX_NO_FIRST_NODE, String.valueOf(noFirstNode.isSelected()));
- this.params.setProperty(AppParameters.GPX_REUSE, String.valueOf(gpxReuse.isSelected()));
- this.params.setProperty(AppParameters.GPX_SOURCE_FOLDER, arg4_gpxFolder.getText());
-
- if (exifBase.isSelected()) {
- this.params.setProperty(AppParameters.GPX_BASETIME, "EXIF_TIME");
- }
- else {
- this.params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
- }
- try {
- this.params.setProperty(AppParameters.IMG_SOURCE_FOLDER, arg1_srcFolder.getText());
- this.params.setProperty(AppParameters.IMG_BASE_FILE, arg2_baseTimeImg.getText());
- this.params.setProperty(AppParameters.IMG_TIME, ImportPicture.toUTCString(dfjp.parse(arg3_basetime.getText())));
- this.params.setProperty(AppParameters.IMG_OUTPUT, String.valueOf(outputIMG.isSelected()));
- this.params.setProperty(AppParameters.IMG_OUTPUT_FOLDER, arg5_outputFolder.getText());
- this.params.setProperty(AppParameters.IMG_OUTPUT_ALL, String.valueOf(outputIMG_all.isSelected()));
- this.params.setProperty(AppParameters.IMG_OUTPUT_EXIF, String.valueOf(exifON.isSelected()));
- this.params.setProperty(AppParameters.GPX_OVERWRITE_MAGVAR, String.valueOf(gpxOverwriteMagvar.isSelected()));
- this.params.setProperty(AppParameters.GPX_OUTPUT_SPEED, String.valueOf(gpxOutputSpeed.isSelected()));
- this.params.setProperty(AppParameters.GPX_OUTPUT_WPT, String.valueOf(gpxOutputWpt.isSelected()));
- this.params.store();
- }
- catch(Exception e) {
- e.printStackTrace();
- }
-
- (new DoDialog(this, argv)).setVisible(true);
-
- doButton.setEnabled(true);
- }
-
- /**
- * [次へ]ボタンをクリックした時の動作
- * @param event
- */
- void nextButton_Action(ActionEvent event) {
- if ((cardPanelNo + 1) < cards.length) {
- cardPanelNo++;
- CardLayout cl = (CardLayout)(cardPanel.getLayout());
- cl.show(cardPanel, String.valueOf(cardPanelNo));
- }
- }
-
- /**
- * [戻る]ボタンをクリックした時の動作
- * @param event
- */
- void backButton_Action(ActionEvent event) {
- if ((cardPanelNo - 1) >= 0) {
- cardPanelNo--;
- CardLayout cl = (CardLayout)(cardPanel.getLayout());
- cl.show(cardPanel, String.valueOf(cardPanelNo));
- }
- }
-}