You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by me...@apache.org on 2001/01/16 22:45:44 UTC
cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer FilePropertyEditor.java
metasim 01/01/16 13:45:44
Modified: src/antidote/org/apache/tools/ant/gui/customizer
FilePropertyEditor.java
Log:
Fixed bug where change event was not getting fired.
Revision Changes Path
1.2 +7 -21 jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/FilePropertyEditor.java
Index: FilePropertyEditor.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/customizer/FilePropertyEditor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FilePropertyEditor.java 2001/01/16 19:21:20 1.1
+++ FilePropertyEditor.java 2001/01/16 21:45:44 1.2
@@ -66,7 +66,7 @@
/**
* Custom property editor for File types.
*
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @author Simeon Fitch
*/
public class FilePropertyEditor extends AbstractPropertyEditor {
@@ -74,8 +74,6 @@
private JTextField _widget = null;
/** Container for the editor. */
private JPanel _container = null;
- /** Default path. */
- private String _path = null;
/** File filter to use. */
private FileFilter _filter = null;
@@ -87,11 +85,7 @@
_container = new JPanel(new BorderLayout());
- _widget = new JTextField() {
- public boolean isManagingFocus() {
- return false;
- }
- };
+ _widget = new JTextField();
_widget.addFocusListener(new FocusHandler(this));
@@ -194,15 +188,6 @@
return new File(_widget.getText()).getAbsolutePath();
}
- /**
- * Set the default path for the file chooser
- *
- * @param path default path
- */
- public void setDefaultPath(String path) {
- _path = path;
- }
-
/** Handler for presses of the browse button. */
private class ActionHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
@@ -210,9 +195,6 @@
if(_widget.getText().length() > 0) {
chooser = new JFileChooser(_widget.getText());
}
- else if(_path != null) {
- chooser = new JFileChooser(_path);
- }
else {
chooser = new JFileChooser();
}
@@ -222,7 +204,11 @@
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
if(chooser.showDialog(getChild(), "Select") ==
JFileChooser.APPROVE_OPTION) {
- setValue(chooser.getSelectedFile());
+ Object oldValue = getValue();
+ Object newValue = chooser.getSelectedFile();
+
+ setValue(newValue);
+ firePropertyChange(oldValue, newValue);
}
}
}