• R/O
  • HTTP
  • SSH
  • HTTPS

importpicture: Commit


Commit MetaInfo

Revisionff0120bde155aa320fbd855cfcfb0fd192c55da4 (tree)
Time2019-10-05 06:46:45
Authorhaya4 <hayashi.yuu@gmai...>
Commiterhaya4

Log Message

step by step

Change Summary

Incremental Difference

--- a/src/i18n.properties
+++ b/src/i18n.properties
@@ -3,6 +3,10 @@ dialog.cancel=Cancel
33 dialog.msg1=Quit this program.
44 dialog.select=Selection
55
6+menu.tools=Tools
7+menu.restamp=Restamp
8+button.close=Close
9+
610 menu.quit=Quit?
711 button.next=Next
812 button.previous=Previous
@@ -14,13 +18,16 @@ label.100=<html><p>1. Select image source folder.</p><ul><li>If you perform a co
1418 label.110=Image Folder
1519
1620 tab.200=2. Set correct shooting time
21+tab.restamp.200=2. Set correct shooting time (start)
1722 label.200=<html><p>2. Choose an image whose exact shooting time can be known.</p><ul><li>If the camera's clock is accurate, you can choose any image.</li></ul>
1823 label.210=Reference time image
1924 label.220=Based on EXIF date and time
2025 label.230=Based on FILE UPDATE time
2126 tab.300=2a. Set correct shooting time
27+tab.restamp.300=2a. Set correct shooting time (start)
2228 label.300=<html><p>3. enter the correct shooting time.</p><ul><li>If the camera clock is accurate, you do not need to change the setting.</li></ul>
2329 label.310=Reference time
30+label.restamp.310=Reference time (start)
2431
2532 tab.400=3. Select GPX files
2633 label.400=<html><p>4. Please select a GPX file to perform the matching.</p><ul><li>If you specify a folder, it will target all GPX files in the folder.</li></ul>
--- a/src/i18n_ja_JP.properties
+++ b/src/i18n_ja_JP.properties
@@ -3,6 +3,10 @@ dialog.cancel=\u30ad\u30e3\u30f3\u30bb\u30eb
33 dialog.msg1=\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d42\u4e86\u3057\u307e\u3059\u3002
44 dialog.select=\u9078\u629e
55
6+menu.tools=\u30c4\u30fc\u30eb
7+menu.restamp=Restamp
8+button.close=\u9589\u3058\u308b
9+
610 menu.quit=\u7d42\u4e86...
711 button.next=\u6b21\u3078
812 button.previous=\u623b\u308b
@@ -14,14 +18,17 @@ label.100=<html><p>1. \u4f4d\u7f6e\u60c5\u5831\u3092\u4ed8\u52a0\u3057\u305f\u30
1418 label.110=\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0
1519
1620 tab.200=2. \u57fa\u6e96\u3068\u3059\u308b\u753b\u50cf\u306e\u9078\u629e
21+tab.restamp.200=2. \u57fa\u6e96\u3068\u3059\u308b\u753b\u50cf(\u958b\u59cb\u753b\u50cf)\u306e\u9078\u629e
1722 label.200=<html><p>2. \u6b63\u78ba\u306a\u64ae\u5f71\u6642\u523b\u304c\u5224\u660e\u3067\u304d\u308b\u753b\u50cf\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044\u3002</p><ul><li>\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u6642\u8a08\u753b\u9762\uff08\u79d2\u304c\u5224\u5225\u3067\u304d\u308b\u3053\u3068\uff09\u3092\u64ae\u5f71\u3057\u305f\u753b\u50cf</li><li>\u30ab\u30e1\u30e9\u306e\u6642\u8a08\u304c\u6b63\u78ba\u306a\u3089\u3070\u3001\u3069\u306e\u753b\u50cf\u3092\u9078\u3093\u3067\u3082\u69cb\u3044\u307e\u305b\u3093\u3002</li></ul>
1823 label.210=\u57fa\u6e96\u6642\u523b\u753b\u50cf
1924 label.220=EXIF\u306e\u65e5\u6642\u3092\u57fa\u6e96\u306b\u3059\u308b
2025 label.230=\u30d5\u30a1\u30a4\u30eb\u66f4\u65b0\u65e5\u6642\u3092\u57fa\u6e96\u306b\u3059\u308b
2126
2227 tab.300=2a. \u672c\u5f53\u306e\u6642\u523b\u3092\u8a2d\u5b9a
28+tab.restamp.300=2a. \u958b\u59cb\u753b\u50cf\u306e\u672c\u5f53\u306e\u6642\u523b\u3092\u8a2d\u5b9a
2329 label.300=<html><p>3. \u6b63\u78ba\u306a\u64ae\u5f71\u6642\u523b\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002</p><ul><li>\u30ab\u30e1\u30e9\u306e\u6642\u8a08\u304c\u6b63\u78ba\u306a\u3089\u3070\u3001\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002</li></ul>
2430 label.310=\u57fa\u6e96\u6642\u523b
31+label.restamp.310=\u57fa\u6e96\u6642\u523b(\u958b\u59cb\u753b\u50cf)
2532
2633 tab.400=3. GPX\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e
2734 label.400=<html><p>4. \u30d2\u30e2\u4ed8\u3092\u884c\u3046GPX\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002</p><ul><li>\u30d5\u30a9\u30eb\u30c0\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3042\u308b\u3059\u3079\u3066\u306eGPX\u30d5\u30a1\u30a4\u30eb\u3092\u5bfe\u8c61\u3068\u3057\u307e\u3059\u3002</li></ul>
--- a/src/osm/jp/gpx/matchtime/gui/AdjustTime.java
+++ b/src/osm/jp/gpx/matchtime/gui/AdjustTime.java
@@ -1,5 +1,6 @@
11 package osm.jp.gpx.matchtime.gui;
22
3+import osm.jp.gpx.matchtime.gui.restamp.RestampDialog;
34 import java.awt.*;
45 import java.awt.event.ActionEvent;
56 import java.io.File;
@@ -8,6 +9,8 @@ import java.text.SimpleDateFormat;
89 import java.util.Date;
910 import java.util.ResourceBundle;
1011 import java.util.TimeZone;
12+import java.util.logging.Level;
13+import java.util.logging.Logger;
1114 import javax.swing.*;
1215 import osm.jp.gpx.*;
1316 import org.apache.commons.imaging.Imaging;
@@ -24,14 +27,14 @@ public class AdjustTime extends JFrame
2427 {
2528 public static final String PROGRAM_NAME = "AdjustTime for JOSM";
2629 public static final String PROGRAM_VARSION = "5.01";
27- public static final String PROGRAM_UPDATE = "2019/08/25";
30+ public static final String PROGRAM_UPDATE = "2019/09/11";
2831
2932 AppParameters params;
30- SimpleDateFormat dfjp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
33+ public static SimpleDateFormat dfjp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
3134
3235 // Used for addNotify check.
3336 boolean fComponentsAdjusted = false;
34- public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
37+ public static ResourceBundle i18n = ResourceBundle.getBundle("i18n");
3538
3639 //{{DECLARE_CONTROLS
3740 JTabbedPane cardPanel; // ウィザード形式パネル(タブ型)
@@ -73,6 +76,8 @@ public class AdjustTime extends JFrame
7376 java.awt.MenuItem miDoDirSize;
7477 java.awt.MenuItem miDoReadXML;
7578 java.awt.MenuItem miExit;
79+ java.awt.Menu menu2;
80+ java.awt.MenuItem miRestamp;
7681 java.awt.Menu menu3;
7782 java.awt.MenuItem miAbout;
7883 //}}
@@ -98,6 +103,13 @@ public class AdjustTime extends JFrame
98103 if (object == miAbout) {
99104 miAbout_Action(event);
100105 }
106+ else if (object == miRestamp) {
107+ try {
108+ miRestamp_Action(event);
109+ } catch (IOException ex) {
110+ Logger.getLogger(AdjustTime.class.getName()).log(Level.SEVERE, null, ex);
111+ }
112+ }
101113 else if (object == miExit) {
102114 miExit_Action(event);
103115 }
@@ -216,7 +228,11 @@ public class AdjustTime extends JFrame
216228
217229 // 基準時刻画像
218230 argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
219- arg2_baseTimeImg = new ParameterPanelImageFile(i18n.getString("label.210") +": ", params.getProperty(AppParameters.IMG_BASE_FILE), arg1_srcFolder);
231+ arg2_baseTimeImg = new ParameterPanelImageFile(
232+ i18n.getString("label.210") +": ",
233+ params.getProperty(AppParameters.IMG_BASE_FILE),
234+ arg1_srcFolder
235+ );
220236 argsPanel.add(arg2_baseTimeImg);
221237
222238 baseTimeGroup = new ButtonGroup();
@@ -416,6 +432,13 @@ public class AdjustTime extends JFrame
416432 miExit.setFont(new Font("Dialog", Font.PLAIN, 12));
417433 menu1.add(miExit);
418434
435+ miRestamp = new java.awt.MenuItem(i18n.getString("menu.restamp") + "...");
436+ miRestamp.setFont(new Font("Dialog", Font.PLAIN, 12));
437+
438+ menu2 = new java.awt.Menu(i18n.getString("menu.tools"));
439+ menu2.setFont(new Font("Dialog", Font.PLAIN, 12));
440+ menu2.add(miRestamp);
441+
419442 miAbout = new java.awt.MenuItem("About...");
420443 miAbout.setFont(new Font("Dialog", Font.PLAIN, 12));
421444
@@ -426,6 +449,7 @@ public class AdjustTime extends JFrame
426449 mainMenuBar = new java.awt.MenuBar();
427450 mainMenuBar.setHelpMenu(menu3);
428451 mainMenuBar.add(menu1);
452+ mainMenuBar.add(menu2);
429453 mainMenuBar.add(menu3);
430454 setMenuBar(mainMenuBar);
431455
@@ -434,6 +458,7 @@ public class AdjustTime extends JFrame
434458 this.addWindowListener(aSymWindow);
435459 SymAction lSymAction = new SymAction();
436460 miAbout.addActionListener(lSymAction);
461+ miRestamp.addActionListener(lSymAction);
437462 miExit.addActionListener(lSymAction);
438463 openButton.addActionListener(lSymAction);
439464 zoomOutButton.addActionListener(lSymAction);
@@ -513,6 +538,10 @@ public class AdjustTime extends JFrame
513538 (new AboutDialog(this, true)).setVisible(true);
514539 }
515540
541+ void miRestamp_Action(java.awt.event.ActionEvent event) throws IOException {
542+ (new RestampDialog(this, true)).setVisible(true);
543+ }
544+
516545 void miExit_Action(java.awt.event.ActionEvent event) {
517546 // Action from Exit Create and show as modal
518547 //(new hayashi.yuu.tools.gui.QuitDialog(this, true)).setVisible(true);
@@ -690,13 +719,6 @@ public class AdjustTime extends JFrame
690719 doButton.setEnabled(false);
691720
692721 String[] argv = new String[0];
693- /*
694- argv[0] = arg1_srcFolder.getText();
695- argv[1] = arg2_baseTimeImg.getText();
696- argv[2] = arg3_basetiome.getText();
697- argv[3] = arg5_outputFolder.getText();
698- argv[4] = arg4_gpxFolder.getText();
699- */
700722 this.params.setProperty(AppParameters.GPX_NO_FIRST_NODE, String.valueOf(noFirstNode.isSelected()));
701723 this.params.setProperty(AppParameters.GPX_REUSE, String.valueOf(gpxReuse.isSelected()));
702724 this.params.setProperty(AppParameters.GPX_SOURCE_FOLDER, arg4_gpxFolder.getText());
--- a/src/osm/jp/gpx/matchtime/gui/Card.java
+++ b/src/osm/jp/gpx/matchtime/gui/Card.java
@@ -2,25 +2,20 @@ package osm.jp.gpx.matchtime.gui;
22
33 import java.awt.BorderLayout;
44 import java.awt.event.ActionEvent;
5-import java.util.ResourceBundle;
65 import javax.swing.Box;
76 import javax.swing.JButton;
87 import javax.swing.JPanel;
98 import javax.swing.JTabbedPane;
9+import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
1010
11-/**
12- *
13- * @author yuu
14- */
1511 public class Card extends JPanel {
16- public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
1712 JTabbedPane tabbe;
1813 public JPanel mainPanel;
1914 String title;
2015 int backNumber = -1;
2116 int nextNumber = -1;
22- JButton nextButton; // [次へ]ボタン
23- JButton backButton; // [戻る]ボタン
17+ public JButton nextButton; // [次へ]ボタン
18+ public JButton backButton; // [戻る]ボタン
2419
2520 public Card(JTabbedPane tabbe, String title, int backNumber, int nextNumber) {
2621 super();
@@ -47,21 +42,40 @@ public class Card extends JPanel {
4742 SymAction lSymAction = new SymAction();
4843 if (nextNumber >= 0) {
4944 nextButton = new JButton(i18n.getString("button.next"));
45+ nextButton.setEnabled(false);
5046 buttonPanel.add(nextButton, BorderLayout.EAST);
5147 nextButton.addActionListener(lSymAction);
5248 }
5349
5450 if (backNumber >= 0) {
5551 backButton = new JButton(i18n.getString("button.previous"));
52+ backButton.setEnabled(false);
5653 buttonPanel.add(backButton, BorderLayout.WEST);
5754 backButton.addActionListener(lSymAction);
5855 }
5956 //}}
6057 }
6158
59+ public void setEnabled(boolean enabled) {
60+ this.tabbe.setEnabledAt(nextNumber - 1, enabled);
61+ }
62+
6263 public String getTitle() {
6364 return this.title;
6465 }
66+
67+ class SymAction implements java.awt.event.ActionListener {
68+ @Override
69+ public void actionPerformed(java.awt.event.ActionEvent event) {
70+ Object object = event.getSource();
71+ if (object == nextButton) {
72+ nextButton_Action(event);
73+ }
74+ else if (object == backButton) {
75+ backButton_Action(event);
76+ }
77+ }
78+ }
6579
6680 /**
6781 * [次へ]ボタンをクリックした時の動作
@@ -78,17 +92,4 @@ public class Card extends JPanel {
7892 void backButton_Action(ActionEvent event) {
7993 this.tabbe.setSelectedIndex(this.backNumber);
8094 }
81-
82- class SymAction implements java.awt.event.ActionListener {
83- @Override
84- public void actionPerformed(java.awt.event.ActionEvent event) {
85- Object object = event.getSource();
86- if (object == nextButton) {
87- nextButton_Action(event);
88- }
89- else if (object == backButton) {
90- backButton_Action(event);
91- }
92- }
93- }
9495 }
--- /dev/null
+++ b/src/osm/jp/gpx/matchtime/gui/PanelAction.java
@@ -0,0 +1,5 @@
1+package osm.jp.gpx.matchtime.gui;
2+
3+public interface PanelAction {
4+ void openAction();
5+}
--- /dev/null
+++ b/src/osm/jp/gpx/matchtime/gui/ParamAction.java
@@ -0,0 +1,5 @@
1+package osm.jp.gpx.matchtime.gui;
2+
3+public interface ParamAction {
4+ boolean isEnable();
5+}
--- a/src/osm/jp/gpx/matchtime/gui/ParameterPanel.java
+++ b/src/osm/jp/gpx/matchtime/gui/ParameterPanel.java
@@ -1,7 +1,7 @@
11 package osm.jp.gpx.matchtime.gui;
22
33 import java.awt.Dimension;
4-import java.awt.LayoutManager;
4+import java.awt.event.ActionListener;
55 import java.util.ResourceBundle;
66
77 import javax.swing.BoxLayout;
@@ -13,7 +13,7 @@ import javax.swing.JTextField;
1313 * パラメータを設定する為のパネル。
1414 * この1インスタンスで、1パラメータをあらわす。
1515 */
16-public class ParameterPanel extends JPanel {
16+public abstract class ParameterPanel extends JPanel implements ActionListener,ParamAction {
1717 private static final long serialVersionUID = 4629824800747170556L;
1818 public JTextField argField;
1919 public JLabel argLabel;
@@ -21,34 +21,34 @@ public class ParameterPanel extends JPanel {
2121
2222 @SuppressWarnings("OverridableMethodCallInConstructor")
2323 public ParameterPanel(String label, String text) {
24+ this();
25+ this.argLabel.setText(label);
26+ this.argField.setText(text);
27+ }
28+
29+ public ParameterPanel() {
2430 super();
2531
26- argLabel = new JLabel(label);
27- argField = new JTextField(text);
32+ argLabel = new JLabel();
33+ argField = new JTextField();
2834
2935 this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
3036 this.setMaximumSize(new Dimension(1920, 40));
3137 this.add(argLabel);
3238 this.add(argField);
3339 }
34-
35- public String getText() {
36- return this.argField.getText();
37- }
38-
39- public ParameterPanel(boolean isDoubleBuffered) {
40- super(isDoubleBuffered);
41- // TODO 自動生成されたコンストラクター・スタブ
40+
41+ public ParameterPanel setLabel(String label) {
42+ this.argLabel.setText(label);
43+ return this;
4244 }
43-
44- public ParameterPanel(LayoutManager layout) {
45- super(layout);
46- // TODO 自動生成されたコンストラクター・スタブ
45+
46+ public ParameterPanel setText(String text) {
47+ this.argField.setText(text);
48+ return this;
4749 }
48-
49- public ParameterPanel(LayoutManager layout, boolean isDoubleBuffered) {
50- super(layout, isDoubleBuffered);
51- // TODO 自動生成されたコンストラクター・スタブ
50+
51+ public String getText() {
52+ return this.argField.getText();
5253 }
53-
5454 }
--- a/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java
+++ b/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java
@@ -1,13 +1,13 @@
11 package osm.jp.gpx.matchtime.gui;
22
33 import java.awt.event.ActionEvent;
4-import java.awt.event.ActionListener;
54 import java.io.File;
5+import java.io.FileNotFoundException;
66 import javax.swing.JButton;
77 import javax.swing.JFileChooser;
88
99 @SuppressWarnings("serial")
10-public class ParameterPanelFolder extends ParameterPanel implements ActionListener
10+public class ParameterPanelFolder extends ParameterPanel
1111 {
1212 JFileChooser fc;
1313 JButton openButton;
@@ -37,26 +37,50 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
3737 super.setEnabled(f);
3838 openButton.setEnabled(f);
3939 }
40+
41+ public File getDirectory() throws FileNotFoundException {
42+ String path = this.argField.getText();
43+ if (path == null) {
44+ throw new FileNotFoundException("Image folder is Not specifiyed yet.");
45+ }
46+ File sdir = new File(path);
47+ if (!sdir.exists()) {
48+ throw new FileNotFoundException(String.format("Image folder '%s' is Not exists.", path));
49+ }
50+ if (!sdir.isDirectory()) {
51+ throw new FileNotFoundException(String.format("Image folder '%s' is Not directory.", path));
52+ }
53+ return sdir;
54+ }
4055
4156 @Override
4257 public void actionPerformed(ActionEvent e) {
4358 if (e.getSource() == openButton){
44- System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
45- File sdir = new File(this.argField.getText());
46- if (sdir.exists()) {
47- this.fc = new JFileChooser(sdir);
48- }
49- else {
50- this.fc = new JFileChooser();
51- }
52- this.fc.setFileSelectionMode(this.chooser);
53-
54- int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
55-
56- if (returnVal == JFileChooser.APPROVE_OPTION) {
57- File file = this.fc.getSelectedFile();
58- this.argField.setText(file.getAbsolutePath());
59+ try {
60+ System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
61+ File sdir = getDirectory();
62+ if (sdir.exists()) {
63+ this.fc = new JFileChooser(sdir);
64+ }
65+ else {
66+ this.fc = new JFileChooser();
67+ }
68+ this.fc.setFileSelectionMode(this.chooser);
69+
70+ int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
71+
72+ if (returnVal == JFileChooser.APPROVE_OPTION) {
73+ File file = this.fc.getSelectedFile();
74+ this.argField.setText(file.getAbsolutePath());
75+ }
76+ } catch (FileNotFoundException ex) {
77+ this.argField.setText(ex.toString());
5978 }
6079 }
6180 }
81+
82+ @Override
83+ public boolean isEnable() {
84+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
85+ }
6286 }
\ No newline at end of file
--- a/src/osm/jp/gpx/matchtime/gui/ParameterPanelImageFile.java
+++ b/src/osm/jp/gpx/matchtime/gui/ParameterPanelImageFile.java
@@ -1,15 +1,15 @@
11 package osm.jp.gpx.matchtime.gui;
22
33 import java.awt.event.ActionEvent;
4-import java.awt.event.ActionListener;
4+import java.io.File;
55 import javax.swing.JButton;
66 import javax.swing.JFileChooser;
77
88 @SuppressWarnings("serial")
9-public class ParameterPanelImageFile extends ParameterPanel implements ActionListener {
9+public class ParameterPanelImageFile extends ParameterPanel {
1010 JFileChooser fc;
11- JButton openButton;
12- ParameterPanelFolder paramDir;
11+ public JButton openButton;
12+ public ParameterPanelFolder paramDir;
1313
1414 @SuppressWarnings("OverridableMethodCallInConstructor")
1515 public ParameterPanelImageFile(String label, String text, ParameterPanelFolder paramDir) {
@@ -17,11 +17,7 @@ public class ParameterPanelImageFile extends ParameterPanel implements ActionLis
1717
1818 // "選択..."
1919 openButton = new JButton(i18n.getString("button.select"));
20-
21- /*
2220 openButton.addActionListener(this);
23- */
24-
2521 this.add(openButton);
2622
2723 //Create a file chooser
@@ -30,19 +26,18 @@ public class ParameterPanelImageFile extends ParameterPanel implements ActionLis
3026
3127 @SuppressWarnings("override")
3228 public void actionPerformed(ActionEvent e) {
33- /*
3429 //Set up the file chooser.
35- File sdir = new File(paramDir.getText());
36- System.out.println(sdir.toPath());
37- if (sdir.isDirectory()) {
38- fc = new JFileChooser(sdir);
39- }
40- else {
41- fc = new JFileChooser();
42- }
30+ File sdir = new File(paramDir.getText());
31+ System.out.println(sdir.toPath());
32+ if (sdir.isDirectory()) {
33+ fc = new JFileChooser(sdir);
34+ }
35+ else {
36+ fc = new JFileChooser();
37+ }
4338
44- //Add a custom file filter and disable the default
45- //(Accept All) file filter.
39+ //Add a custom file filter and disable the default
40+ //(Accept All) file filter.
4641 fc.addChoosableFileFilter(new ImageFilter());
4742 fc.setAcceptAllFileFilterUsed(false);
4843
@@ -63,6 +58,14 @@ public class ParameterPanelImageFile extends ParameterPanel implements ActionLis
6358
6459 //Reset the file chooser for the next time it's shown.
6560 fc.setSelectedFile(null);
66- */
61+ }
62+
63+ /**
64+ *
65+ * @return
66+ */
67+ @Override
68+ public boolean isEnable() {
69+ throw new UnsupportedOperationException("Not supported yet.");
6770 }
6871 }
\ No newline at end of file
--- a/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
+++ b/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
@@ -22,4 +22,13 @@ public class ParameterPanelTime extends ParameterPanel implements ActionListener
2222 @Override
2323 public void actionPerformed(ActionEvent e) {
2424 }
25+
26+ /**
27+ * このフィールドに有効な値が設定されているかどうか
28+ * @return
29+ */
30+ @Override
31+ public boolean isEnable() {
32+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
33+ }
2534 }
\ No newline at end of file
--- /dev/null
+++ b/src/osm/jp/gpx/matchtime/gui/restamp/CardCorectTime.java
@@ -0,0 +1,71 @@
1+package osm.jp.gpx.matchtime.gui.restamp;
2+
3+import java.awt.BorderLayout;
4+import java.awt.GridLayout;
5+import javax.swing.BoxLayout;
6+import javax.swing.JButton;
7+import javax.swing.JLabel;
8+import javax.swing.JPanel;
9+import javax.swing.JScrollPane;
10+import javax.swing.JTabbedPane;
11+import osm.jp.gpx.ImportPicture;
12+import osm.jp.gpx.matchtime.gui.AdjustTime;
13+import static osm.jp.gpx.matchtime.gui.AdjustTime.createImageIcon;
14+import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
15+import osm.jp.gpx.matchtime.gui.Card;
16+import osm.jp.gpx.matchtime.gui.PanelAction;
17+import osm.jp.gpx.matchtime.gui.ParameterPanel;
18+
19+/**
20+ * [基準画像(開始)]選択パネル
21+ * @author yuu
22+ */
23+public class CardCorectTime extends Card {
24+ JPanel argsPanel; // パラメータ設定パネル (上部)
25+ ParameterPanel arg3_basetime; // 基準時刻:
26+
27+ /**
28+ * コンストラクタ
29+ * @param tabbe parent panel
30+ * @param arg3_basetime
31+ */
32+ public CardCorectTime(JTabbedPane tabbe, ParameterPanel arg3_basetime) {
33+ super(tabbe, AdjustTime.i18n.getString("tab.restamp.300"), 1, 3);
34+
35+ argsPanel = new JPanel();
36+ argsPanel.setLayout(new GridLayout(2, 1));
37+
38+ //---- CENTER -----
39+ this.mainPanel.setLayout(new BorderLayout());
40+ this.add(mainPanel, BorderLayout.CENTER);
41+
42+ // 3. 正確な撮影時刻を入力してください。
43+ // カメラの時計が正確ならば、設定を変更する必要はありません。
44+ JLabel label3 = new JLabel();
45+ label3.setText(i18n.getString("label.300"));
46+ argsPanel.add(label3);
47+
48+ // 基準時刻:
49+ this.arg3_basetime = arg3_basetime;
50+ arg3_basetime.setLabel(String.format("  %s: ", i18n.getString("label.310")));
51+ arg3_basetime.setLabel(ImportPicture.TIME_FORMAT_STRING);
52+ argsPanel.add(arg3_basetime);
53+ this.mainPanel.add(argsPanel, BorderLayout.NORTH);
54+
55+ // 参考画像
56+ JLabel imageLabel = new JLabel();
57+ JScrollPane imageSPane = new JScrollPane(imageLabel);
58+ this.mainPanel.add(imageSPane, BorderLayout.CENTER);
59+
60+ // 画像ファイル選択ダイアログを起動するボタン
61+ JPanel buttonPanel = new JPanel();
62+ buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
63+ JButton openButton = new JButton(createImageIcon("images/Fit16.gif"));
64+ buttonPanel.add(openButton);
65+ JButton zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
66+ buttonPanel.add(zoomInButton);
67+ JButton zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
68+ buttonPanel.add(zoomOutButton);
69+ this.mainPanel.add(buttonPanel, BorderLayout.SOUTH);
70+ }
71+}
--- /dev/null
+++ b/src/osm/jp/gpx/matchtime/gui/restamp/CardFirstFile.java
@@ -0,0 +1,52 @@
1+package osm.jp.gpx.matchtime.gui.restamp;
2+
3+import java.awt.BorderLayout;
4+import java.io.File;
5+import java.io.FileNotFoundException;
6+import javax.swing.BoxLayout;
7+import javax.swing.JLabel;
8+import javax.swing.JPanel;
9+import javax.swing.JTabbedPane;
10+import osm.jp.gpx.matchtime.gui.AdjustTime;
11+import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
12+import osm.jp.gpx.matchtime.gui.Card;
13+import osm.jp.gpx.matchtime.gui.PanelAction;
14+import osm.jp.gpx.matchtime.gui.ParameterPanelImageFile;
15+
16+/**
17+ * [基準画像(開始)]選択パネル
18+ * @author yuu
19+ */
20+public class CardFirstFile extends Card implements PanelAction {
21+ JPanel argsPanel; // パラメータ設定パネル (上部)
22+ ParameterPanelImageFile arg2_baseTimeImg;
23+
24+ /**
25+ * コンストラクタ
26+ * @param tabbe parent panel
27+ * @param arg2_baseTimeImg
28+ */
29+ public CardFirstFile(JTabbedPane tabbe, ParameterPanelImageFile arg2_baseTimeImg) {
30+ super(tabbe, AdjustTime.i18n.getString("tab.restamp.200"), 0, 2);
31+ this.arg2_baseTimeImg = arg2_baseTimeImg;
32+
33+ this.mainPanel.add(new JLabel(i18n.getString("label.200")), BorderLayout.NORTH);
34+
35+ argsPanel = new JPanel();
36+ argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
37+ argsPanel.add(arg2_baseTimeImg);
38+ this.mainPanel.add(argsPanel, BorderLayout.CENTER);
39+ }
40+
41+ @Override
42+ public void openAction() {
43+ try {
44+ File dir = arg2_baseTimeImg.paramDir.getDirectory();
45+ } catch (FileNotFoundException ex) {
46+ arg2_baseTimeImg.setText(null);
47+ }
48+ if (arg2_baseTimeImg.getText() == null) {
49+ }
50+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
51+ }
52+}
--- /dev/null
+++ b/src/osm/jp/gpx/matchtime/gui/restamp/CardSourceFolder.java
@@ -0,0 +1,40 @@
1+package osm.jp.gpx.matchtime.gui.restamp;
2+
3+import java.awt.BorderLayout;
4+import javax.swing.BoxLayout;
5+import javax.swing.JLabel;
6+import javax.swing.JPanel;
7+import javax.swing.JTabbedPane;
8+import osm.jp.gpx.matchtime.gui.AdjustTime;
9+import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
10+import osm.jp.gpx.matchtime.gui.Card;
11+import osm.jp.gpx.matchtime.gui.PanelAction;
12+import osm.jp.gpx.matchtime.gui.ParameterPanelFolder;
13+
14+/**
15+ * [対象フォルダ]設定パネル
16+ * @author yuu
17+ */
18+public class CardSourceFolder extends Card implements PanelAction {
19+
20+ /**
21+ * コンストラクタ
22+ * @param tabbe parent panel
23+ * @param arg1_srcFolder 対象フォルダ
24+ */
25+ public CardSourceFolder(JTabbedPane tabbe, ParameterPanelFolder arg1_srcFolder) {
26+ super(tabbe, AdjustTime.i18n.getString("tab.100"), -1, 1);
27+ this.mainPanel.add(new JLabel(i18n.getString("label.100")), BorderLayout.NORTH);
28+
29+ JPanel argsPanel = new JPanel(); // パラメータ設定パネル (上部)
30+ argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
31+ argsPanel.add(arg1_srcFolder);
32+ this.mainPanel.add(argsPanel, BorderLayout.CENTER);
33+ }
34+
35+ @Override
36+ @SuppressWarnings("empty-statement")
37+ public void openAction() {
38+ ; // 何もしない
39+ }
40+}
--- /dev/null
+++ b/src/osm/jp/gpx/matchtime/gui/restamp/RestampDialog.java
@@ -0,0 +1,269 @@
1+package osm.jp.gpx.matchtime.gui.restamp;
2+import java.awt.*;
3+import java.awt.event.ActionEvent;
4+import java.io.File;
5+import java.io.IOException;
6+import java.util.Date;
7+import javax.swing.*;
8+import osm.jp.gpx.AppParameters;
9+import osm.jp.gpx.matchtime.gui.AdjustTime;
10+import osm.jp.gpx.matchtime.gui.Card;
11+import osm.jp.gpx.matchtime.gui.ImageFileView;
12+import osm.jp.gpx.matchtime.gui.ImageFilter;
13+import osm.jp.gpx.matchtime.gui.ImagePreview;
14+import osm.jp.gpx.matchtime.gui.ParameterPanel;
15+import osm.jp.gpx.matchtime.gui.ParameterPanelFolder;
16+import osm.jp.gpx.matchtime.gui.ParameterPanelImageFile;
17+import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
18+
19+@SuppressWarnings("serial")
20+public class RestampDialog extends Dialog
21+{
22+ //{{DECLARE_CONTROLS
23+ java.awt.Label label1;
24+ java.awt.Button closeButton;
25+ java.awt.Label label2;
26+ JLabel imageLabel; // 開始画像の基準時刻画像表示
27+ JTabbedPane cardPanel; // ウィザード形式パネル(タブ型)
28+ JScrollPane imageSPane; // スクロールパネル
29+ JPanel[] cards;
30+ ParameterPanelFolder arg1_srcFolder; // 対象フォルダ
31+ ParameterPanelImageFile arg2_baseTimeImg; // 開始画像ファイルパス
32+ ParameterPanel arg3_basetime; // 開始画像の基準時刻:
33+ AppParameters params;
34+ //}}
35+
36+ // Used for addNotify redundency check.
37+ boolean fComponentsAdjusted = false;
38+
39+ class SymWindow extends java.awt.event.WindowAdapter
40+ {
41+ @Override
42+ public void windowClosing(java.awt.event.WindowEvent event) {
43+ Object object = event.getSource();
44+ if (object == RestampDialog.this) {
45+ AboutDialog_WindowClosing(event);
46+ }
47+ }
48+ }
49+
50+ class SymAction implements java.awt.event.ActionListener
51+ {
52+ @Override
53+ public void actionPerformed(java.awt.event.ActionEvent event) {
54+ Object object = event.getSource();
55+ if (object == closeButton) {
56+ closeButton_Clicked(event);
57+ }
58+ else if (object == arg2_baseTimeImg.argField) {
59+ imageView_Action(event);
60+ }
61+ else if (object == arg2_baseTimeImg.openButton) {
62+ selectImage_Action(event);
63+ imageView_Action(event);
64+ }
65+ }
66+ }
67+
68+ @SuppressWarnings("OverridableMethodCallInConstructor")
69+ public RestampDialog(Frame parent, boolean modal) throws IOException {
70+ super(parent, modal);
71+
72+ // INIT_CONTROLS
73+ setLayout(new BorderLayout());
74+ setSize(
75+ getInsets().left + getInsets().right + 720,
76+ getInsets().top + getInsets().bottom + 480
77+ );
78+ setTitle(i18n.getString("menu.restamp") + "... ");
79+
80+ //---- CENTER -----
81+ JPanel mainPanel = new JPanel();
82+ mainPanel.setLayout(new BorderLayout());
83+ add(mainPanel, BorderLayout.CENTER);
84+
85+ //---- SOUTH -----
86+ JPanel southPanel = new JPanel(new BorderLayout());
87+ southPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
88+ southPanel.add(Box.createVerticalStrut(10), BorderLayout.NORTH);
89+ add(southPanel, BorderLayout.SOUTH);
90+
91+ //---- SPACE -----
92+ add(Box.createVerticalStrut(30), BorderLayout.NORTH);
93+ add(Box.createHorizontalStrut(10), BorderLayout.WEST);
94+ add(Box.createHorizontalStrut(10), BorderLayout.EAST);
95+
96+ closeButton = new java.awt.Button();
97+ closeButton.setLabel(i18n.getString("button.close") );
98+ closeButton.setBounds(145,65,66,27);
99+ southPanel.add(closeButton);
100+ //}}
101+
102+ //---------------------------------------------------------------------
103+ params = new AppParameters();
104+ cards = new JPanel[3];
105+ cardPanel = new JTabbedPane(JTabbedPane.LEFT);
106+ mainPanel.add(cardPanel, BorderLayout.CENTER);
107+ int cardNo = 0;
108+
109+ //---------------------------------------------------------------------
110+ // 1.[対象フォルダ]設定パネル
111+ {
112+ arg1_srcFolder = new ParameterPanelFolder(
113+ i18n.getString("label.110") +": ",
114+ params.getProperty(AppParameters.IMG_SOURCE_FOLDER)
115+ );
116+
117+ Card card = new CardSourceFolder(cardPanel, arg1_srcFolder);
118+ cardPanel.addTab(card.getTitle(), card);
119+ cardPanel.setEnabledAt(cardNo, true);
120+ cards[cardNo] = card;
121+ cardNo++;
122+ }
123+
124+ //---------------------------------------------------------------------
125+ // 2. [基準画像(開始)]選択パネル
126+ {
127+ // 基準時刻画像
128+ arg2_baseTimeImg = new ParameterPanelImageFile(
129+ i18n.getString("label.210") +": ",
130+ null,
131+ arg1_srcFolder
132+ );
133+
134+ CardFirstFile card = new CardFirstFile(cardPanel, arg2_baseTimeImg);
135+ cardPanel.addTab(card.getTitle(), card);
136+ cardPanel.setEnabledAt(cardNo, false);
137+ cards[cardNo] = card;
138+ cardNo++;
139+ }
140+
141+ //---------------------------------------------------------------------
142+ // 2a. 開始画像の本当の時刻を設定の入力画面
143+ {
144+ // 2a. 基準時刻:
145+ arg3_basetime = new ParameterPanel();
146+
147+ CardCorectTime card = new CardCorectTime(cardPanel, arg3_basetime);
148+ cardPanel.addTab(card.getTitle(), card);
149+ cardPanel.setEnabledAt(cardNo, false);
150+ cards[cardNo] = card;
151+ cardNo++;
152+ }
153+
154+ //{{REGISTER_LISTENERS
155+ SymWindow aSymWindow = new SymWindow();
156+ this.addWindowListener(aSymWindow);
157+ SymAction lSymAction = new SymAction();
158+ closeButton.addActionListener(lSymAction);
159+ //}}
160+ }
161+
162+ @SuppressWarnings("OverridableMethodCallInConstructor")
163+ public RestampDialog(Frame parent, String title, boolean modal) throws IOException {
164+ this(parent, modal);
165+ setTitle(title);
166+ }
167+
168+ @Override
169+ public void addNotify() {
170+ // Record the size of the window prior to calling parents addNotify.
171+
172+ super.addNotify();
173+
174+ // Only do this once.
175+ if (fComponentsAdjusted) {
176+ return;
177+ }
178+
179+ // Adjust components according to the insets
180+ setSize(getInsets().left + getInsets().right + getSize().width, getInsets().top + getInsets().bottom + getSize().height);
181+ Component components[] = getComponents();
182+ for (Component component : components) {
183+ Point p = component.getLocation();
184+ p.translate(getInsets().left, getInsets().top);
185+ component.setLocation(p);
186+ }
187+
188+ // Used for addNotify check.
189+ fComponentsAdjusted = true;
190+ }
191+
192+ /**
193+ * Shows or hides the component depending on the boolean flag b.
194+ * @param b if true, show the component; otherwise, hide the component.
195+ * @see java.awt.Component#isVisible
196+ */
197+ @Override
198+ public void setVisible(boolean b) {
199+ if(b) {
200+ Rectangle bounds = getParent().getBounds();
201+ Rectangle abounds = getBounds();
202+ setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
203+ bounds.y + (bounds.height - abounds.height)/2);
204+ }
205+ super.setVisible(b);
206+ }
207+
208+ void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) {
209+ dispose();
210+ }
211+
212+ void closeButton_Clicked(java.awt.event.ActionEvent event) {
213+ //{{CONNECTION
214+ // Clicked from okButton Hide the Dialog
215+ dispose();
216+ //}}
217+ }
218+
219+ ImageIcon refImage;
220+
221+ /**
222+ * 選択された画像ファイルを表示する
223+ * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
224+ * @param ev
225+ */
226+ @SuppressWarnings("UseSpecificCatch")
227+ public void imageView_Action(ActionEvent ev) {
228+ String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
229+
230+ File timeFile = new File(path);
231+ long lastModifyTime = timeFile.lastModified();
232+ arg3_basetime.argField.setText(AdjustTime.dfjp.format(new Date(lastModifyTime)));
233+
234+ int size_x = imageSPane.getWidth() - 8;
235+ ImageIcon tmpIcon = new ImageIcon(path);
236+ refImage = tmpIcon;
237+ if (tmpIcon.getIconWidth() > size_x) {
238+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT));
239+ }
240+ imageLabel.setIcon(refImage);
241+ repaint();
242+ }
243+
244+ public void selectImage_Action(ActionEvent ev) {
245+ JFileChooser fc;
246+
247+ File sdir = new File(arg1_srcFolder.getText());
248+ System.out.println(sdir.getPath());
249+ if (sdir.isDirectory()) {
250+ fc = new JFileChooser(sdir);
251+ }
252+ else {
253+ fc = new JFileChooser();
254+ }
255+
256+ fc.addChoosableFileFilter(new ImageFilter());
257+ fc.setAcceptAllFileFilterUsed(false);
258+ fc.setFileView(new ImageFileView());
259+ fc.setAccessory(new ImagePreview(fc));
260+
261+ //Show it. "選択"
262+ int returnVal = fc.showDialog(this, i18n.getString("dialog.select"));
263+ if (returnVal == JFileChooser.APPROVE_OPTION) {
264+ File file = fc.getSelectedFile();
265+ arg2_baseTimeImg.argField.setText(file.getName());
266+ }
267+ fc.setSelectedFile(null);
268+ }
269+}
Show on old repository browser