• R/O
  • HTTP
  • SSH
  • HTTPS

importpicture: Commit


Commit MetaInfo

Revision0c6b4083868fa3538d8a70ad29cdced4bc08a4a9 (tree)
Time2019-10-14 12:31:03
Authorhaya4 <hayashi.yuu@gmai...>
Commiterhaya4

Log Message

fixed: Restampからダイアログが表示できない

Change Summary

Incremental Difference

--- a/src/i18n.properties
+++ b/src/i18n.properties
@@ -13,6 +13,7 @@ button.previous=Previous
1313 button.execute=Execute
1414 button.select=Selection...
1515 button.update=Update...
16+button.reset=Reset...
1617
1718 tab.100=1. Source image Folder
1819 label.100=<html><p>1. Select image source folder.</p><ul><li>If you perform a copy operation, the file update time may be rewritten to the time the copy was executed. It is recommended to directly specify the folder in the camera SD card.</li></ul>
--- a/src/i18n_ja_JP.properties
+++ b/src/i18n_ja_JP.properties
@@ -13,6 +13,7 @@ button.previous=\u623b\u308b
1313 button.execute=\u51e6\u7406\u5b9f\u884c
1414 button.select=\u9078\u629e...
1515 button.update=\u5909\u66f4...
16+button.reset=\u518d\u8a2d\u5b9a...
1617
1718 tab.100=1. \u753b\u50cf\u5143\u306e\u30d5\u30a1\u30a4\u30eb\u30d5\u30a9\u30eb\u30c0
1819 label.100=<html><p>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</p><ul><li>\u30b3\u30d4\u30fc\u52d5\u4f5c\u3092\u884c\u3046\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u66f4\u65b0\u6642\u523b\u304c\u30b3\u30d4\u30fc\u3092\u5b9f\u884c\u3057\u305f\u6642\u523b\u306b\u66f8\u304d\u63db\u308f\u3063\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u30ab\u30e1\u30e9SD\u30ab\u30fc\u30c9\u5185\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u76f4\u63a5\u6307\u5b9a\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002</li></ul>
--- a/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
+++ b/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
@@ -2,8 +2,10 @@ package osm.jp.gpx.matchtime.gui;
22
33 import java.awt.Dialog;
44 import java.awt.event.ActionEvent;
5+import java.io.File;
56 import java.text.DateFormat;
67 import java.text.SimpleDateFormat;
8+import java.util.Date;
79 import javax.swing.JButton;
810 import osm.jp.gpx.matchtime.gui.restamp.DialogCorectTime;
911
@@ -12,9 +14,11 @@ import osm.jp.gpx.matchtime.gui.restamp.DialogCorectTime;
1214 * この1インスタンスで、1パラメータをあらわす。
1315 */
1416 public class ParameterPanelTime extends ParameterPanel {
17+ static final String TIME_PATTERN = "yyyy.MM.dd HH:mm:ss z";
1518 SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getDateTimeInstance();
1619 ParameterPanelImageFile imageFile;
1720 public JButton updateButton;
21+ public JButton resetButton;
1822 Dialog owner;
1923
2024 @SuppressWarnings("OverridableMethodCallInConstructor")
@@ -31,12 +35,19 @@ public class ParameterPanelTime extends ParameterPanel {
3135 updateButton = new JButton(i18n.getString("button.update"));
3236 updateButton.addActionListener(buttonAction);
3337 this.add(updateButton);
38+
39+ // "ボタン[再設定...]"
40+ ResetButtonAction resetAction = new ResetButtonAction(this);
41+ resetButton = new JButton(i18n.getString("button.reset"));
42+ resetButton.addActionListener(resetAction);
43+ resetButton.setVisible(false);
44+ this.add(resetButton);
3445 }
3546
3647 public ParameterPanelTime setOwner(Dialog owner) {
3748 this.owner = owner;
3849 return this;
39- }
50+ }
4051
4152 /**
4253 * ボタンのアクション
@@ -55,6 +66,31 @@ public class ParameterPanelTime extends ParameterPanel {
5566 }
5667 }
5768
69+ /**
70+ * ボタンのアクション
71+ */
72+ class ResetButtonAction implements java.awt.event.ActionListener
73+ {
74+ ParameterPanelTime param;
75+
76+ public ResetButtonAction(ParameterPanelTime param) {
77+ this.param = param;
78+ }
79+
80+ @SuppressWarnings("override")
81+ public void actionPerformed(ActionEvent e) {
82+ if (param.imageFile.isEnable()) {
83+ File file = param.imageFile.getImageFile();
84+ long lastModified = file.lastModified();
85+ sdf.applyPattern(TIME_PATTERN);
86+ param.argField.setText(sdf.format(new Date(lastModified)));
87+ }
88+ else {
89+ param.argField.setText("");
90+ }
91+ }
92+ }
93+
5894 public ParameterPanelImageFile getImageFile() {
5995 return this.imageFile;
6096 }
@@ -65,7 +101,7 @@ public class ParameterPanelTime extends ParameterPanel {
65101 String text = this.argField.getText();
66102 if (text != null) {
67103 try {
68- sdf.applyPattern("yyyy.MM.dd HH:mm:ss z");
104+ sdf.applyPattern(TIME_PATTERN);
69105 sdf.parse(text);
70106 return true;
71107 }
--- a/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java
+++ b/src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java
@@ -3,6 +3,7 @@ package osm.jp.gpx.matchtime.gui.restamp;
33 import java.awt.BorderLayout;
44 import java.awt.Dialog;
55 import java.awt.GridLayout;
6+import java.awt.Rectangle;
67 import javax.swing.BoxLayout;
78 import javax.swing.JButton;
89 import javax.swing.JDialog;
@@ -21,8 +22,9 @@ import osm.jp.gpx.matchtime.gui.ParameterPanelTime;
2122 */
2223 public class DialogCorectTime extends JDialog implements PanelAction {
2324 public JPanel mainPanel;
24- JPanel argsPanel; // パラメータ設定パネル (上部)
2525 ParameterPanelTime arg_basetime; // 開始画像の基準時刻:
26+ ParameterPanelTime basetime; // 開始画像の基準時刻:
27+ java.awt.Button closeButton;
2628
2729 /**
2830 * コンストラクタ
@@ -31,33 +33,48 @@ public class DialogCorectTime extends JDialog implements PanelAction {
3133 */
3234 public DialogCorectTime(ParameterPanelTime arg3_basetime, Dialog owner) {
3335 super(owner, AdjustTime.i18n.getString("tab.restamp.300"), false);
36+ this.arg_basetime = arg3_basetime;
3437
35- argsPanel = new JPanel();
36- argsPanel.setLayout(new GridLayout(2, 1));
37-
38+ // INIT_CONTROLS
39+ setLayout(new BorderLayout());
40+ setSize(
41+ getInsets().left + getInsets().right + 720,
42+ getInsets().top + getInsets().bottom + 480
43+ );
44+
3845 //---- CENTER -----
3946 JPanel centerPanel = new JPanel();
4047 centerPanel.setLayout(new BorderLayout());
4148 add(centerPanel, BorderLayout.CENTER);
4249
50+ //---- CENTER.NORTH -----
51+ JPanel argsPanel; // パラメータ設定パネル (上部)
52+ argsPanel = new JPanel();
53+ argsPanel.setLayout(new GridLayout(2, 1));
54+
4355 // 3. 正確な撮影時刻を入力してください。
4456 // カメラの時計が正確ならば、設定を変更する必要はありません。
4557 JLabel label3 = new JLabel();
4658 label3.setText(i18n.getString("label.300"));
4759 argsPanel.add(label3);
4860
49- // 基準時刻:
50- this.arg_basetime = arg3_basetime;
51- //arg3_basetime.setLabel(String.format("  %s: ", i18n.getString("label.310")));
52- //arg3_basetime.setLabel(ImportPicture.TIME_FORMAT_STRING);
53- //argsPanel.add(arg3_basetime);
54- //centerPanel.add(argsPanel, BorderLayout.NORTH);
61+ basetime = new ParameterPanelTime(
62+ arg3_basetime.argLabel.getText(),
63+ "",
64+ arg3_basetime.getImageFile()
65+ );
66+ basetime.updateButton.setVisible(false);
67+ basetime.resetButton.setVisible(true);
68+ argsPanel.add(basetime);
69+ centerPanel.add(argsPanel, BorderLayout.NORTH);
5570
71+ //---- CENTER.CENTER -----
5672 // 参考画像
5773 JLabel imageLabel = new JLabel();
5874 JScrollPane imageSPane = new JScrollPane(imageLabel);
5975 centerPanel.add(imageSPane, BorderLayout.CENTER);
6076
77+ //---- CENTER.SOUTH -----
6178 // 画像ファイル選択ダイアログを起動するボタン
6279 JPanel buttonPanel = new JPanel();
6380 buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
@@ -68,6 +85,61 @@ public class DialogCorectTime extends JDialog implements PanelAction {
6885 JButton zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
6986 buttonPanel.add(zoomOutButton);
7087 centerPanel.add(buttonPanel, BorderLayout.SOUTH);
88+
89+ //---- SOUTH -----
90+ closeButton = new java.awt.Button();
91+ closeButton.setLabel(i18n.getString("button.close") );
92+ closeButton.setBounds(145,65,66,27);
93+ add(closeButton, BorderLayout.SOUTH);
94+
95+ //{{REGISTER_LISTENERS
96+ SymWindow aSymWindow = new SymWindow();
97+ this.addWindowListener(aSymWindow);
98+ SymAction lSymAction = new SymAction();
99+ closeButton.addActionListener(lSymAction);
100+ //}}
101+ }
102+
103+ class SymWindow extends java.awt.event.WindowAdapter
104+ {
105+ @Override
106+ public void windowClosing(java.awt.event.WindowEvent event) {
107+ Object object = event.getSource();
108+ if (object == DialogCorectTime.this) {
109+ dialog_WindowClosing();
110+ }
111+ }
112+ }
113+
114+ class SymAction implements java.awt.event.ActionListener
115+ {
116+ @Override
117+ public void actionPerformed(java.awt.event.ActionEvent event) {
118+ Object object = event.getSource();
119+ if (object == closeButton) {
120+ dialog_WindowClosing();
121+ }
122+ }
123+ }
124+
125+ /**
126+ * ダイアログが閉じられるときのアクション
127+ */
128+ void dialog_WindowClosing() {
129+ String workStr = basetime.getText();
130+ arg_basetime.setText(workStr);
131+ dispose();
132+ }
133+
134+ @Override
135+ public void setVisible(boolean b) {
136+ if(b) {
137+ Rectangle bounds = getParent().getBounds();
138+ Rectangle abounds = getBounds();
139+ setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
140+ bounds.y + (bounds.height - abounds.height)/2);
141+ }
142+ super.setVisible(b);
71143 }
72144
73145 @Override
--- 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 class RestampDialog extends Dialog implements Observer
5757 public void windowClosing(java.awt.event.WindowEvent event) {
5858 Object object = event.getSource();
5959 if (object == RestampDialog.this) {
60- AboutDialog_WindowClosing(event);
60+ dispose();
6161 }
6262 }
6363 }
@@ -68,7 +68,7 @@ public class RestampDialog extends Dialog implements Observer
6868 public void actionPerformed(java.awt.event.ActionEvent event) {
6969 Object object = event.getSource();
7070 if (object == closeButton) {
71- closeButton_Clicked(event);
71+ dispose();
7272 }
7373 else if (object == arg2_baseTimeImg.argField) {
7474 imageView_Action(event);
@@ -259,17 +259,6 @@ public class RestampDialog extends Dialog implements Observer
259259 super.setVisible(b);
260260 }
261261
262- void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) {
263- dispose();
264- }
265-
266- void closeButton_Clicked(java.awt.event.ActionEvent event) {
267- //{{CONNECTION
268- // Clicked from okButton Hide the Dialog
269- dispose();
270- //}}
271- }
272-
273262 ImageIcon refImage;
274263
275264 /**
Show on old repository browser