diff --git a/src/i18n.properties b/src/i18n.properties index 7bdf409..9603e80 100644 --- a/src/i18n.properties +++ b/src/i18n.properties @@ -13,6 +13,7 @@ button.execute=Execute button.select=Selection... button.update=Update... +button.reset=Reset... tab.100=1. Source image Folder label.100=

1. Select image source folder.

diff --git a/src/i18n_ja_JP.properties b/src/i18n_ja_JP.properties index e0cb33c..e5c58c1 100644 --- a/src/i18n_ja_JP.properties +++ b/src/i18n_ja_JP.properties @@ -13,6 +13,7 @@ button.execute=\u51e6\u7406\u5b9f\u884c button.select=\u9078\u629e... button.update=\u5909\u66f4... +button.reset=\u518d\u8a2d\u5b9a... tab.100=1. \u753b\u50cf\u5143\u306e\u30d5\u30a1\u30a4\u30eb\u30d5\u30a9\u30eb\u30c0 label.100=

1. \u4f4d\u7f6e\u60c5\u5831\u3092\u4ed8\u52a0\u3057\u305f\u3044\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002

diff --git a/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java b/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java index 100db25..28cbabf 100644 --- a/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java +++ b/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java @@ -2,8 +2,10 @@ import java.awt.Dialog; import java.awt.event.ActionEvent; +import java.io.File; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.Date; import javax.swing.JButton; import osm.jp.gpx.matchtime.gui.restamp.DialogCorectTime; @@ -12,9 +14,11 @@ * この1インスタンスで、1パラメータをあらわす。 */ public class ParameterPanelTime extends ParameterPanel { + static final String TIME_PATTERN = "yyyy.MM.dd HH:mm:ss z"; SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getDateTimeInstance(); ParameterPanelImageFile imageFile; public JButton updateButton; + public JButton resetButton; Dialog owner; @SuppressWarnings("OverridableMethodCallInConstructor") @@ -31,12 +35,19 @@ updateButton = new JButton(i18n.getString("button.update")); updateButton.addActionListener(buttonAction); this.add(updateButton); + + // "ボタン[再設定...]" + ResetButtonAction resetAction = new ResetButtonAction(this); + resetButton = new JButton(i18n.getString("button.reset")); + resetButton.addActionListener(resetAction); + resetButton.setVisible(false); + this.add(resetButton); } public ParameterPanelTime setOwner(Dialog owner) { this.owner = owner; return this; - } + } /** * ボタンのアクション @@ -55,6 +66,31 @@ } } + /** + * ボタンのアクション + */ + class ResetButtonAction implements java.awt.event.ActionListener + { + ParameterPanelTime param; + + public ResetButtonAction(ParameterPanelTime param) { + this.param = param; + } + + @SuppressWarnings("override") + public void actionPerformed(ActionEvent e) { + if (param.imageFile.isEnable()) { + File file = param.imageFile.getImageFile(); + long lastModified = file.lastModified(); + sdf.applyPattern(TIME_PATTERN); + param.argField.setText(sdf.format(new Date(lastModified))); + } + else { + param.argField.setText(""); + } + } + } + public ParameterPanelImageFile getImageFile() { return this.imageFile; } @@ -65,7 +101,7 @@ String text = this.argField.getText(); if (text != null) { try { - sdf.applyPattern("yyyy.MM.dd HH:mm:ss z"); + sdf.applyPattern(TIME_PATTERN); sdf.parse(text); return true; } diff --git a/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java b/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java index 95f107c..d66443c 100644 --- a/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java +++ b/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java @@ -3,6 +3,7 @@ import java.awt.BorderLayout; import java.awt.Dialog; import java.awt.GridLayout; +import java.awt.Rectangle; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JDialog; @@ -21,8 +22,9 @@ */ public class DialogCorectTime extends JDialog implements PanelAction { public JPanel mainPanel; - JPanel argsPanel; // パラメータ設定パネル (上部) ParameterPanelTime arg_basetime; // 開始画像の基準時刻: + ParameterPanelTime basetime; // 開始画像の基準時刻: + java.awt.Button closeButton; /** * コンストラクタ @@ -31,33 +33,48 @@ */ public DialogCorectTime(ParameterPanelTime arg3_basetime, Dialog owner) { super(owner, AdjustTime.i18n.getString("tab.restamp.300"), false); + this.arg_basetime = arg3_basetime; - argsPanel = new JPanel(); - argsPanel.setLayout(new GridLayout(2, 1)); - + // INIT_CONTROLS + setLayout(new BorderLayout()); + setSize( + getInsets().left + getInsets().right + 720, + getInsets().top + getInsets().bottom + 480 + ); + //---- CENTER ----- JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BorderLayout()); add(centerPanel, BorderLayout.CENTER); + //---- CENTER.NORTH ----- + JPanel argsPanel; // パラメータ設定パネル (上部) + argsPanel = new JPanel(); + argsPanel.setLayout(new GridLayout(2, 1)); + // 3. 正確な撮影時刻を入力してください。 // カメラの時計が正確ならば、設定を変更する必要はありません。 JLabel label3 = new JLabel(); label3.setText(i18n.getString("label.300")); argsPanel.add(label3); - // 基準時刻: - this.arg_basetime = arg3_basetime; - //arg3_basetime.setLabel(String.format("  %s: ", i18n.getString("label.310"))); - //arg3_basetime.setLabel(ImportPicture.TIME_FORMAT_STRING); - //argsPanel.add(arg3_basetime); - //centerPanel.add(argsPanel, BorderLayout.NORTH); + basetime = new ParameterPanelTime( + arg3_basetime.argLabel.getText(), + "", + arg3_basetime.getImageFile() + ); + basetime.updateButton.setVisible(false); + basetime.resetButton.setVisible(true); + argsPanel.add(basetime); + centerPanel.add(argsPanel, BorderLayout.NORTH); + //---- CENTER.CENTER ----- // 参考画像 JLabel imageLabel = new JLabel(); JScrollPane imageSPane = new JScrollPane(imageLabel); centerPanel.add(imageSPane, BorderLayout.CENTER); + //---- CENTER.SOUTH ----- // 画像ファイル選択ダイアログを起動するボタン JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); @@ -68,6 +85,61 @@ JButton zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif")); buttonPanel.add(zoomOutButton); centerPanel.add(buttonPanel, BorderLayout.SOUTH); + + //---- SOUTH ----- + closeButton = new java.awt.Button(); + closeButton.setLabel(i18n.getString("button.close") ); + closeButton.setBounds(145,65,66,27); + add(closeButton, BorderLayout.SOUTH); + + //{{REGISTER_LISTENERS + SymWindow aSymWindow = new SymWindow(); + this.addWindowListener(aSymWindow); + SymAction lSymAction = new SymAction(); + closeButton.addActionListener(lSymAction); + //}} + } + + class SymWindow extends java.awt.event.WindowAdapter + { + @Override + public void windowClosing(java.awt.event.WindowEvent event) { + Object object = event.getSource(); + if (object == DialogCorectTime.this) { + dialog_WindowClosing(); + } + } + } + + class SymAction implements java.awt.event.ActionListener + { + @Override + public void actionPerformed(java.awt.event.ActionEvent event) { + Object object = event.getSource(); + if (object == closeButton) { + dialog_WindowClosing(); + } + } + } + + /** + * ダイアログが閉じられるときのアクション + */ + void dialog_WindowClosing() { + String workStr = basetime.getText(); + arg_basetime.setText(workStr); + dispose(); + } + + @Override + public void setVisible(boolean b) { + if(b) { + Rectangle bounds = getParent().getBounds(); + Rectangle abounds = getBounds(); + setLocation(bounds.x + (bounds.width - abounds.width)/ 2, + bounds.y + (bounds.height - abounds.height)/2); + } + super.setVisible(b); } @Override diff --git a/src/osm/jp/gpx/matchtime/gui/restamp/RestampDialog.java b/src/osm/jp/gpx/matchtime/gui/restamp/RestampDialog.java index bc72d08..81640aa 100644 --- a/src/osm/jp/gpx/matchtime/gui/restamp/RestampDialog.java +++ b/src/osm/jp/gpx/matchtime/gui/restamp/RestampDialog.java @@ -57,7 +57,7 @@ public void windowClosing(java.awt.event.WindowEvent event) { Object object = event.getSource(); if (object == RestampDialog.this) { - AboutDialog_WindowClosing(event); + dispose(); } } } @@ -68,7 +68,7 @@ public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == closeButton) { - closeButton_Clicked(event); + dispose(); } else if (object == arg2_baseTimeImg.argField) { imageView_Action(event); @@ -259,17 +259,6 @@ super.setVisible(b); } - void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) { - dispose(); - } - - void closeButton_Clicked(java.awt.event.ActionEvent event) { - //{{CONNECTION - // Clicked from okButton Hide the Dialog - dispose(); - //}} - } - ImageIcon refImage; /**