new branch 'gui'
1 parent b55fddb commit 06313c6d25a83a29cacd0c73a33921c46488b96f
@yuuhayashi yuuhayashi authored on 20 Jun 2014
Showing 16 changed files
View
1
■■■■
importPicture/.classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/workspace/hayashi_0225.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
View
36
importPicture/LICENSE.txt 0 → 100644
The MIT License (MIT)
 
Copyright (c) 2014 Yuu Hayashi
 
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
 
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
 
 
以下に定める条件に従い、本ソフトウェアおよび関連文書のファイル(以下「ソフトウェア」)の複製を取得するすべて
の人に対し、ソフトウェアを無制限に扱うことを無償で許可します。これには、ソフトウェアの複製を使用、複写、変
更、結合、掲載、頒布、サブライセンス、および/または販売する権利、およびソフトウェアを提供する相手に同じこ
とを許可する権利も無制限に含まれます。
 
上記の著作権表示および本許諾表示を、ソフトウェアのすべての複製または重要な部分に記載するものとします。
 
ソフトウェアは「現状のまま」で、明示であるか暗黙であるかを問わず、何らの保証もなく提供されます。ここでいう保証
とは、商品性、特定の目的への適合性、および権利非侵害についての保証も含みますが、それに限定されるもので
はありません。 作者または著作権者は、契約行為、不法行為、またはそれ以外であろうと、ソフトウェアに起因または
関連し、あるいはソフトウェアの使用またはその他の扱いによって生じる一切の請求、損害、その他の義務について何
らの責任も負わないものとします。
View
6
importPicture/README.jp.txt
exp)
 
> java -jar importPicture.jar list.csv . IMG_01234.JPG 2012-06-15T12:52:22 鎌倉宮_2012-06-15_12-00-16.gpx
 
 
-------------------------------------------------------------------
Copyright (c) 2014 Yuu Hayashi
This software is released under the MIT License, see LICENSE.txt.
View
158
importPicture/src/hayashi/yuu/gpx/gui/AboutDialog.java 0 → 100644
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) {
}
}
View
138
importPicture/src/hayashi/yuu/gpx/gui/CollectData.java 0 → 100644
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 "";
}
}
View
77
importPicture/src/hayashi/yuu/gpx/gui/DeviceItem.java 0 → 100644
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);
}
View
importPicture/src/hayashi/yuu/gpx/gui/FooterPanel.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/MainPanel.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/MainPanelData.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/PictureMapper.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/QuitDialog.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/SaveDialog.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/StartModePanel.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/TitlePanel.java 0 → 100644
View
importPicture/src/hayashi/yuu/gpx/gui/TouchScreen.java 0 → 100644
View
importPicture/src/osm/jp/gpx/ImportPicture.java