1 package osm.jp.gpx.matchtime.gui;
3 import java.awt.Dialog;
4 import java.awt.event.ActionEvent;
6 import java.text.DateFormat;
7 import java.text.SimpleDateFormat;
9 import javax.swing.JButton;
10 import osm.jp.gpx.Restamp;
11 import osm.jp.gpx.matchtime.gui.restamp.DialogCorectTime;
15 * この1インスタンスで、1パラメータをあらわす。
17 public class ParameterPanelTime extends ParameterPanel {
18 SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getDateTimeInstance();
19 ParameterPanelImageFile imageFile;
20 public JButton updateButton;
21 public JButton resetButton;
24 @SuppressWarnings("OverridableMethodCallInConstructor")
25 public ParameterPanelTime(
28 ParameterPanelImageFile imageFile
31 this.imageFile = imageFile;
34 UpdateButtonAction buttonAction = new UpdateButtonAction(this);
35 updateButton = new JButton(i18n.getString("button.update"));
36 updateButton.addActionListener(buttonAction);
37 this.add(updateButton);
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);
47 public ParameterPanelTime setOwner(Dialog owner) {
55 class UpdateButtonAction implements java.awt.event.ActionListener
57 ParameterPanelTime param;
59 public UpdateButtonAction(ParameterPanelTime param) {
63 @SuppressWarnings("override")
64 public void actionPerformed(ActionEvent e) {
65 (new DialogCorectTime(param, owner)).setVisible(true);
72 class ResetButtonAction implements java.awt.event.ActionListener
74 ParameterPanelTime param;
76 public ResetButtonAction(ParameterPanelTime param) {
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(Restamp.TIME_PATTERN);
86 param.argField.setText(sdf.format(new Date(lastModified)));
89 param.argField.setText("");
94 public ParameterPanelImageFile getImageFile() {
95 return this.imageFile;
99 public boolean isEnable() {
100 if (this.imageFile.isEnable()) {
101 String text = this.argField.getText();
104 sdf.applyPattern(Restamp.TIME_PATTERN);
108 catch (Exception e) {