OSDN Git Service

issue: Restampからダイアログが表示できない
authorhaya4 <hayashi.yuu@gmail.com>
Mon, 14 Oct 2019 01:13:18 +0000 (10:13 +0900)
committerhaya4 <hayashi.yuu@gmail.com>
Mon, 14 Oct 2019 01:13:18 +0000 (10:13 +0900)
src/i18n.properties
src/i18n_ja_JP.properties
src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java
src/osm/jp/gpx/matchtime/gui/ParameterPanelImageFile.java
src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
src/osm/jp/gpx/matchtime/gui/restamp/CardFirstFile.java
src/osm/jp/gpx/matchtime/gui/restamp/DialogCorectTime.java [moved from src/osm/jp/gpx/matchtime/gui/restamp/CardCorectTime.java with 69% similarity]
src/osm/jp/gpx/matchtime/gui/restamp/RestampDialog.java

index ebda465..7bdf409 100644 (file)
@@ -12,6 +12,7 @@ button.next=Next
 button.previous=Previous
 button.execute=Execute
 button.select=Selection...
+button.update=Update...
 
 tab.100=1. Source image Folder
 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>
@@ -59,3 +60,4 @@ msg.220=[error] Not exists <baseFile1>.
 msg.230=[error] <baseFile1> is not a file.
 msg.240=[error] Not exists <baseFile2>.
 msg.250=[error] <baseFile2> is not a file.
+IMAGES/FIT16.GIF=images/Fit16.gif
index 7c93dba..e0cb33c 100644 (file)
@@ -12,6 +12,7 @@ button.next=\u6b21\u3078
 button.previous=\u623b\u308b
 button.execute=\u51e6\u7406\u5b9f\u884c
 button.select=\u9078\u629e...
+button.update=\u5909\u66f4...
 
 tab.100=1. \u753b\u50cf\u5143\u306e\u30d5\u30a1\u30a4\u30eb\u30d5\u30a9\u30eb\u30c0
 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>
@@ -60,3 +61,4 @@ msg.220=[error] <baseFile1>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
 msg.230=[error] <baseFile1>\u304c\u30d5\u30a1\u30a4\u30eb\u3058\u3083\u306a\u3044
 msg.240=[error] <baseFile1>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
 msg.250=[error] <baseFile1>\u304c\u30d5\u30a1\u30a4\u30eb\u3058\u3083\u306a\u3044
+IMAGES/FIT16.GIF=images/Fit16.gif
index 6b18464..8365f92 100644 (file)
@@ -11,7 +11,7 @@ import javax.swing.JFileChooser;
 public class ParameterPanelFolder extends ParameterPanel implements ActionListener
 {
     JFileChooser fc;
-    JButton openButton;
+    JButton selectButton;
     int chooser;
 
     @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
@@ -22,12 +22,12 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
         this.chooser = chooser;
 
         // "選択..."
-        openButton = new JButton(
+        selectButton = new JButton(
             i18n.getString("button.select"),
             AdjustTime.createImageIcon("images/Open16.gif")
         );
-        openButton.addActionListener(this);
-        this.add(openButton);
+        selectButton.addActionListener(this);
+        this.add(selectButton);
     }
 
     public ParameterPanelFolder(String label, String text) {
@@ -36,7 +36,7 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
 
     public void setEnable(boolean f) {
         super.setEnabled(f);
-        openButton.setEnabled(f);
+        selectButton.setEnabled(f);
     }
 
     public File getDirectory() throws FileNotFoundException {
@@ -56,7 +56,7 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
        
     @Override
     public void actionPerformed(ActionEvent e) {
-        if (e.getSource() == openButton){
+        if (e.getSource() == selectButton){
             System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
             File sdir;
             try {
index 1cb8853..84e40e7 100644 (file)
@@ -61,6 +61,25 @@ public class ParameterPanelImageFile extends ParameterPanel {
         fc.setSelectedFile(null);
     }
     
+    public File getImageFile() {
+        if (this.paramDir.isEnable()) {
+            String text = this.argField.getText();
+            if (text != null) {
+                try {
+                    File dir = this.paramDir.getDirectory();
+                    File file = new File(dir, text);
+                    if (file.exists() && file.isFile()) {
+                        return file;
+                    }
+                }
+                catch (FileNotFoundException e) {
+                    return null;
+                }
+            }
+        }
+        return null;
+    }
+    
     /**
      * 
      * @return 
index 8c27aeb..100db25 100644 (file)
@@ -1,17 +1,21 @@
 package osm.jp.gpx.matchtime.gui;
 
+import java.awt.Dialog;
 import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+import javax.swing.JButton;
+import osm.jp.gpx.matchtime.gui.restamp.DialogCorectTime;
 
 /**
  * パラメータを設定する為のパネル。
  * この1インスタンスで、1パラメータをあらわす。
  */
-public class ParameterPanelTime extends ParameterPanel implements ActionListener {
+public class ParameterPanelTime extends ParameterPanel {
     SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getDateTimeInstance();
     ParameterPanelImageFile imageFile;
+    public JButton updateButton;
+    Dialog owner;
 
     @SuppressWarnings("OverridableMethodCallInConstructor")
     public ParameterPanelTime(
@@ -21,6 +25,34 @@ public class ParameterPanelTime extends ParameterPanel implements ActionListener
     ) {
         super(label, text);
         this.imageFile = imageFile;
+        
+        // "ボタン[変更...]"
+        UpdateButtonAction buttonAction = new UpdateButtonAction(this);
+        updateButton = new JButton(i18n.getString("button.update"));
+        updateButton.addActionListener(buttonAction);
+        this.add(updateButton);
+    }
+    
+    public ParameterPanelTime setOwner(Dialog owner) {
+        this.owner = owner;
+        return this;
+    } 
+    
+    /**
+     * ボタンのアクション
+     */
+    class UpdateButtonAction implements java.awt.event.ActionListener
+    {
+        ParameterPanelTime param;
+        
+        public UpdateButtonAction(ParameterPanelTime param) {
+            this.param = param;
+        }
+        
+        @SuppressWarnings("override")
+        public void actionPerformed(ActionEvent e) {
+            (new DialogCorectTime(param, owner)).setVisible(true);
+        }
     }
     
     public ParameterPanelImageFile getImageFile() {
@@ -28,11 +60,6 @@ public class ParameterPanelTime extends ParameterPanel implements ActionListener
     }
 
     @Override
-    public void actionPerformed(ActionEvent arg0) {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
-    }
-
-    @Override
     public boolean isEnable() {
         if (this.imageFile.isEnable()) {
             String text = this.argField.getText();
index 1376423..9913029 100644 (file)
@@ -2,6 +2,7 @@ package osm.jp.gpx.matchtime.gui.restamp;
 
 import java.awt.BorderLayout;
 import java.awt.Dimension;
+import java.awt.Dialog;
 import javax.swing.BoxLayout;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
@@ -26,12 +27,15 @@ public class CardFirstFile extends Card  implements PanelAction {
      * コンストラクタ
      * @param tabbe parent panel
      * @param arg_basetime             // 開始画像の基準時刻:
+     * @param owner
      */
     public CardFirstFile(
             JTabbedPane tabbe, 
-            ParameterPanelTime arg_basetime
+            ParameterPanelTime arg_basetime,
+            Dialog owner
     ) {
         super(tabbe, AdjustTime.i18n.getString("tab.restamp.200"), 0, 2);
+        arg_basetime.setOwner(owner);
         this.arg_baseTimeImg = arg_basetime.getImageFile();
         this.arg_basetime = arg_basetime;
         
@@ -1,18 +1,17 @@
 package osm.jp.gpx.matchtime.gui.restamp;
 
 import java.awt.BorderLayout;
+import java.awt.Dialog;
 import java.awt.GridLayout;
 import javax.swing.BoxLayout;
 import javax.swing.JButton;
+import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.JTabbedPane;
-import osm.jp.gpx.ImportPicture;
 import osm.jp.gpx.matchtime.gui.AdjustTime;
 import static osm.jp.gpx.matchtime.gui.AdjustTime.createImageIcon;
 import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
-import osm.jp.gpx.matchtime.gui.Card;
 import osm.jp.gpx.matchtime.gui.PanelAction;
 import osm.jp.gpx.matchtime.gui.ParameterPanelTime;
 
@@ -20,24 +19,26 @@ import osm.jp.gpx.matchtime.gui.ParameterPanelTime;
  * [基準画像(開始)]選択パネル
  * @author yuu
  */
-public class CardCorectTime extends Card implements PanelAction {
+public class DialogCorectTime extends JDialog implements PanelAction {
+    public JPanel mainPanel;
     JPanel argsPanel;          // パラメータ設定パネル       (上部)
     ParameterPanelTime arg_basetime;   // 開始画像の基準時刻:
     
     /**
      * コンストラクタ
-     * @param tabbe parent panel
      * @param arg3_basetime       開始画像の基準時刻:
+     * @param owner
      */
-    public CardCorectTime(JTabbedPane tabbe, ParameterPanelTime arg3_basetime) {
-        super(tabbe, AdjustTime.i18n.getString("tab.restamp.300"), 1, 3);
+    public DialogCorectTime(ParameterPanelTime arg3_basetime, Dialog owner) {
+        super(owner, AdjustTime.i18n.getString("tab.restamp.300"), false);
         
         argsPanel = new JPanel();
         argsPanel.setLayout(new GridLayout(2, 1));
         
         //---- CENTER -----
-        this.mainPanel.setLayout(new BorderLayout());
-        this.add(mainPanel, BorderLayout.CENTER);
+        JPanel centerPanel = new JPanel();
+        centerPanel.setLayout(new BorderLayout());
+        add(centerPanel, BorderLayout.CENTER);
 
         // 3. 正確な撮影時刻を入力してください。
         //    カメラの時計が正確ならば、設定を変更する必要はありません。
@@ -47,26 +48,26 @@ public class CardCorectTime extends Card implements PanelAction {
 
         // 基準時刻:
         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);
-        this.mainPanel.add(argsPanel, BorderLayout.NORTH);
+        //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);
 
         // 参考画像
         JLabel imageLabel = new JLabel();
         JScrollPane imageSPane = new JScrollPane(imageLabel);
-        this.mainPanel.add(imageSPane, BorderLayout.CENTER);
+        centerPanel.add(imageSPane, BorderLayout.CENTER);
 
         // 画像ファイル選択ダイアログを起動するボタン
         JPanel buttonPanel = new JPanel();
         buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
-        JButton openButton = new JButton(createImageIcon("images/Fit16.gif"));
+        JButton openButton = new JButton(createImageIcon(java.util.ResourceBundle.getBundle("i18n_ja_JP").getString("IMAGES/FIT16.GIF")));
         buttonPanel.add(openButton);
         JButton zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
         buttonPanel.add(zoomInButton);
         JButton zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
         buttonPanel.add(zoomOutButton);
-        this.mainPanel.add(buttonPanel, BorderLayout.SOUTH);
+        centerPanel.add(buttonPanel, BorderLayout.SOUTH);
     }
 
     @Override
index 5b00348..bc72d08 100644 (file)
@@ -171,7 +171,7 @@ public class RestampDialog extends Dialog implements Observer
                 }
             );
             
-            CardFirstFile card = new CardFirstFile(cardPanel, arg2_basetime);
+            CardFirstFile card = new CardFirstFile(cardPanel, arg2_basetime, this);
             cardPanel.addTab(card.getTitle(), card);
             cardPanel.setEnabledAt(cardNo, false);
             cards[cardNo] = card;