Revision 2165 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.swing/org.gvsig.tools.swing.impl/src/main/java/org/gvsig/tools/swing/impl/pickercontroller/FilePickerControllerImpl.java
FilePickerControllerImpl.java | ||
---|---|---|
1 | 1 |
package org.gvsig.tools.swing.impl.pickercontroller; |
2 | 2 |
|
3 | 3 |
import java.awt.event.ActionEvent; |
4 |
import java.awt.event.ActionListener; |
|
5 | 4 |
import java.awt.event.KeyAdapter; |
6 | 5 |
import java.awt.event.KeyEvent; |
7 | 6 |
import java.io.File; |
... | ... | |
9 | 8 |
import javax.swing.ImageIcon; |
10 | 9 |
import javax.swing.JButton; |
11 | 10 |
import javax.swing.JFileChooser; |
12 |
import javax.swing.JTextField; |
|
13 | 11 |
import javax.swing.filechooser.FileFilter; |
12 |
import javax.swing.text.JTextComponent; |
|
14 | 13 |
import org.apache.commons.lang3.ArrayUtils; |
15 | 14 |
import org.gvsig.tools.ToolsLocator; |
16 | 15 |
import org.gvsig.tools.dataTypes.DataTypes; |
... | ... | |
33 | 32 |
implements FilePickerController { |
34 | 33 |
|
35 | 34 |
private final JButton btnFile; |
36 |
private final JTextField txtFile;
|
|
35 |
private final JTextComponent txtFile;
|
|
37 | 36 |
private final File initialPath; |
38 | 37 |
private final String fileChooserID; |
39 | 38 |
private final String dialogTitle; |
... | ... | |
57 | 56 |
} |
58 | 57 |
} |
59 | 58 |
|
60 |
public FilePickerControllerImpl(JTextField txtFile, JButton btnFile, String dialogTitle) {
|
|
59 |
public FilePickerControllerImpl(JTextComponent txtFile, JButton btnFile, String dialogTitle) {
|
|
61 | 60 |
this(txtFile, btnFile, dialogTitle, null, null, true); |
62 | 61 |
} |
63 | 62 |
|
64 |
public FilePickerControllerImpl(JTextField txtFile, JButton btnFile) {
|
|
63 |
public FilePickerControllerImpl(JTextComponent txtFile, JButton btnFile) {
|
|
65 | 64 |
this(txtFile, btnFile, null, null, null, true); |
66 | 65 |
} |
67 | 66 |
|
68 |
public FilePickerControllerImpl(JTextField txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon) {
|
|
67 |
public FilePickerControllerImpl(JTextComponent txtFile, JButton btnFile, String dialogTitle, String fileChooserID, File initialPath, boolean seticon) {
|
|
69 | 68 |
this.value = null; |
70 | 69 |
this.txtFile = txtFile; |
71 | 70 |
this.btnFile = btnFile; |
... | ... | |
81 | 80 |
this.btnFile.setIcon(this.getIcon("picker-file")); |
82 | 81 |
this.btnFile.setText(""); |
83 | 82 |
} |
84 |
this.btnFile.addActionListener(new ActionListener() { |
|
85 |
@Override |
|
86 |
public void actionPerformed(ActionEvent e) { |
|
87 |
doSelectFile(); |
|
88 |
} |
|
83 |
this.btnFile.addActionListener((ActionEvent e) -> { |
|
84 |
doSelectFile(); |
|
89 | 85 |
}); |
90 | 86 |
ToolsSwingManager toolsSwingManager = ToolsSwingLocator.getToolsSwingManager(); |
91 | 87 |
toolsSwingManager.setDefaultPopupMenu(txtFile); |
92 |
toolsSwingManager.addClearButton(txtFile, new ActionListener() { |
|
93 |
@Override |
|
94 |
public void actionPerformed(ActionEvent e) { |
|
95 |
doClear(); |
|
96 |
} |
|
88 |
toolsSwingManager.addClearButton(txtFile, (ActionEvent e) -> { |
|
89 |
doClear(); |
|
97 | 90 |
}); |
98 | 91 |
//this.txtFile.setEditable(false); |
99 | 92 |
this.txtFile.addKeyListener(new KeyAdapter() { |
Also available in: Unified diff