--- /dev/null
+java -cp ./importPicture.jar osm.jp.gpx.matchtime.gui.MatchTime
+pause
--- /dev/null
+java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 09.14.01 自動.gpx"
+java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 09.59.09 自動.gpx"
+java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 10.44.19 自動.gpx"
+java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 11.29.22 自動.gpx"
+java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 12.14.49 自動.gpx"
+java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/20140101.gpx"
+java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/Current.gpx"
-java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 09.14.01 自動.gpx"
-java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 09.59.09 自動.gpx"
-java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 10.44.19 自動.gpx"
-java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 11.29.22 自動.gpx"
-java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/2014-01-01 12.14.49 自動.gpx"
-java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/20140101.gpx"
-java -jar importPicture.jar list.csv /home/hayashi/osm/20140101/10040101 DSC01396.JPG 2014-01-01T15:46:56 "/home/hayashi/osm/20140101/Current.gpx"
+java -jar importPicture.jar list.csv 10040101 DSC01396.JPG 2014-01-01T15:46:56
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-import java.awt.BorderLayout;
-import java.awt.FlowLayout;
-import java.awt.Font;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import osm.jp.gpx.ImportPicture;
-
-@SuppressWarnings("serial")
-public class AboutDialog extends JDialog implements WindowListener
-{
- static final String TITLE = PictureMapper.PROGRAM_NAME;
- static final String COPY_RIGHT = "Copyright (c) 2014 Yuu Hayashi. This software is released under the MIT License.";
-
- JLabel label1;
- JButton okButton;
- JLabel label2;
- JTextArea textArea;
- JFrame parent;
-
- public AboutDialog(JFrame parent, boolean modal) {
- super(parent, modal);
- addWindowListener(this);
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- this.parent = parent;
- setTitle("About...");
- getContentPane().setLayout(new BorderLayout());
- setSize(512,320);
-
- //--------------------------------------------------------
- // 上部パネル
- //-----------------------------------------------
- label1 = new JLabel(TITLE, JLabel.CENTER);
- add(BorderLayout.NORTH, label1);
-
- //--------------------------------------------------------
- // 中央パネル
- //-----------------------------------------------
-
- /*
- * [README.txt]ファイルの内容を表示するTEXTAREA
- */
- textArea = new JTextArea(7, 60);
- textArea.setEditable(false);
- textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
- JScrollPane scrollPane = new JScrollPane(textArea);
- scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
- add(BorderLayout.CENTER, scrollPane);
-
- URL url = getClass().getResource("/README.txt");
- InputStream is;
- try {
- is = url.openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
- while (br.ready()) {
- textArea.append(br.readLine() + "\n");
- }
- textArea.setCaretPosition(0);
- br.close();
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- //--------------------------------------------------------
- // 下部パネル
- //-----------------------------------------------
- JPanel bottonPanel = new JPanel();
- bottonPanel.setLayout(new BorderLayout());
- add(BorderLayout.SOUTH, bottonPanel);
-
- /*
- * [OK]ボタン : このダイアログウインドウを閉じる
- */
- okButton = new JButton("OK");
- okButton.setBounds(145,65,66,27);
- okButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(AboutDialog.this, WindowEvent.WINDOW_CLOSING));
- setVisible(false);
- }
- });
- JPanel okPanel = new JPanel(new FlowLayout());
- try {
- okPanel.add(okButton);
- }
- catch(Exception e) {
- e.printStackTrace();
- ImportPicture.logger.warning(e.toString());
- }
- bottonPanel.add(BorderLayout.CENTER, okPanel);
-
- /*
- * コピーライト表示
- */
- label2 = new JLabel(COPY_RIGHT, JLabel.CENTER);
- label2.setBounds(10,40,340,20);
- bottonPanel.add(BorderLayout.SOUTH, label2);
-
- setVisible(true);
- }
-
- /**
- * Shows or hides the component depending on the boolean flag b.
- * @param b if true, show the component; otherwise, hide the component.
- * @see java.awt.Component#isVisible
- */
- public void setVisible(boolean b) {
- if (b) {
- Rectangle bounds = getParent().getBounds();
- Rectangle abounds = getBounds();
- setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
- bounds.y + (bounds.height - abounds.height)/2);
- }
- super.setVisible(b);
- }
-
- public void windowClosed(WindowEvent e) {
- setVisible(false);
- }
-
- public void windowActivated(WindowEvent arg0) {
- }
-
- public void windowClosing(WindowEvent arg0) {
- setVisible(false);
- }
-
- public void windowDeactivated(WindowEvent arg0) {
- }
-
- public void windowDeiconified(WindowEvent arg0) {
- }
-
- public void windowIconified(WindowEvent arg0) {
- }
-
- public void windowOpened(WindowEvent arg0) {
- }
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Iterator;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import jp.co.areaweb.tools.csv.CsvRecord;
-
-public class CollectData
-{
- public Calendar date = Calendar.getInstance();
- public String address = null;
- public String name = null;
- public String data = "";
- public static Calendar baseDate = null;
- public static String[] columnNames = {"日時", "カードID", "送信先アドレス","なまえ"};
-
- static final String DATETIME_PATTERN = "yyyy/MM/dd'-'HH:mm:ss";
- static SimpleDateFormat dateTimePattern = new SimpleDateFormat(DATETIME_PATTERN);
-
- /**
- * コンストラクタ: データコレクタで取得したデータ
- * @param datetime
- * @param data
- * @param address
- * @param name
- */
- public CollectData(Date datetime, String data, String address, String name) {
- date.setTime(datetime);
- if (date.get(Calendar.YEAR) < 2000) {
- if (baseDate != null) {
- date.set(baseDate.get(Calendar.YEAR), baseDate.get(Calendar.MONTH), baseDate.get(Calendar.DAY_OF_MONTH));
- }
- }
- else {
- CollectData.baseDate = Calendar.getInstance();
- CollectData.baseDate.set(date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH));
- }
- this.data = data;
- if (address == null) {
- this.address = getAddress(data);
- }
- else {
- this.address = address;
- }
- if (name == null) {
- this.name = getName(data);
- }
- else {
- this.name = name;
- }
- }
-
- public CollectData(Date datetime, String data) {
- this(datetime, data, null, null);
- }
-
- /**
- * 収集データをXML形式にして表現する。
- * @return XMLレコード
- */
- public Element getXmlElement(Document document) {
- Element point = document.createElement("point");
- point.setAttribute("id", this.data);
- point.setAttribute("datetime", dateTimePattern.format(this.date.getTime()));
-
- Element addrEle = document.createElement("address");
- addrEle.appendChild(document.createTextNode(this.address));
- point.appendChild(addrEle);
-
- Element nameEle = document.createElement("name");
- nameEle.appendChild(document.createTextNode(this.name));
- point.appendChild(nameEle);
-
- return point;
- }
-
-
- /**
- * [javax.swing.table.DefaultTableModel]用のレコード形式を取得する。
- * @return
- */
- public String[] getRecordStrs() {
- String[] strs = new String[4];
- strs[0] = dateTimePattern.format(this.date.getTime());
- strs[1] = this.data;
- strs[2] = this.address;
- strs[3] = this.name;
- return strs;
- }
-
- /**
- * カードIDを取得する
- * @return カードID(IDm) - 16文字の16進表記 '01010310DA09D027'
- */
- public long getId() {
- return Long.parseLong(this.data, 16);
- }
-
- public String getAddress(String dataStr) {
- if (PictureMapper.taglistFile == null) {
- return "";
- }
- for (Iterator<CsvRecord> i = PictureMapper.taglistFile.iterator(); i.hasNext(); ) {
- CsvRecord record = i.next();
- String idStr = (String)record.get(0); // ID
- if (idStr.equals(dataStr)) {
- return (String)record.get(1); // ID
- }
- }
- return "";
- }
-
- public String getName(String dataStr) {
- if (PictureMapper.taglistFile == null) {
- return "";
- }
- for (Iterator<CsvRecord> i = PictureMapper.taglistFile.iterator(); i.hasNext(); ) {
- CsvRecord record = i.next();
- String idStr = (String)record.get(0); // ID
- if (idStr.equals(dataStr)) {
- try {
- String ret = (String)record.get(2); // ID
- return ret; // ID
- }
- catch (IndexOutOfBoundsException ioobe) {
- return "";
- }
- }
- }
- return "";
- }
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- * public class PropertyItem extends JPanel implements ActionListener
- * @author hayashi
- *
- */
-@SuppressWarnings("serial")
-public abstract class DeviceItem extends JPanel implements ActionListener
-{
- JLabel label;
- JComponent field;
- String value; // 設定データを保持する領域
- public static final int ITEM_WIDTH_1 = 120;
- public static final int ITEM_WIDTH_2 = 80;
- public static final int LINE_WIDTH = ITEM_WIDTH_1 + ITEM_WIDTH_2;
- public static final int LINE_HEIGHT = 18;
-
- /**
- * コンストラクタ
- * @param prop2
- * @param name
- * @param editable
- */
- public DeviceItem(String name) {
- super(null);
- this.value = new String("");
- }
-
- void createItem(String name, String value) {
- this.value = value;
- setupLabel(name, value);
- setupField(value);
-
- label.setBounds(0, 0, ITEM_WIDTH_1 - 6, LINE_HEIGHT);
- field.setBounds(ITEM_WIDTH_1, 0, ITEM_WIDTH_2, LINE_HEIGHT);
- setPreferredSize(new Dimension(ITEM_WIDTH_1, LINE_HEIGHT));
- }
-
- JLabel setupLabel(String name, String value) {
- label = new JLabel(name, JLabel.RIGHT);
- add(label);
- return label;
- }
-
- /**
- * コーディング例:
- *
- * void setupField(String name, String value) {
- * this.value = value;
- * ((JTextField)field).setText(value);
- * field.setFont(new Font("MS UI Gothic", Font.PLAIN, 12));
- * add(field);
- * }
- */
- abstract void setupField(String value);
-
- /**
- * [反映]ボタンがクリックされたときの処理
- *
- * public void actionPerformed(ActionEvent e) {
- * GuardixMonitor.logger.fine("[反映] "+ label.getText() +" = "+ text.getText());
- * prop.setProperty(label.getText(), text.getText());
- * }
- * @param e
- */
- public abstract void actionPerformed(ActionEvent e);
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import javax.swing.*;
-
-import java.awt.Color;
-import java.awt.FlowLayout;
-import java.awt.GridBagLayout;
-
-@SuppressWarnings("serial")
-public class FooterPanel extends JPanel
-{
- GridBagLayout gbLayout = new GridBagLayout();
-
- /**
- * コンストラクタ
- * @param keytagID
- * @throws Exception
- */
- public FooterPanel(String siteName) throws Exception {
- super();
- this.setBackground(Color.DARK_GRAY);
-
- //-------------------------------------------
- // Inner Reader panel
- //----
- this.setLayout(new FlowLayout(FlowLayout.CENTER));
- this.setSize(800, 100);
-
- //-------------------------------------------
- // ユーザーサイト名称
- //----
- JLabel siteNameLabel = new JLabel("ユーザーサイト : '"+ siteName +"' ");
- siteNameLabel.setForeground(Color.LIGHT_GRAY);
- add(siteNameLabel);
- }
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import javax.swing.JPanel;
-
-
-@SuppressWarnings("serial")
-public class MainPanel extends JPanel implements MainPanelData
-{
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // スレッド に関するメソッド
- //
-
- public static int timecount = 0;
-
- public static int getTimecount() {
- return timecount;
- }
-
- public static void setTimecount(int timecount) {
- MainPanel.timecount = timecount;
- }
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // MainPanel に関する共通メソッド
- //
- TouchScreen parentFrame; // 親フレーム
- CollectData loginUser; // 認証されたユーザー(USER_MODEのときのみ有効)
-
- public long getLoginUserId() {
- if (this.loginUser == null) {
- return 0L;
- }
- return this.loginUser.getId();
- }
-
- public CollectData getLoginUser() {
- return this.loginUser;
- }
-
- public TouchScreen getParentFrame() {
- return this.parentFrame;
- }
-
- public void setLoginUser(CollectData loginUser) {
- this.loginUser = loginUser;
- }
-
- public void setParentFrame(TouchScreen touchScreen) {
- this.parentFrame = touchScreen;
- }
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-
-public interface MainPanelData {
- /**
- * 親フレームの設定
- * @param parentFrame
- */
- public void setParentFrame(TouchScreen parentFrame);
-
- /**
- * 親フレームの取得
- * @return
- */
- public TouchScreen getParentFrame();
-
- /**
- * ログインユーザーの設定
- * @param loginUser
- */
- public void setLoginUser(CollectData loginUser);
-
- /**
- * ログインユーザーの取得
- * @return
- */
- public CollectData getLoginUser();
-
- /**
- * ログインユーザーの取得
- * @return
- */
- public long getLoginUserId();
-
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import hayashi.yuu.tools.mail.gui.SettingDialog;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Calendar;
-import java.util.Iterator;
-import java.util.Vector;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-import javax.swing.JFrame;
-import javax.swing.JMenu;
-import javax.swing.JMenuBar;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.JTextArea;
-import javax.swing.JToggleButton;
-import javax.swing.WindowConstants;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.DefaultTableModel;
-
-import jp.co.areaweb.tools.csv.CsvFile;
-import jp.co.areaweb.tools.csv.CsvRecord;
-
-
-/**
- * <b>メインウインドウフレーム</b><br/>
- * GUIでの操作。<br/>
- *
- * メニュー構成:<br/>
- * [メニュー]<br/>
- * [メニュー]->[ファイル(F)]<br/>
- * [メニュー]->[ファイル(F)]->[設定...]<br/>
- * [メニュー]->[ファイル(F)]->[カード名の保存(S)]<br/>
- * [メニュー]->[ファイル(F)]->[終了(X)]<br/>
- * [メニュー]->[モード(M)]<br/>
- * [メニュー]->[モード(M)]->[冗長モード(V)]<br/>
- * [メニュー]->[モード(M)]->[メール送信]<br/>
- * [メニュー]->[モード(M)]->[XMLファイル出力]<br/>
- * [メニュー]->[ヘルプ(H)]<br/>
- * [メニュー]->[ヘルプ(H)]->[このプログラムについて...(A)]<br/>
- * <br/>
- * パネル構成:<br/>
- * ・中央に、メインパネルを配置<br/>
- * ・メインパネルに、テキスト表示パネルを配置<br/>
- * ・メインパネルに、蒐集データを表示するテーブルパネルを配置<br/>
- * ・下部にシリアル通信制御を行う「実行/停止」ボタンを配置<br/>
- *
- * @author hayashi
- *
- */
-public class PictureMapper extends JFrame implements ActionListener, WindowListener, PropertyChangeListener
-{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public static final String PROGRAM_NAME = "OSM PICTURE-mapper";
-
- /**
- * ログ設定プロパティファイルのファイル内容
- */
- protected static final String LOGGING_PROPERTIES_DATA
- = "handlers=java.util.logging.ConsoleHandler\n"
- + ".level=FINEST\n"
- + "java.util.logging.ConsoleHandler.level=INFO\n"
- + "java.util.logging.ConsoleHandler.formatter=deister.jp.tools.YuuLogFormatter";
-
- /**
- * static initializer によるログ設定の初期化
- */
- static {
- final Logger logger = Logger.getLogger("SampleLogging");
- InputStream inStream = null;
- try {
- inStream = new ByteArrayInputStream(LOGGING_PROPERTIES_DATA.getBytes("UTF-8"));
- try {
- LogManager.getLogManager().readConfiguration(inStream);
- logger.config("ログ設定: LogManagerを設定しました。");
- }
- catch (IOException e) {
- logger.warning("ログ設定: LogManager設定の際に例外が発生しました。:" + e.toString());
- }
- }
- catch (UnsupportedEncodingException e) {
- logger.severe("ログ設定: UTF-8エンコーディングがサポートされていません。:" + e.toString());
- }
- finally {
- try {
- if (inStream != null) {
- inStream.close();
- }
- } catch (IOException e) {
- logger.warning("ログ設定: ログ設定プロパティファイルのストリームクローズ時に例外が発生しました。:"+ e.toString());
- }
- }
- }
-
- public static PictureMapper mainFrame;
- boolean fComponentsAdjusted;
- JPanel buttonPanel;
- JToggleButton openButton;
- JMenuBar mainMenuBar; // [メニュー]
- JMenu menuFile; // [メニュー]->[ファイル(F)]
- JMenuItem miSetting; // [メニュー]->[ファイル(F)]->[設定...]
-
- JMenuItem miSave; // [メニュー]->[ファイル(F)]->[登録データの保存(S)]
- JMenuItem miExit; // [メニュー]->[ファイル(F)]->[終了(X)]
- JMenu menuHelp; // [メニュー]->[ヘルプ(H)]
- JMenuItem miAbout; // [メニュー]->[ヘルプ(H)]->[このプログラムについて...(A)]
- public static JTextArea textArea;
- public static JTable recordTable;
- public static DefaultTableModel tmodel;
- public static SettingDialog settingDialog;
-
- static boolean tagmenteMode = false;
- static boolean autoMode = false;
- public static Logger logger = Logger.getLogger(PROGRAM_NAME); // Loggerオブジェクトの生成
- protected boolean openFlag = false;
-
- //============================================
- // 以下は、データコレクターから読み取ったデータ
- //
-
- /**
- * データコレクターから読み取ったレコードを保持します。
- */
- public static Vector<CollectData> dataStore = new Vector<CollectData>();
-
- /**
- * カードの名称を定義したCSVファイル
- */
- public static CsvFile taglistFile = null;
-
- //
- // 以上
- //============================================
-
- /**
- * <b>「ImportPicture」</b><br/>
- */
- public static void main(String args[]) throws Exception {
- (new PictureMapper()).setVisible(true);
- }
-
- /**
- * コンストラクタ<br/>
- *
- * @throws Exception
- */
- @SuppressWarnings("serial")
- public PictureMapper() throws Exception {
- // ログ出力
- PictureMapper.logger.info(PROGRAM_NAME + " - プログラム起動");
-
- // 初期設定
- fComponentsAdjusted = false;
- addWindowListener((WindowListener) this);
- setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
- Container container = getContentPane();
- container.setLayout(new BorderLayout());
- setTitle(PROGRAM_NAME);
-
- mainFrame = this;
-
- this.openFlag = false;
-
- // [メニュー]->[ファイル(F)]
- menuFile = new JMenu("ファイル(F)");
- menuFile.setMnemonic('F');
- menuFile.setFont(new Font("Dialog", 0, 12));
-
- // [メニュー]->[ファイル(F)]->[設定...]
- miSetting = new JMenuItem("設定...");
- miSetting.addActionListener(this);
- miSetting.setFont(new Font("Dialog", 0, 12));
- menuFile.add(miSetting);
- settingDialog = new SettingDialog(this, true, "config/sendmail.properties", logger);
-
- // [メニュー]->[ファイル(F)]->[登録データの保存(S)]
- miSave = new JMenuItem("登録データの保存(S)");
- miSave.addActionListener(this);
- miSave.setMnemonic('S');
- miSave.setFont(new Font("Dialog", 0, 12));
- menuFile.add(miSave);
-
- // [メニュー]->[ファイル(F)]->[------------]
- menuFile.addSeparator();
-
- // [メニュー]->[ファイル(F)]->[終了(X)]
- miExit = new JMenuItem("終了(X)");
- miExit.addActionListener(this);
- miExit.setMnemonic('X');
- miExit.setFont(new Font("Dialog", 0, 12));
- menuFile.add(miExit);
-
- // [メニュー]->[モード(M)]
-
- // [メニュー]->[ヘルプ(H)]->[GurdiX OEM monitor について...(A)]
- miAbout = new JMenuItem("'" + PROGRAM_NAME + "'について...(A)");
- miAbout.addActionListener(this);
- miAbout.setMnemonic('A');
- miAbout.setFont(new Font("Dialog", Font.PLAIN, 12));
-
- // [メニュー]->[ヘルプ(H)]
- menuHelp = new JMenu("ヘルプ(H)");
- menuHelp.setMnemonic('H');
- menuHelp.setFont(new Font("Dialog", Font.PLAIN, 12));
- menuHelp.add(miAbout);
-
- // [メニュー]
- mainMenuBar = new JMenuBar();
- mainMenuBar.add(menuFile);
- mainMenuBar.add(menuHelp);
- getRootPane().setJMenuBar(mainMenuBar);
-
- //--------------------------------------------------------
- // 上部パネル
- // モニターコンソール用のテキストエリア
- //-----------------------------------------------
-
- // テキスト表示パネルを配置
- PictureMapper.textArea = new JTextArea(5, 30) {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- public void append(String str) {
- super.append(str);
- textArea.setCaretPosition(textArea.getDocument().getLength());
- }
- };
- PictureMapper.textArea.setEditable(false);
- PictureMapper.textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
- JScrollPane scrollPane = new JScrollPane(PictureMapper.textArea);
- scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
- scrollPane.setPreferredSize(new Dimension(500, 100));
- add(BorderLayout.NORTH, scrollPane);
-
-
- //--------------------------------------------------------
- // 中央パネル
- //-----------------------------------------------
-
- // 蒐集データを表示するテーブルパネルを配置
- tmodel = new DefaultTableModel(CollectData.columnNames, 0) {
- @Override
- public boolean isCellEditable(int row, int column) {
- if ((column == 2) || (column == 3)) {
- return true;
- }
- return false;
- }
- };
- recordTable = new JTable(tmodel);
- recordTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
- DefaultTableColumnModel columnModel = (DefaultTableColumnModel)recordTable.getColumnModel();
- columnModel.getColumn(0).setPreferredWidth(120);
- columnModel.getColumn(1).setPreferredWidth(120);
- columnModel.getColumn(2).setPreferredWidth(240);
- columnModel.getColumn(3).setPreferredWidth(640 - 120 - 120 - 240);
-
- JScrollPane tablePanel = new JScrollPane(recordTable);
- tablePanel.setPreferredSize(new Dimension(644, 240));
- add(BorderLayout.CENTER, tablePanel);
-
- //--------------------------------------------------------
- // 下部パネル
- //-----------------------------------------------
-
- // 下部に「実行/停止」ボタンを配置
- openButton = new JToggleButton("実行");
- openButton.addActionListener(this);
- openButton.setToolTipText("カード読取を開始します");
- JPanel southPanel = new JPanel(new FlowLayout());
- try {
- southPanel.add(openButton);
- southPanel.setSize(DeviceItem.LINE_WIDTH, DeviceItem.LINE_HEIGHT);
- }
- catch(Exception e) {
- e.printStackTrace();
- PictureMapper.logger.warning(e.toString());
- }
- getContentPane().add(BorderLayout.SOUTH, southPanel);
-
- pack();
- setLocationRelativeTo(null);
- setVisible(true);
-
- //-----------------------
-
- taglistFile = new CsvFile((new File("config/taglist.csv")).getAbsolutePath());
- taglistFile.setCharsetName("utf8");
- taglistFile.load();
- if (PictureMapper.tagmenteMode) {
- for (Iterator<CsvRecord> i = PictureMapper.taglistFile.iterator(); i.hasNext(); ) {
- CsvRecord record = i.next();
- String idStr = (String)record.get(0); // ID
- String addrStr = (String)record.get(1); // address
- String nameStr = (String)record.get(2); // name
- CollectData data = new CollectData(Calendar.getInstance().getTime(), idStr, addrStr, nameStr);
- PictureMapper.tmodel.addRow(data.getRecordStrs());
- }
- }
-
- //--------------------------
- // 自動起動
- //--
- if (PictureMapper.autoMode) {
- doButtonAction();
- }
- }
-
- public void addNotify() {
- Dimension d = getSize();
- super.addNotify();
- if (fComponentsAdjusted) {
- return;
- }
- setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
- Component components[] = getComponents();
- for (int i = 0; i < components.length; i++) {
- Point p = components[i].getLocation();
- p.translate(getInsets().left, getInsets().top);
- components[i].setLocation(p);
- }
-
- fComponentsAdjusted = true;
- }
-
- TouchScreen screen = null;
-
- /**
- * [実行/停止]ボタンがクリックされた時のアクション
- */
- private void doButtonAction() {
- openButton.setText("Requesting....");
- openButton.setEnabled(false);
- if (openFlag) {
- screen.screenMode = -1;
- screen.setVisible(false);
- screen.dispose();
- screen = null;
- close();
- openFlag = false;
- openButton.setText("実行");
- }
- else {
- open();
- try {
- screen = new TouchScreen("カード登録");
- screen.init();
- //screen.setVisible(true);
- }
- catch (Exception e) {
- e.printStackTrace();
- return;
- }
- openFlag = true;
- openButton.setText("停止");
- }
- openButton.setEnabled(true);
- }
-
- /**
- * 「実行」ボタンをクリックしたときの処理。
- * GuardiXデータコレクタとのシリアル通信ポートをオープンして、
- * シリアル通信ポートからのデータ受信処理スレッドを起動する。
- */
- public void open() {
- PictureMapper.logger.info(PROGRAM_NAME + ".open()");
-
- /*
- * シリアルポートからのデータ読取処理を開始する。
- */
-
- setVisible(true);
- }
-
- /**
- * GuardiXへの通信ポートとの送受信スレッドを停止して、
- * 通信ポートをクローズする。
- */
- public void close() {
- PictureMapper.logger.info(PROGRAM_NAME + ".close()");
- System.gc();
- }
-
-
- /**
- * [メニュー]アクション: <br/>
- * 各メニューのアクションを呼び出す。
- * @param event
- */
- public void actionPerformed(ActionEvent event) {
- Object object = event.getSource();
- if(object == miExit) {
- miExit_Action(event);
- }
- else if (object == miSave) {
- miSave_Action(event);
- }
- else if (object == miAbout) {
- miAbout_Action(event);
- }
- else if (object == openButton) {
- doButtonAction();
- }
- }
-
- /**
- * アクション:
- * [メニュー]->[ヘルプ]->[このプログラムについて]<br/>
- * このプログラムについて説明するダイアログウインドウを表示する。
- * @param event
- */
- void miAbout_Action(java.awt.event.ActionEvent event){
- (new AboutDialog(this, true)).setVisible(true);
- }
-
- /**
- * アクション:
- * [メニュー]->[ファイル]->[終了]<br/>
- * 終了確認ダイアログウインドウを表示する。
- * @param event
- */
- void miExit_Action(ActionEvent event) {
- (new QuitDialog(this, true)).setVisible(true);
- }
-
- /**
- * アクション:
- * [メニュー]->[ファイル]->[タグ名の保存(S)]<br/>
- * 保存確認ダイアログウインドウを表示する。
- *
- * @param event
- */
- void miSave_Action(ActionEvent event) {
- (new SaveDialog(this, true)).setVisible(true);
- }
-
- /**
- * [メニュー]->[モード(M)]変更 : アクション<br/>
- * 「クイックモード」の値を反映させる。
- * @param evt
- */
- public void propertyChange(PropertyChangeEvent evt) {
- PictureMapper.logger.fine(PROGRAM_NAME + ".propertyChange()");
- }
-
- /**
- * アクション:フレームウインドウがアクティブになった時の・オペレーション<br/>
- * 何もしない。
- * @param arg0 イベント
- */
- public void windowActivated(WindowEvent arg0) {
- }
-
- /**
- * アクション:フレームウインドウが閉じられた時の・オペレーション<br/>
- * 何もしない。
- * @param arg0 イベント
- */
- public void windowClosed(WindowEvent arg0) {
- }
-
- /**
- * アクション:フレームウインドウが閉じられる時の・オペレーション<br/>
- * 何もしない。
- * @param arg0 イベント
- */
- public void windowClosing(WindowEvent arg0) {
- (new QuitDialog(this, true)).setVisible(true);
- }
-
- /**
- * アクション:フレームウインドウが非アクティブになった時の・オペレーション<br/>
- * 何もしない。
- * @param arg0 イベント
- */
- public void windowDeactivated(WindowEvent arg0) {
- }
-
- /**
- * アクション:フレームウインドウが最小化から戻った時の・オペレーション<br/>
- * 何もしない。
- * @param arg0 イベント
- */
- public void windowDeiconified(WindowEvent arg0) {
- }
-
- /**
- * アクション:フレームウインドウが最小化されたときの・オペレーション<br/>
- * 何もしない。
- * @param arg0 イベント
- */
- public void windowIconified(WindowEvent arg0) {
- }
-
- /**
- * アクション:ウインドウが開いた。<br/>
- * 何もしない。
- * @param arg0 イベント
- */
- public void windowOpened(WindowEvent arg0) {
- }
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-import java.awt.Rectangle;
-import java.awt.Toolkit;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.awt.BorderLayout;
-import java.io.File;
-import java.io.IOException;
-
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.table.TableModel;
-
-import jp.co.areaweb.tools.csv.CsvFile;
-import jp.co.areaweb.tools.csv.CsvRecord;
-
-@SuppressWarnings("serial")
-public class SaveDialog extends JDialog implements WindowListener
-{
- JLabel label1;
- JButton okButton;
- JLabel label2;
- JFrame parent;
-
- public SaveDialog(JFrame parent, boolean modal) {
- super(parent, modal);
- addWindowListener(this);
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- this.parent = parent;
- setTitle("登録データの保存");
- getContentPane().setLayout(new BorderLayout());
- setSize(360,180);
-
- label1 = new JLabel("登録データの設定変更を保存します。", JLabel.CENTER);
- label1.setBounds(10,10,340,20);
- add(label1, BorderLayout.NORTH);
-
- File outfile = PictureMapper.taglistFile.getFile();
- label2 = new JLabel(outfile.getAbsolutePath(), JLabel.CENTER);
- label2.setBounds(10,40,340,20);
- add(label2, BorderLayout.CENTER);
-
- /*
- * [OK]ボタン : このダイアログウインドウを閉じる
- */
- okButton = new JButton("OK");
- okButton.setBounds(145,65,66,27);
- okButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- // メインパネルに表示されているデータ内容をタグ定義ファイルに書き出す。
- TableModel model = PictureMapper.recordTable.getModel();
- int rowCnt = model.getRowCount();
- for (int i=0; i < rowCnt; i++) {
- String idStr = (String)PictureMapper.recordTable.getValueAt(i, 1);
- String addr = (String)PictureMapper.recordTable.getValueAt(i, 2);
- String name = (String)PictureMapper.recordTable.getValueAt(i, 3);
- CsvFile csvf = PictureMapper.taglistFile.find(0, idStr);
- if (csvf.isEmpty()) {
- // 新規タグ
- CsvRecord line = new CsvRecord();
- line.add(idStr);
- line.add(addr);
- line.add(name);
- PictureMapper.taglistFile.add(line);
- }
- else {
- // 既存タグ
- CsvRecord line = csvf.getFirst();
- if (!addr.equals(line.get(1))) {
- line.set(1, addr); // アドレスの変更
- }
- if (!name.equals(line.get(2))) {
- line.set(2, name); // なまえの変更
- }
- }
- }
-
- try {
- PictureMapper.taglistFile.save();
- }
- catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- // このダイアログウインドウを閉じる
- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(SaveDialog.this, WindowEvent.WINDOW_CLOSING));
- setVisible(false);
- }
- });
- JPanel southPanel = new JPanel();
- southPanel.add(okButton);
- add(southPanel, BorderLayout.SOUTH);
-
- setVisible(true);
- }
-
- /**
- * Shows or hides the component depending on the boolean flag b.
- * @param b if true, show the component; otherwise, hide the component.
- * @see java.awt.Component#isVisible
- */
- public void setVisible(boolean b) {
- if (b) {
- Rectangle bounds = getParent().getBounds();
- Rectangle abounds = getBounds();
- setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
- bounds.y + (bounds.height - abounds.height)/2);
- }
- super.setVisible(b);
- }
-
- public void windowClosed(WindowEvent e) {
- setVisible(false);
- }
-
- public void windowActivated(WindowEvent arg0) {
- }
-
- public void windowClosing(WindowEvent arg0) {
- setVisible(false);
- }
-
- public void windowDeactivated(WindowEvent arg0) {
- }
-
- public void windowDeiconified(WindowEvent arg0) {
- }
-
- public void windowIconified(WindowEvent arg0) {
- }
-
- public void windowOpened(WindowEvent arg0) {
- }
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-
-import java.awt.Font;
-import java.awt.GridLayout;
-
-@SuppressWarnings("serial")
-public class StartModePanel extends MainPanel
-{
- /**
- * コンストラクタ
- * @param touchScreen 親フレーム
- */
- public StartModePanel(TouchScreen touchScreen) {
- super();
- this.parent = touchScreen;
- setParentFrame(touchScreen);
-
- this.setSize(800, 300);
- this.setLayout(new GridLayout(2, 1));
- img = true;
- imageon = new JLabel(new ImageIcon("lib/card.gif"));
- imageoff = new JLabel();
- imageLabel = imageon;
- this.add(imageLabel);
- text = new JLabel("IDカードをかざしてください。", JLabel.CENTER);
- text.setFont(new Font("MS PGothic", Font.BOLD, 18));
- this.add(text);
- }
-
- public void run() {
- while(true) {
- if (img) {
- //this.remove(imageon);
- imageLabel = imageoff;
- //this.remove(text);
- parent.repaint();
- this.setVisible(true);
- img = false;
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {}
- }
- else {
- // this.add(imageon);
- imageLabel = imageon;
- //this.add(text);
- parent.repaint();
- imageon.setVisible(true);
- img = true;
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {}
- }
- }
- }
-
- TouchScreen parent;
- JLabel imageLabel;
- JLabel imageon;
- JLabel imageoff;
- JLabel text;
- boolean img = false;
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import java.awt.FlowLayout;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- * タッチパネルの上部に常時表示されるタイトルヘッダ
- *
- * 「proxSafe Commander3」のイメージ画像を表示する
- * filePath : ./lib/mainbanner2.jpg
- * width: 800pix
- * hight: 48pix
- *
- * @author hayashi
- *
- */
-@SuppressWarnings("serial")
-public class TitlePanel extends JPanel {
- static final String imagePath = "lib/mainbanner2.jpg";
- JLabel imageLabel;
- JLabel terminalNameLabel;
-
- /**
- * コンストラクタ
- */
- public TitlePanel() {
- super();
- this.setLayout(new FlowLayout());
-
- imageLabel = new JLabel();
- imageLabel.setIcon(new ImageIcon(imagePath));
- add(imageLabel);
- }
-}
+++ /dev/null
-package hayashi.yuu.gpx.gui;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-
-
-/**
- * 「タッチパネル画面」
- *
- */
-@SuppressWarnings("serial")
-public class TouchScreen extends JFrame implements Runnable
-{
- MainPanel mainPanel; // キャビネット内のキータグ状況を表す
-
- /**
- * コンストラクタ
- *
- * 画面サイズ: 800 x 600
- *
- */
- public TouchScreen(String siteName) throws Exception {
- super();
- this.setUndecorated(true);
-
- this.startModePanel = new StartModePanel(this);
-
- setLayout(new BorderLayout());
- this.setVisible(false);
- this.setSize(800, 600);
-
- /*
- * タイトルパネル
- * 'proxSafe Commander3'のロゴイメージと、ターミナル名称
- *
- * 画面サイズ: 800 x 600
- */
- TitlePanel titlePanel = new TitlePanel();
- add(BorderLayout.NORTH, titlePanel);
-
- /*
- * メインパネル
- * [ニュートラル表示]パネル
- *
- * 画面サイズ: 800 x ?
- */
- printStartMessage();
- add(BorderLayout.CENTER, mainPanel);
-
- /*
- * フッターパネル
- *
- */
- FooterPanel footerPanel = new FooterPanel(siteName);
- add(BorderLayout.SOUTH, footerPanel);
- setVisible(true);
-
- SymWindow aSymWindow = new SymWindow();
- addWindowListener(aSymWindow);
- }
-
-
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // Frame に関するメソッド
- //
-
- public void init() {
- setVisible(true);
- //Thread threadA = new Thread(this);
- //threadA.start();
- }
-
- public void setVisible(boolean b) {
- if(b) {
- // デスクトップ中央にJFrameを配置する
- Dimension paneSize = this.getSize();
- Dimension screenSize = this.getToolkit().getScreenSize();
- this.setLocation((screenSize.width - paneSize.width) / 2, (screenSize.height - paneSize.height) / 2);
- }
- super.setVisible(b);
- }
-
- public void addNotify() {
- Dimension d = getSize();
- super.addNotify();
- setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
- Component components[] = getComponents();
- for(int i = 0; i < components.length; i++) {
- Point p = components[i].getLocation();
- p.translate(getInsets().left, getInsets().top);
- components[i].setLocation(p);
- }
- }
-
- /**
- * WindowClose 処理
- * @param event
- */
- public void FrameClosing(WindowEvent event) {
- // スレッドを停止する
- setVisible(false);
- dispose();
- }
-
- class SymWindow extends WindowAdapter
- {
- public void windowClosing(WindowEvent event) {
- Object object = event.getSource();
- if(object == TouchScreen.this) {
- FrameClosing(event);
- }
- }
- }
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- //
- // モード に関するメソッド
- //
- protected StartModePanel startModePanel;
- /*
- protected UnregisteredModePanel unregisteredModePanel;
- protected BusyModePanel busyModePanel;
- */
-
- /*
- * スクリーン遷移モード
- */
- public int screenMode = START_MODE; // 現在のスクリーンモードを保持する
- static final int START_MODE = 0; // ニュートラル
- static final int USER_MODE = 1; // ユーザー認証済み(キー選択)
- static final int UNREGISTERED_MODE = 2; // 未登録カードモード
- static final int BUSY_MODE = 3; // データ更新処理中モード
- static final int KEYTAG_MODE = 4; // キータグ返却モード(AUTO_RETURN)
-
-
- /*
- * 「ニュートラル」モード
- * new ImageIcon("lib/card.gif"), "IDカードをかざしてください。"
- *
- */
- public void printStartMessage() {
- this.screenMode = TouchScreen.START_MODE;
-
- // 表示パネルを切り替える
- if (this.mainPanel != null) {
- this.remove(this.mainPanel);
- }
-
- this.mainPanel = this.startModePanel;
- this.add(BorderLayout.CENTER, mainPanel);
- this.setVisible(true);
- this.repaint();
- }
-
-
- @Override
- public void run() {
- while (this.screenMode == TouchScreen.START_MODE) {
- // 表示パネルを切り替える
- if (this.mainPanel != null) {
- this.remove(this.mainPanel);
- this.mainPanel = null;
-
- this.setVisible(true);
- //this.repaint();
-
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {}
- }
- else {
- this.mainPanel = this.startModePanel;
- this.add(BorderLayout.CENTER, mainPanel);
-
- this.setVisible(true);
- //this.repaint();
-
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {}
- }
- }
- }
-
-}
\ No newline at end of file
--- /dev/null
+package osm.jp.gpx.matchtime.gui;
+import java.awt.*;
+
+@SuppressWarnings("serial")
+public class AboutDialog extends Dialog
+{
+ //{{DECLARE_CONTROLS
+ java.awt.Label label1;
+ java.awt.Button okButton;
+ java.awt.Label label2;
+ //}}
+
+ // Used for addNotify redundency check.
+ boolean fComponentsAdjusted = false;
+
+ class SymWindow extends java.awt.event.WindowAdapter
+ {
+ public void windowClosing(java.awt.event.WindowEvent event)
+ {
+ Object object = event.getSource();
+ if (object == AboutDialog.this)
+ AboutDialog_WindowClosing(event);
+ }
+ }
+
+ class SymAction implements java.awt.event.ActionListener
+ {
+ public void actionPerformed(java.awt.event.ActionEvent event)
+ {
+ Object object = event.getSource();
+ if (object == okButton)
+ okButton_Clicked(event);
+ }
+ }
+
+ public AboutDialog(Frame parent, boolean modal)
+ {
+ super(parent, modal);
+
+ // This code is automatically generated by Visual Cafe when you add
+ // components to the visual environment. It instantiates and initializes
+ // the components. To modify the code, only use code syntax that matches
+ // what Visual Cafe can generate, or Visual Cafe may be unable to back
+ // parse your Java file into its visual environment.
+
+
+ //{{INIT_CONTROLS
+ setLayout(null);
+ setVisible(false);
+ setSize(360,114);
+ label1 = new java.awt.Label(MatchTime.PROGRAM_NAME +" Version "+ MatchTime.PROGRAM_VARSION +" ("+ MatchTime.PROGRAM_UPDATE +")", Label.CENTER);
+ label1.setBounds(10,10,340,20);
+ add(label1);
+ okButton = new java.awt.Button();
+ okButton.setLabel("OK");
+ okButton.setBounds(145,65,66,27);
+ add(okButton);
+ label2 = new java.awt.Label("Copyright(C) 2014 yuuhayashi GPLv3.",Label.RIGHT);
+ label2.setBounds(10,40,340,20);
+ add(label2);
+ setTitle("About... "+ MatchTime.PROGRAM_NAME);
+ //}}
+
+ //{{REGISTER_LISTENERS
+ SymWindow aSymWindow = new SymWindow();
+ this.addWindowListener(aSymWindow);
+ SymAction lSymAction = new SymAction();
+ okButton.addActionListener(lSymAction);
+ //}}
+
+ }
+
+ public AboutDialog(Frame parent, String title, boolean modal)
+ {
+ this(parent, modal);
+ setTitle(title);
+ }
+
+ public void addNotify()
+ {
+ // Record the size of the window prior to calling parents addNotify.
+
+ super.addNotify();
+
+ // Only do this once.
+ if (fComponentsAdjusted)
+ return;
+
+ // Adjust components according to the insets
+ setSize(getInsets().left + getInsets().right + getSize().width, getInsets().top + getInsets().bottom + getSize().height);
+ Component components[] = getComponents();
+ for (int i = 0; i < components.length; i++)
+ {
+ Point p = components[i].getLocation();
+ p.translate(getInsets().left, getInsets().top);
+ components[i].setLocation(p);
+ }
+
+ // Used for addNotify check.
+ fComponentsAdjusted = true;
+ }
+
+ /**
+ * Shows or hides the component depending on the boolean flag b.
+ * @param b if true, show the component; otherwise, hide the component.
+ * @see java.awt.Component#isVisible
+ */
+ public void setVisible(boolean b)
+ {
+ if(b)
+ {
+ Rectangle bounds = getParent().getBounds();
+ Rectangle abounds = getBounds();
+ setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
+ bounds.y + (bounds.height - abounds.height)/2);
+ }
+ super.setVisible(b);
+ }
+
+ void AboutDialog_WindowClosing(java.awt.event.WindowEvent event)
+ {
+ dispose();
+ }
+
+ void okButton_Clicked(java.awt.event.ActionEvent event)
+ {
+ //{{CONNECTION
+ // Clicked from okButton Hide the Dialog
+ dispose();
+ //}}
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle or the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package osm.jp.gpx.matchtime.gui;
+
+import java.io.File;
+import javax.swing.*;
+import javax.swing.filechooser.*;
+
+/* ImageFileView.java is used by FileChooserDemo2.java. */
+public class ImageFileView extends FileView {
+ ImageIcon jpgIcon = Utils.createImageIcon("images/jpgIcon.gif");
+ ImageIcon gifIcon = Utils.createImageIcon("images/gifIcon.gif");
+ ImageIcon tiffIcon = Utils.createImageIcon("images/tiffIcon.gif");
+ ImageIcon pngIcon = Utils.createImageIcon("images/pngIcon.png");
+
+ public String getName(File f) {
+ return null; //let the L&F FileView figure this out
+ }
+
+ public String getDescription(File f) {
+ return null; //let the L&F FileView figure this out
+ }
+
+ public Boolean isTraversable(File f) {
+ return null; //let the L&F FileView figure this out
+ }
+
+ public String getTypeDescription(File f) {
+ String extension = Utils.getExtension(f);
+ String type = null;
+
+ if (extension != null) {
+ if (extension.equals(Utils.jpeg) ||
+ extension.equals(Utils.jpg)) {
+ type = "JPEG Image";
+ } else if (extension.equals(Utils.gif)){
+ type = "GIF Image";
+ } else if (extension.equals(Utils.tiff) ||
+ extension.equals(Utils.tif)) {
+ type = "TIFF Image";
+ } else if (extension.equals(Utils.png)){
+ type = "PNG Image";
+ }
+ }
+ return type;
+ }
+
+ public Icon getIcon(File f) {
+ String extension = Utils.getExtension(f);
+ Icon icon = null;
+
+ if (extension != null) {
+ if (extension.equals(Utils.jpeg) ||
+ extension.equals(Utils.jpg)) {
+ icon = jpgIcon;
+ } else if (extension.equals(Utils.gif)) {
+ icon = gifIcon;
+ } else if (extension.equals(Utils.tiff) ||
+ extension.equals(Utils.tif)) {
+ icon = tiffIcon;
+ } else if (extension.equals(Utils.png)) {
+ icon = pngIcon;
+ }
+ }
+ return icon;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle or the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package osm.jp.gpx.matchtime.gui;
+
+import java.io.File;
+import javax.swing.filechooser.*;
+
+/* ImageFilter.java is used by FileChooserDemo2.java. */
+public class ImageFilter extends FileFilter {
+
+ //Accept all directories and all gif, jpg, tiff, or png files.
+ public boolean accept(File f) {
+ if (f.isDirectory()) {
+ return true;
+ }
+
+ String extension = Utils.getExtension(f);
+ if (extension != null) {
+ if (extension.equals(Utils.tiff) ||
+ extension.equals(Utils.tif) ||
+ extension.equals(Utils.gif) ||
+ extension.equals(Utils.jpeg) ||
+ extension.equals(Utils.jpg) ||
+ extension.equals(Utils.png)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ //The description of this filter
+ public String getDescription() {
+ return "Just Images";
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle or the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package osm.jp.gpx.matchtime.gui;
+
+import javax.swing.*;
+
+import java.beans.*;
+import java.awt.*;
+import java.io.File;
+
+/* ImagePreview.java by FileChooserDemo2.java. */
+@SuppressWarnings("serial")
+public class ImagePreview extends JComponent implements PropertyChangeListener {
+ ImageIcon thumbnail = null;
+ File file = null;
+ static int IMAGE_SIZE_X = 320;
+ static int IMAGE_SIZE_Y = 240;
+
+ public ImagePreview(JFileChooser fc) {
+ setPreferredSize(new Dimension(IMAGE_SIZE_X + 10, IMAGE_SIZE_Y + 10));
+ fc.addPropertyChangeListener(this);
+ }
+
+ public void loadImage() {
+ if (file == null) {
+ thumbnail = null;
+ return;
+ }
+
+ //Don't use createImageIcon (which is a wrapper for getResource)
+ //because the image we're trying to load is probably not one
+ //of this program's own resources.
+ ImageIcon tmpIcon = new ImageIcon(file.getPath());
+ if (tmpIcon != null) {
+ if (tmpIcon.getIconWidth() > IMAGE_SIZE_X) {
+ thumbnail = new ImageIcon(tmpIcon.getImage().
+ getScaledInstance(IMAGE_SIZE_X, -1, Image.SCALE_DEFAULT));
+ } else { //no need to miniaturize
+ thumbnail = tmpIcon;
+ }
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent e) {
+ boolean update = false;
+ String prop = e.getPropertyName();
+
+ //If the directory changed, don't show an image.
+ if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
+ file = null;
+ update = true;
+
+ //If a file became selected, find out which one.
+ } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
+ file = (File) e.getNewValue();
+ update = true;
+ }
+
+ //Update the preview accordingly.
+ if (update) {
+ thumbnail = null;
+ if (isShowing()) {
+ loadImage();
+ repaint();
+ }
+ }
+ }
+
+ protected void paintComponent(Graphics g) {
+ if (thumbnail == null) {
+ loadImage();
+ }
+ if (thumbnail != null) {
+ int x = getWidth()/2 - thumbnail.getIconWidth()/2;
+ int y = getHeight()/2 - thumbnail.getIconHeight()/2;
+
+ if (y < 0) {
+ y = 0;
+ }
+
+ if (x < 5) {
+ x = 5;
+ }
+ thumbnail.paintIcon(this, g, x, y);
+ }
+ }
+}
--- /dev/null
+package osm.jp.gpx.matchtime.gui;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.IOException;
+
+import javax.swing.*;
+
+import osm.jp.gpx.ImportPicture;
+
+/**
+ * 本プログラムのメインクラス
+ */
+@SuppressWarnings("serial")
+public class MatchTime extends JFrame
+{
+ public static final String PROGRAM_NAME = "MatchTime for JOSM";
+ public static final String PROGRAM_VARSION = "0.2";
+ public static final String PROGRAM_UPDATE = "2014/06/28";
+
+ // Used for addNotify check.
+ boolean fComponentsAdjusted = false;
+
+ //{{DECLARE_CONTROLS
+ JPanel argsPanel; // パラメータ設定パネル (上部)
+ JScrollPane imageSPane; // スクロールパネル
+ JLabel imageLabel; // 基準時刻画像表示
+ //ImagePreview imagePane; // 基準時刻画像表示
+ ParameterPanelFolder arg1Panel_1;
+ ParameterPanelImageFile arg1Panel_2;
+ ParameterPanelTime arg1Panel_3;
+ JPanel buttonPanel; // ボタンパネル (下部)
+ JButton openButton; // [Fit]ボタン
+ JButton zoomInButton; // [Zoom in]ボタン
+ JButton zoomOutButton; // [Zoom out]ボタン
+ //}}
+
+ //{{DECLARE_MENUS
+ java.awt.MenuBar mainMenuBar;
+ java.awt.Menu menu1;
+ java.awt.MenuItem miDoNewFileList;
+ java.awt.MenuItem miDoDirSize;
+ java.awt.MenuItem miDoReadXML;
+ java.awt.MenuItem miExit;
+ java.awt.Menu menu3;
+ java.awt.MenuItem miAbout;
+ //}}
+
+ class SymWindow extends java.awt.event.WindowAdapter {
+ /**
+ * このFrameが閉じられるときの動作。
+ * 終了確認のパネルを表示して、[OK]が押されたら終了する
+ */
+ public void windowClosing(java.awt.event.WindowEvent event) {
+ Object object = event.getSource();
+ if (object == MatchTime.this) {
+ DbMang_WindowClosing(event);
+ }
+ }
+ }
+
+ class SymAction implements java.awt.event.ActionListener {
+ public void actionPerformed(java.awt.event.ActionEvent event) {
+ Object object = event.getSource();
+ if (object == miAbout) {
+ miAbout_Action(event);
+ }
+ else if (object == miExit) {
+ miExit_Action(event);
+ }
+ else if (object == openButton) {
+ imageView_Action(event);
+ }
+ else if (object == zoomInButton) {
+ zoomin_Action(event);
+ }
+ else if (object == zoomOutButton) {
+ zoomout_Action(event);
+ }
+ else if (object == arg1Panel_2.argField) {
+ imageView_Action(event);
+ }
+ else if (object == arg1Panel_2.openButton) {
+ selectImage_Action(event);
+ imageView_Action(event);
+ }
+ else if (object == arg1Panel_3.doButton) {
+ String[] argv = new String[4];
+ argv[0] = "list.csv";
+ argv[1] = arg1Panel_1.getText();
+ argv[2] = arg1Panel_2.getText();
+ argv[3] = arg1Panel_3.getText();
+ try {
+ ImportPicture.main(argv);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ /**
+ * データベース内のテーブルを一覧で表示するFrame
+ */
+ public MatchTime()
+ {
+ // INIT_CONTROLS
+ //setLayout(new BorderLayout());
+ Container container = getContentPane();
+ container.setLayout(new BorderLayout());
+ setVisible(false);
+ setSize(getInsets().left + getInsets().right + 500,getInsets().top + getInsets().bottom + 480);
+ setTitle(MatchTime.PROGRAM_NAME +" v"+ MatchTime.PROGRAM_VARSION);
+
+ // パラメータ設定パネル
+ argsPanel = new JPanel();
+ argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
+ arg1Panel_1 = new ParameterPanelFolder("対象フォルダ: ", ".");
+ argsPanel.add(arg1Panel_1);
+ arg1Panel_2 = new ParameterPanelImageFile("基準時刻画像: ", "", arg1Panel_1);
+ argsPanel.add(arg1Panel_2);
+ arg1Panel_3 = new ParameterPanelTime(" 基準時刻: ", "yyyy-mm-ddTHH:MM:ss");
+ argsPanel.add(arg1Panel_3);
+
+ this.getContentPane().add(argsPanel, BorderLayout.NORTH);
+
+ // 基準時刻画像表示
+ imageLabel = new JLabel();
+ imageSPane = new JScrollPane(imageLabel);
+ this.getContentPane().add(imageSPane, BorderLayout.CENTER);
+
+ // 画像ファイル選択ダイアログを起動するボタン
+ buttonPanel = new JPanel();
+ buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
+ openButton = new JButton(createImageIcon("images/Fit16.gif"));
+ buttonPanel.add(openButton);
+ zoomInButton = new JButton(createImageIcon("images/ZoomIn16.gif"));
+ buttonPanel.add(zoomInButton);
+ zoomOutButton = new JButton(createImageIcon("images/ZoomOut16.gif"));
+ buttonPanel.add(zoomOutButton);
+ this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
+
+ // INIT_MENUS
+ menu1 = new java.awt.Menu("File");
+ miExit = new java.awt.MenuItem(QuitDialog.TITLE);
+ miExit.setFont(new Font("Dialog", Font.PLAIN, 12));
+ menu1.add(miExit);
+
+ miAbout = new java.awt.MenuItem("About...");
+ miAbout.setFont(new Font("Dialog", Font.PLAIN, 12));
+
+ menu3 = new java.awt.Menu("Help");
+ menu3.setFont(new Font("Dialog", Font.PLAIN, 12));
+ menu3.add(miAbout);
+
+ mainMenuBar = new java.awt.MenuBar();
+ mainMenuBar.setHelpMenu(menu3);
+ mainMenuBar.add(menu1);
+ mainMenuBar.add(menu3);
+ setMenuBar(mainMenuBar);
+
+
+ //{{REGISTER_LISTENERS
+ SymWindow aSymWindow = new SymWindow();
+ this.addWindowListener(aSymWindow);
+ SymAction lSymAction = new SymAction();
+ miAbout.addActionListener(lSymAction);
+ miExit.addActionListener(lSymAction);
+ openButton.addActionListener(lSymAction);
+ zoomOutButton.addActionListener(lSymAction);
+ zoomInButton.addActionListener(lSymAction);
+ arg1Panel_2.argField.addActionListener(lSymAction);
+ arg1Panel_2.openButton.addActionListener(lSymAction);
+ arg1Panel_3.doButton.addActionListener(lSymAction);
+ //}}
+ }
+
+ /**
+ * Shows or hides the component depending on the boolean flag b.
+ * @param b trueのときコンポーネントを表示; その他のとき, componentを隠す.
+ * @see java.awt.Component#isVisible
+ */
+ public void setVisible(boolean b) {
+ if(b) {
+ setLocation(50, 50);
+
+ }
+ super.setVisible(b);
+ }
+
+ /**
+ * このクラスをインスタンスを生成して表示する。
+ * コマンドラインの引数はありません。
+ */
+ static public void main(String args[]) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+ }
+ private static void createAndShowGUI() {
+ (new MatchTime()).setVisible(true);
+ }
+
+ public void addNotify() {
+ // Record the size of the window prior to calling parents addNotify.
+ Dimension d = getSize();
+
+ super.addNotify();
+
+ if (fComponentsAdjusted)
+ return;
+
+ // Adjust components according to the insets
+ setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
+ Component components[] = getComponents();
+ for (int i = 0; i < components.length; i++){
+ Point p = components[i].getLocation();
+ p.translate(getInsets().left, getInsets().top);
+ components[i].setLocation(p);
+ }
+ fComponentsAdjusted = true;
+ }
+
+ void DbMang_WindowClosing(java.awt.event.WindowEvent event) {
+ setVisible(false); // hide the Manager
+ dispose(); // free the system resources
+ System.exit(0); // close the application
+ }
+
+ void miAbout_Action(java.awt.event.ActionEvent event) {
+ // Action from About Create and show as modal
+ (new AboutDialog(this, true)).setVisible(true);
+ }
+
+ void miExit_Action(java.awt.event.ActionEvent event) {
+ // Action from Exit Create and show as modal
+ //(new hayashi.yuu.tools.gui.QuitDialog(this, true)).setVisible(true);
+ (new QuitDialog(this, true)).setVisible(true);
+ }
+
+ ImageIcon refImage;
+
+ /**
+ * 選択された画像ファイルを表示する
+ * @param ev
+ */
+ public void imageView_Action(ActionEvent ev) {
+ String path = (new File(arg1Panel_1.getText(), arg1Panel_2.getText())).getPath();
+ int size_x = imageSPane.getWidth() - 8;
+ ImageIcon tmpIcon = new ImageIcon(path);
+ refImage = tmpIcon;
+ if (tmpIcon != null) {
+ if (tmpIcon.getIconWidth() > size_x) {
+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x, -1, Image.SCALE_DEFAULT));
+ }
+ }
+ imageLabel.setIcon(refImage);
+ repaint();
+ }
+
+ public void zoomin_Action(ActionEvent ev) {
+ if (refImage != null) {
+ int size_x = imageLabel.getWidth();
+ String path = (new File(arg1Panel_1.getText(), arg1Panel_2.getText())).getPath();
+ ImageIcon tmpIcon = new ImageIcon(path);
+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT));
+ imageLabel.setIcon(refImage);
+ repaint();
+ }
+ }
+
+ public void zoomout_Action(ActionEvent ev) {
+ if (refImage != null) {
+ int size_x = imageLabel.getWidth();
+ ImageIcon tmpIcon = refImage;
+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT));
+ imageLabel.setIcon(refImage);
+ repaint();
+ }
+ }
+
+ public void selectImage_Action(ActionEvent ev) {
+ JFileChooser fc;
+
+ //Set up the file chooser.
+ File sdir = new File(arg1Panel_1.getText());
+ System.out.println(sdir.toPath());
+ if (sdir.isDirectory()) {
+ fc = new JFileChooser(sdir);
+ }
+ else {
+ fc = new JFileChooser();
+ }
+
+ //Add a custom file filter and disable the default
+ //(Accept All) file filter.
+ fc.addChoosableFileFilter(new ImageFilter());
+ fc.setAcceptAllFileFilterUsed(false);
+
+ //Add custom icons for file types.
+ fc.setFileView(new ImageFileView());
+
+ //Add the preview pane.
+ fc.setAccessory(new ImagePreview(fc));
+
+ //Show it.
+ int returnVal = fc.showDialog(this, "選択");
+
+ //Process the results.
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fc.getSelectedFile();
+ arg1Panel_2.argField.setText(file.getName());
+ }
+
+ //Reset the file chooser for the next time it's shown.
+ fc.setSelectedFile(null);
+ }
+
+ /** Returns an ImageIcon, or null if the path was invalid. */
+ public static ImageIcon createImageIcon(String path) {
+ java.net.URL imgURL = MatchTime.class.getResource(path);
+ if (imgURL != null) {
+ return new ImageIcon(imgURL);
+ } else {
+ System.err.println("Couldn't find file: " + path);
+ return null;
+ }
+ }
+}
--- /dev/null
+package osm.jp.gpx.matchtime.gui;
+import java.awt.LayoutManager;
+
+import javax.swing.BoxLayout;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+/**
+ * パラメータを設定する為のパネル。
+ * この1インスタンスで、1パラメータをあらわす。
+ */
+@SuppressWarnings("serial")
+public class ParameterPanel extends JPanel {
+ public JTextField argField;
+ public JLabel argLabel;
+
+ public ParameterPanel(String label, String text) {
+ super();
+
+ argLabel = new JLabel(label);
+ argField = new JTextField(text);
+
+ this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
+ this.add(argLabel);
+ this.add(argField);
+ }
+
+ public String getText() {
+ return this.argField.getText();
+ }
+
+ public ParameterPanel(boolean isDoubleBuffered) {
+ super(isDoubleBuffered);
+ // TODO 自動生成されたコンストラクター・スタブ
+ }
+
+ public ParameterPanel(LayoutManager layout) {
+ super(layout);
+ // TODO 自動生成されたコンストラクター・スタブ
+ }
+
+ public ParameterPanel(LayoutManager layout, boolean isDoubleBuffered) {
+ super(layout, isDoubleBuffered);
+ // TODO 自動生成されたコンストラクター・スタブ
+ }
+
+}
--- /dev/null
+package osm.jp.gpx.matchtime.gui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+
+@SuppressWarnings("serial")
+public class ParameterPanelFolder extends ParameterPanel implements ActionListener {
+ JFileChooser fc;
+ JButton openButton, nextButton;
+
+ public ParameterPanelFolder(String label, String text) {
+ super(label, text);
+
+ //Create a file chooser
+ File sdir = new File(text);
+ if (sdir.isDirectory()) {
+ fc = new JFileChooser(sdir);
+ }
+ else {
+ fc = new JFileChooser();
+ }
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+
+ //Uncomment one of the following lines to try a different
+ //file selection mode. The first allows just directories
+ //to be selected (and, at least in the Java look and feel,
+ //shown). The second allows both files and directories
+ //to be selected. If you leave these lines commented out,
+ //then the default mode (FILES_ONLY) will be used.
+ //
+ //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+
+ //Create the open button. We use the image from the JLF
+ //Graphics Repository (but we extracted it from the jar).
+ openButton = new JButton("選択...", MatchTime.createImageIcon("images/Open16.gif"));
+ openButton.addActionListener(this);
+ this.add(openButton);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+
+ //Handle open button action.
+ if ((e.getSource() == openButton) || (e.getSource() == nextButton)){
+ int returnVal = fc.showOpenDialog(ParameterPanelFolder.this);
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fc.getSelectedFile();
+ this.argField.setText(file.getAbsolutePath());
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package osm.jp.gpx.matchtime.gui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+
+@SuppressWarnings("serial")
+public class ParameterPanelImageFile extends ParameterPanel implements ActionListener {
+ JFileChooser fc;
+ JButton openButton;
+ ParameterPanelFolder paramDir;
+
+ public ParameterPanelImageFile(String label, String text, ParameterPanelFolder paramDir) {
+ super(label, text);
+
+ //Create the open button. We use the image from the JLF
+ //Graphics Repository (but we extracted it from the jar).
+ openButton = new JButton("選択...");
+
+ /*
+ openButton.addActionListener(this);
+ */
+
+ this.add(openButton);
+
+ //Create a file chooser
+ this.paramDir = paramDir;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ /*
+ //Set up the file chooser.
+ File sdir = new File(paramDir.getText());
+ System.out.println(sdir.toPath());
+ if (sdir.isDirectory()) {
+ fc = new JFileChooser(sdir);
+ }
+ else {
+ fc = new JFileChooser();
+ }
+
+ //Add a custom file filter and disable the default
+ //(Accept All) file filter.
+ fc.addChoosableFileFilter(new ImageFilter());
+ fc.setAcceptAllFileFilterUsed(false);
+
+ //Add custom icons for file types.
+ fc.setFileView(new ImageFileView());
+
+ //Add the preview pane.
+ fc.setAccessory(new ImagePreview(fc));
+
+ //Show it.
+ int returnVal = fc.showDialog(ParameterPanelImageFile.this, "選択");
+
+ //Process the results.
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = fc.getSelectedFile();
+ this.argField.setText(file.getName());
+ }
+
+ //Reset the file chooser for the next time it's shown.
+ fc.setSelectedFile(null);
+ */
+ }
+}
\ No newline at end of file
--- /dev/null
+package osm.jp.gpx.matchtime.gui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+
+@SuppressWarnings("serial")
+public class ParameterPanelTime extends ParameterPanel implements ActionListener {
+ JFileChooser fc;
+ public JButton doButton;
+
+ public ParameterPanelTime(String label, String text) {
+ super(label, text);
+
+ doButton = new JButton("処理実行", MatchTime.createImageIcon("images/media_playback_start.png"));
+ doButton.addActionListener(this);
+ this.add(doButton);
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ }
+}
\ No newline at end of file
-package hayashi.yuu.gpx.gui;
+package osm.jp.gpx.matchtime.gui;
import java.awt.Font;
import java.awt.Rectangle;
@SuppressWarnings("serial")
public class QuitDialog extends JDialog implements WindowListener
{
+ public static final String TITLE = "終了?";
JButton yesButton;
JButton noButton;
JLabel label1;
--- /dev/null
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle or the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package osm.jp.gpx.matchtime.gui;
+
+import java.io.File;
+import javax.swing.ImageIcon;
+
+/* Utils.java is used by FileChooserDemo2.java. */
+public class Utils {
+ public final static String jpeg = "jpeg";
+ public final static String jpg = "jpg";
+ public final static String gif = "gif";
+ public final static String tiff = "tiff";
+ public final static String tif = "tif";
+ public final static String png = "png";
+
+ /*
+ * Get the extension of a file.
+ */
+ public static String getExtension(File f) {
+ String ext = null;
+ String s = f.getName();
+ int i = s.lastIndexOf('.');
+
+ if (i > 0 && i < s.length() - 1) {
+ ext = s.substring(i+1).toLowerCase();
+ }
+ return ext;
+ }
+
+ /** Returns an ImageIcon, or null if the path was invalid. */
+ protected static ImageIcon createImageIcon(String path) {
+ java.net.URL imgURL = Utils.class.getResource(path);
+ if (imgURL != null) {
+ return new ImageIcon(imgURL);
+ } else {
+ System.err.println("Couldn't find file: " + path);
+ return null;
+ }
+ }
+}