package osm.jp.gpx.matchtime.gui.restamp;
import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.io.File;
import java.io.IOException;
-import java.util.Date;
import java.util.Observable;
import java.util.Observer;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import osm.jp.gpx.AppParameters;
-import osm.jp.gpx.matchtime.gui.AdjustTime;
import osm.jp.gpx.matchtime.gui.Card;
-import osm.jp.gpx.matchtime.gui.ImageFileView;
-import osm.jp.gpx.matchtime.gui.ImageFilter;
-import osm.jp.gpx.matchtime.gui.ImagePreview;
import osm.jp.gpx.matchtime.gui.ParameterPanelFolder;
import osm.jp.gpx.matchtime.gui.ParameterPanelImageFile;
import static osm.jp.gpx.matchtime.gui.AdjustTime.i18n;
public class RestampDialog extends Dialog implements Observer
{
//{{DECLARE_CONTROLS
- java.awt.Label label1;
java.awt.Button closeButton;
- java.awt.Label label2;
- JLabel imageLabel; // 開始画像の基準時刻画像表示
JTabbedPane cardPanel; // ウィザード形式パネル(タブ型)
- JScrollPane imageSPane; // スクロールパネル
Card[] cards;
ParameterPanelFolder arg1_srcFolder; // 対象フォルダ
ParameterPanelImageFile arg2_baseTimeImg; // 開始画像ファイルパス
AppParameters params;
//}}
- // Used for addNotify redundency check.
- boolean fComponentsAdjusted = false;
-
/**
*
* @param arg0
if (object == closeButton) {
dispose();
}
- else if (object == arg2_baseTimeImg.argField) {
- imageView_Action(event);
- }
- else if (object == arg2_baseTimeImg.openButton) {
- selectImage_Action(event);
- imageView_Action(event);
- }
}
}
setTitle(title);
}
+ // Used for addNotify redundency check.
+ boolean fComponentsAdjusted = false;
+
@Override
public void addNotify() {
// Record the size of the window prior to calling parents addNotify.
-
super.addNotify();
// Only do this once.
}
super.setVisible(b);
}
-
- ImageIcon refImage;
-
- /**
- * 選択された画像ファイルを表示する
- * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
- * @param ev
- */
- @SuppressWarnings("UseSpecificCatch")
- public void imageView_Action(ActionEvent ev) {
- String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
-
- File timeFile = new File(path);
- long lastModifyTime = timeFile.lastModified();
- arg2_basetime.argField.setText(AdjustTime.dfjp.format(new Date(lastModifyTime)));
-
- int size_x = imageSPane.getWidth() - 8;
- ImageIcon tmpIcon = new ImageIcon(path);
- refImage = tmpIcon;
- if (tmpIcon.getIconWidth() > size_x) {
- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT));
- }
- imageLabel.setIcon(refImage);
- repaint();
- }
-
- public void selectImage_Action(ActionEvent ev) {
- JFileChooser fc;
-
- File sdir = new File(arg1_srcFolder.getText());
- System.out.println(sdir.getPath());
- if (sdir.isDirectory()) {
- fc = new JFileChooser(sdir);
- }
- else {
- fc = new JFileChooser();
- }
-
- fc.addChoosableFileFilter(new ImageFilter());
- fc.setAcceptAllFileFilterUsed(false);
- fc.setFileView(new ImageFileView());
- fc.setAccessory(new ImagePreview(fc));
-
- //Show it. "選択"
- int returnVal = fc.showDialog(this, i18n.getString("dialog.select"));
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- arg2_baseTimeImg.argField.setText(file.getName());
- }
- fc.setSelectedFile(null);
- }
}