1 package osm.surveyor.matchtime.gui;
3 import java.awt.event.ActionEvent;
4 import java.awt.event.ActionListener;
7 import javax.swing.JButton;
8 import javax.swing.JCheckBox;
9 import javax.swing.JFileChooser;
11 @SuppressWarnings("serial")
12 public class ParameterPanelGpx extends ParameterPanel implements ActionListener
16 public JCheckBox noFirstNode; // CheckBox: "セグメント'trkseg'の最初の1ノードは無視する。"
17 public JCheckBox gpxReuse; // CheckBox: "生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も変換の対象にする"
24 public ParameterPanelGpx(String label, String text) {
28 selectButton = new JButton(
29 i18n.getString("button.select"),
30 ReStamp.createImageIcon("/images/Open16.gif")
32 selectButton.addActionListener(this);
33 this.add(selectButton);
37 public void actionPerformed(ActionEvent e) {
38 if (e.getSource() == selectButton){
39 System.out.println("ParameterPanelGpx.actionPerformed(openButton)");
40 File sdir = new File(this.argField.getText());
42 this.fc = new JFileChooser(sdir);
45 this.fc = new JFileChooser();
47 this.fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
48 this.fc.addChoosableFileFilter(new GpxAndFolderFilter());
49 this.fc.setAcceptAllFileFilterUsed(false);
51 int returnVal = this.fc.showOpenDialog(ParameterPanelGpx.this);
53 if (returnVal == JFileChooser.APPROVE_OPTION) {
54 File file = this.fc.getSelectedFile();
55 this.argField.setText(file.getAbsolutePath());
60 public File getGpxFile() {
62 return new File(getText());
67 public boolean isNoFirstNodeSelected() {
68 return (noFirstNode != null) && noFirstNode.isSelected();
71 public boolean isGpxReuseSelected() {
72 return (gpxReuse != null) && gpxReuse.isSelected();
76 * このフィールドに有効な値が設定されているかどうか
80 public boolean isEnable() {
81 String text = this.argField.getText();
83 File file = new File(text);
86 String name = file.getName().toUpperCase();
87 if (name.endsWith(".GPX")) {
91 else if (file.isDirectory()) {