/[classpath]/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicFileChooserUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.5 by gnu_andrew, Tue Sep 20 18:46:33 2005 UTC revision 1.2.2.6 by gnu_andrew, Wed Nov 2 00:43:53 2005 UTC
# Line 48  import java.awt.Point; Line 48  import java.awt.Point;
48  import java.awt.Polygon;  import java.awt.Polygon;
49  import java.awt.Window;  import java.awt.Window;
50  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;  
51  import java.awt.event.ItemEvent;  import java.awt.event.ItemEvent;
52  import java.awt.event.ItemListener;  import java.awt.event.ItemListener;
53  import java.awt.event.MouseAdapter;  import java.awt.event.MouseAdapter;
# Line 60  import java.io.File; Line 59  import java.io.File;
59  import java.io.IOException;  import java.io.IOException;
60  import java.util.ArrayList;  import java.util.ArrayList;
61  import java.util.Hashtable;  import java.util.Hashtable;
62    
63  import javax.swing.AbstractAction;  import javax.swing.AbstractAction;
64  import javax.swing.Action;  import javax.swing.Action;
 import javax.swing.BoxLayout;  
65  import javax.swing.ButtonGroup;  import javax.swing.ButtonGroup;
66  import javax.swing.Icon;  import javax.swing.Icon;
67  import javax.swing.JButton;  import javax.swing.JButton;
# Line 92  import javax.swing.plaf.FileChooserUI; Line 91  import javax.swing.plaf.FileChooserUI;
91    
92    
93  /**  /**
94   * DOCUMENT ME!   * A UI delegate for the {@link JFileChooser} component under the
95     * {@link BasicLookAndFeel}.
96   */   */
97  public class BasicFileChooserUI extends FileChooserUI  public class BasicFileChooserUI extends FileChooserUI
98  {  {
99    /**    /**
100     * DOCUMENT ME!     * A file filter that accepts all files.
101     */     */
102    protected class AcceptAllFileFilter extends FileFilter    protected class AcceptAllFileFilter extends FileFilter
103    {    {
104        /**
105         * Creates a new instance.
106         */
107      public AcceptAllFileFilter()      public AcceptAllFileFilter()
108      {      {
109          // Nothing to do here.
110      }      }
111            
112      /**      /**
113       * DOCUMENT ME!       * Returns <code>true</code> always, as all files are accepted by this
114         * filter.
115       *       *
116       * @param f DOCUMENT ME!       * @param f  the file.
117       *       *
118       * @return DOCUMENT ME!       * @return Always <code>true</code>.
119       */       */
120      public boolean accept(File f)      public boolean accept(File f)
121      {      {
# Line 118  public class BasicFileChooserUI extends Line 123  public class BasicFileChooserUI extends
123      }      }
124    
125      /**      /**
126       * DOCUMENT ME!       * Returns a description for this filter.
127       *       *
128       * @return DOCUMENT ME!       * @return A description for the file filter.
129       */       */
130      public String getDescription()      public String getDescription()
131      {      {
# Line 129  public class BasicFileChooserUI extends Line 134  public class BasicFileChooserUI extends
134    }    }
135    
136    /**    /**
137     * DOCUMENT ME!     * Handles a user action to approve the dialog selection.
138       *
139       * @see BasicFileChooserUI#getApproveSelectionAction()
140     */     */
141    protected class ApproveSelectionAction extends AbstractAction    protected class ApproveSelectionAction extends AbstractAction
142    {    {
# Line 138  public class BasicFileChooserUI extends Line 145  public class BasicFileChooserUI extends
145       */       */
146      protected ApproveSelectionAction()      protected ApproveSelectionAction()
147      {      {
148          // Nothing to do here.
149      }      }
150    
151      /**      /**
152       * DOCUMENT ME!       * Sets the current selection and closes the dialog.
153       *       *
154       * @param e       * @param e  the action event.
      *          DOCUMENT ME!  
155       */       */
156      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
157      {      {
# Line 167  public class BasicFileChooserUI extends Line 174  public class BasicFileChooserUI extends
174    }    }
175    
176    /**    /**
177     * DOCUMENT ME!     * Provides presentation information about files and directories.
178     */     */
179    protected class BasicFileView extends FileView    protected class BasicFileView extends FileView
180    {    {
181      /** DOCUMENT ME! */      /** Storage for cached icons. */
182      protected Hashtable iconCache = new Hashtable();      protected Hashtable iconCache = new Hashtable();
183    
184        /**
185         * Creates a new instance.
186         */
187      public BasicFileView()      public BasicFileView()
188      {      {
189          // Nothing to do here.
190      }      }
191    
192      /**      /**
193       * DOCUMENT ME!       * Adds an icon to the cache, associating it with the given file/directory.
194       *       *
195       * @param f DOCUMENT ME!       * @param f  the file/directory.
196       * @param i DOCUMENT ME!       * @param i  the icon.
197       */       */
198      public void cacheIcon(File f, Icon i)      public void cacheIcon(File f, Icon i)
199      {      {
# Line 190  public class BasicFileChooserUI extends Line 201  public class BasicFileChooserUI extends
201      }      }
202    
203      /**      /**
204       * DOCUMENT ME!       * Clears the icon cache.
205       */       */
206      public void clearIconCache()      public void clearIconCache()
207      {      {
# Line 198  public class BasicFileChooserUI extends Line 209  public class BasicFileChooserUI extends
209      }      }
210    
211      /**      /**
212       * DOCUMENT ME!       * Retrieves the icon associated with the specified file/directory, if
213         * there is one.
214       *       *
215       * @param f DOCUMENT ME!       * @param f  the file/directory.
216       *       *
217       * @return DOCUMENT ME!       * @return The cached icon (or <code>null</code>).
218       */       */
219      public Icon getCachedIcon(File f)      public Icon getCachedIcon(File f)
220      {      {
# Line 210  public class BasicFileChooserUI extends Line 222  public class BasicFileChooserUI extends
222      }      }
223    
224      /**      /**
225       * DOCUMENT ME!       * Returns a description of the given file/directory.  In this
226         * implementation, the description is the same as the name returned by
227         * {@link #getName(File)}.
228       *       *
229       * @param f DOCUMENT ME!       * @param f  the file/directory.
230       *       *
231       * @return DOCUMENT ME!       * @return A description of the given file/directory.
232       */       */
233      public String getDescription(File f)      public String getDescription(File f)
234      {      {
# Line 222  public class BasicFileChooserUI extends Line 236  public class BasicFileChooserUI extends
236      }      }
237    
238      /**      /**
239       * DOCUMENT ME!       * Returns an icon appropriate for the given file or directory.
240       *       *
241       * @param f DOCUMENT ME!       * @param f  the file/directory.
242       *       *
243       * @return DOCUMENT ME!       * @return An icon.
244       */       */
245      public Icon getIcon(File f)      public Icon getIcon(File f)
246      {      {
# Line 242  public class BasicFileChooserUI extends Line 256  public class BasicFileChooserUI extends
256      }      }
257    
258      /**      /**
259       * DOCUMENT ME!       * Returns the name for the given file/directory.
260       *       *
261       * @param f DOCUMENT ME!       * @param f  the file/directory.
262       *       *
263       * @return DOCUMENT ME!       * @return The name of the file/directory.
264       */       */
265      public String getName(File f)      public String getName(File f)
266      {      {
# Line 254  public class BasicFileChooserUI extends Line 268  public class BasicFileChooserUI extends
268      }      }
269    
270      /**      /**
271       * DOCUMENT ME!       * Returns a localised description for the type of file/directory.
272       *       *
273       * @param f DOCUMENT ME!       * @param f  the file/directory.
274       *       *
275       * @return DOCUMENT ME!       * @return A type description for the given file/directory.
276       */       */
277      public String getTypeDescription(File f)      public String getTypeDescription(File f)
278      {      {
# Line 269  public class BasicFileChooserUI extends Line 283  public class BasicFileChooserUI extends
283      }      }
284    
285      /**      /**
286       * DOCUMENT ME!       * Returns {@link Boolean#TRUE} if the given file/directory is hidden,
287         * and {@link Boolean#FALSE} otherwise.
288       *       *
289       * @param f DOCUMENT ME!       * @param f  the file/directory.
290       *       *
291       * @return DOCUMENT ME!       * @return {@link Boolean#TRUE} or {@link Boolean#FALSE}.
292       */       */
293      public Boolean isHidden(File f)      public Boolean isHidden(File f)
294      {      {
# Line 282  public class BasicFileChooserUI extends Line 297  public class BasicFileChooserUI extends
297    }    }
298    
299    /**    /**
300     * DOCUMENT ME!     * Handles an action to cancel the file chooser.
301       *
302       * @see BasicFileChooserUI#getCancelSelectionAction()
303     */     */
304    protected class CancelSelectionAction extends AbstractAction    protected class CancelSelectionAction extends AbstractAction
305    {    {
306      /**      /**
307       * Creates a new CancelSelectionAction object.       * Creates a new <code>CancelSelectionAction</code> object.
308       */       */
309      protected CancelSelectionAction()      protected CancelSelectionAction()
310      {      {
311          // Nothing to do here.
312      }      }
313    
314      /**      /**
315       * DOCUMENT ME!       * Cancels the selection and closes the dialog.
316       *       *
317       * @param e DOCUMENT ME!       * @param e  the action event (ignored).
318       */       */
319      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
320      {      {
# Line 306  public class BasicFileChooserUI extends Line 324  public class BasicFileChooserUI extends
324    }    }
325    
326    /**    /**
327     * DOCUMENT ME!     * An action to handle changes to the parent directory (for example, via
328       * a click on the "up folder" button).
329       *
330       * @see BasicFileChooserUI#getChangeToParentDirectoryAction()
331     */     */
332    protected class ChangeToParentDirectoryAction extends AbstractAction    protected class ChangeToParentDirectoryAction extends AbstractAction
333    {    {
334      /**      /**
335       * Creates a new ChangeToParentDirectoryAction object.       * Creates a new <code>ChangeToParentDirectoryAction</code> object.
336       */       */
337      protected ChangeToParentDirectoryAction()      protected ChangeToParentDirectoryAction()
338      {      {
339          // Nothing to do here.
340      }      }
341    
342      /**      /**
343       * DOCUMENT ME!       * Handles the action event.
344       *       *
345       * @param e DOCUMENT ME!       * @param e  the action event.
346       */       */
347      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
348      {      {
# Line 331  public class BasicFileChooserUI extends Line 353  public class BasicFileChooserUI extends
353    }    }
354    
355    /**    /**
356     * DOCUMENT ME!     * A mouse listener that handles double-click events.
357       *
358       * @see BasicFileChooserUI#createDoubleClickListener(JFileChooser, JList)
359     */     */
360    protected class DoubleClickListener extends MouseAdapter    protected class DoubleClickListener extends MouseAdapter
361    {    {
362      /** DOCUMENT ME! */      /** A timer. */
363      private Timer timer = null;      private Timer timer = null;
364    
365      /** DOCUMENT ME! */      /** DOCUMENT ME! */
# Line 359  public class BasicFileChooserUI extends Line 383  public class BasicFileChooserUI extends
383      }      }
384    
385      /**      /**
386       * DOCUMENT ME!       * Handles a mouse click event.
387       *       *
388       * @param e       * @param e  the event.
      *          DOCUMENT ME!  
389       */       */
390      public void mouseClicked(MouseEvent e)      public void mouseClicked(MouseEvent e)
391      {      {
# Line 408  public class BasicFileChooserUI extends Line 431  public class BasicFileChooserUI extends
431      }      }
432    
433      /**      /**
434       * DOCUMENT ME!       * Handles a mouse entered event (NOT IMPLEMENTED).
435       *       *
436       * @param e       * @param e  the mouse event.
      *          DOCUMENT ME!  
437       */       */
438      public void mouseEntered(MouseEvent e)      public void mouseEntered(MouseEvent e)
439      {      {
# Line 420  public class BasicFileChooserUI extends Line 442  public class BasicFileChooserUI extends
442    }    }
443    
444    /**    /**
445     * DOCUMENT ME!     * An action that changes the file chooser to display the user's home
446       * directory.
447       *
448       * @see BasicFileChooserUI#getGoHomeAction()
449     */     */
450    protected class GoHomeAction extends AbstractAction    protected class GoHomeAction extends AbstractAction
451    {    {
452      /**      /**
453       * Creates a new GoHomeAction object.       * Creates a new <code>GoHomeAction</code> object.
454       */       */
455      protected GoHomeAction()      protected GoHomeAction()
456      {      {
457          // Nothing to do here.
458      }      }
459    
460      /**      /**
461       * DOCUMENT ME!       * Sets the directory to the user's home directory, and repaints the
462         * file chooser component.
463       *       *
464       * @param e DOCUMENT ME!       * @param e  the action event (ignored).
465       */       */
466      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
467      {      {
# Line 446  public class BasicFileChooserUI extends Line 473  public class BasicFileChooserUI extends
473    }    }
474    
475    /**    /**
476     * DOCUMENT ME!     * An action that handles the creation of a new folder/directory.
477       *
478       * @see BasicFileChooserUI#getNewFolderAction()
479     */     */
480    protected class NewFolderAction extends AbstractAction    protected class NewFolderAction extends AbstractAction
481    {    {
482      /**      /**
483       * Creates a new NewFolderAction object.       * Creates a new <code>NewFolderAction</code> object.
484       */       */
485      protected NewFolderAction()      protected NewFolderAction()
486      {      {
487          // Nothing to do here.
488      }      }
489    
490      /**      /**
491       * DOCUMENT ME!       * Handles the event by creating a new folder.
492       *       *
493       * @param e DOCUMENT ME!       * @param e  the action event (ignored).
494       */       */
495      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
496      {      {
# Line 479  public class BasicFileChooserUI extends Line 509  public class BasicFileChooserUI extends
509    }    }
510    
511    /**    /**
512     * DOCUMENT ME!     * A listener for selection events in the file list.
513       *
514       * @see BasicFileChooserUI#createListSelectionListener(JFileChooser)
515     */     */
516    protected class SelectionListener implements ListSelectionListener    protected class SelectionListener implements ListSelectionListener
517    {    {
518      /**      /**
519       * Creates a new SelectionListener object.       * Creates a new <code>SelectionListener</code> object.
520       */       */
521      protected SelectionListener()      protected SelectionListener()
522      {      {
523          // Nothing to do here.
524      }      }
525    
526      /**      /**
# Line 510  public class BasicFileChooserUI extends Line 543  public class BasicFileChooserUI extends
543    
544    /**    /**
545     * DOCUMENT ME!     * DOCUMENT ME!
546       *
547       * @see BasicFileChooserUI#getUpdateAction()
548     */     */
549    protected class UpdateAction extends AbstractAction    protected class UpdateAction extends AbstractAction
550    {    {
# Line 518  public class BasicFileChooserUI extends Line 553  public class BasicFileChooserUI extends
553       */       */
554      protected UpdateAction()      protected UpdateAction()
555      {      {
556          // Nothing to do here.
557      }      }
558    
559      /**      /**
560       * DOCUMENT ME!       * NOT YET IMPLEMENTED.
561       *       *
562       * @param e DOCUMENT ME!       * @param e  the action event.
563       */       */
564      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
565      {      {
566          // FIXME: implement this
567      }      }
568    }    }
569    
570    /** DOCUMENT ME! */    /** The localised mnemonic for the cancel button. */
571    protected int cancelButtonMnemonic;    protected int cancelButtonMnemonic;
572    
573    /** DOCUMENT ME! */    /** The localised text for the cancel button. */
574    protected String cancelButtonText;    protected String cancelButtonText;
575    
576    /** DOCUMENT ME! */    /** The localised tool tip text for the cancel button. */
577    protected String cancelButtonToolTipText;    protected String cancelButtonToolTipText;
578    
579    /** DOCUMENT ME! */    /** An icon representing a computer. */
580    protected Icon computerIcon = new Icon()    protected Icon computerIcon = new Icon()
581      {      {
582        public int getIconHeight()        public int getIconHeight()
# Line 554  public class BasicFileChooserUI extends Line 591  public class BasicFileChooserUI extends
591    
592        public void paintIcon(Component c, Graphics g, int x, int y)        public void paintIcon(Component c, Graphics g, int x, int y)
593        {        {
594            // FIXME: is this not implemented, or is the icon intentionally blank?
595        }        }
596      };      };
597    
598    /** DOCUMENT ME! */    /** An icon for the "details view" button. */
599    protected Icon detailsViewIcon = new Icon()    protected Icon detailsViewIcon = new Icon()
600      {      {
601        public int getIconHeight()        public int getIconHeight()
# Line 586  public class BasicFileChooserUI extends Line 624  public class BasicFileChooserUI extends
624        }        }
625      };      };
626    
627    /** DOCUMENT ME! */    /** An icon representing a directory. */
628    protected Icon directoryIcon = new Icon()    protected Icon directoryIcon = new Icon()
629      {      {
630        public int getIconHeight()        public int getIconHeight()
# Line 625  public class BasicFileChooserUI extends Line 663  public class BasicFileChooserUI extends
663        }        }
664      };      };
665    
666    /** DOCUMENT ME! */    /** The localised Mnemonic for the open button. */
667    protected int directoryOpenButtonMnemonic;    protected int directoryOpenButtonMnemonic;
668    
669    /** DOCUMENT ME! */    /** The localised text for the open button. */
670    protected String directoryOpenButtonText;    protected String directoryOpenButtonText;
671    
672    /** DOCUMENT ME! */    /** The localised tool tip text for the open button. */
673    protected String directoryOpenButtonToolTipText;    protected String directoryOpenButtonToolTipText;
674    
675    /** DOCUMENT ME! */    /** An icon representing a file. */
676    protected Icon fileIcon = new Icon()    protected Icon fileIcon = new Icon()
677      {      {
678        public int getIconHeight()        public int getIconHeight()
# Line 674  public class BasicFileChooserUI extends Line 712  public class BasicFileChooserUI extends
712        }        }
713      };      };
714    
715    /** DOCUMENT ME! */    /** An icon representing a floppy drive. */
716    protected Icon floppyDriveIcon = new Icon()    protected Icon floppyDriveIcon = new Icon()
717      {      {
718        public int getIconHeight()        public int getIconHeight()
# Line 689  public class BasicFileChooserUI extends Line 727  public class BasicFileChooserUI extends
727    
728        public void paintIcon(Component c, Graphics g, int x, int y)        public void paintIcon(Component c, Graphics g, int x, int y)
729        {        {
730            // FIXME: is this not implemented, or is the icon intentionally blank?
731        }        }
732      };      };
733    
734    /** DOCUMENT ME! */    /** An icon representing a hard drive. */
735    protected Icon hardDriveIcon = new Icon()    protected Icon hardDriveIcon = new Icon()
736      {      {
737        public int getIconHeight()        public int getIconHeight()
# Line 707  public class BasicFileChooserUI extends Line 746  public class BasicFileChooserUI extends
746    
747        public void paintIcon(Component c, Graphics g, int x, int y)        public void paintIcon(Component c, Graphics g, int x, int y)
748        {        {
749            // FIXME: is this not implemented, or is the icon intentionally blank?
750        }        }
751      };      };
752    
753    /** DOCUMENT ME! */    /** The localised mnemonic for the "help" button. */
754    protected int helpButtonMnemonic;    protected int helpButtonMnemonic;
755    
756    /** DOCUMENT ME! */    /** The localised text for the "help" button. */
757    protected String helpButtonText;    protected String helpButtonText;
758    
759    /** DOCUMENT ME! */    /** The localised tool tip text for the help button. */
760    protected String helpButtonToolTipText;    protected String helpButtonToolTipText;
761    
762    /** DOCUMENT ME! */    /** An icon representing the user's home folder. */
763    protected Icon homeFolderIcon = new Icon()    protected Icon homeFolderIcon = new Icon()
764      {      {
765        public int getIconHeight()        public int getIconHeight()
# Line 759  public class BasicFileChooserUI extends Line 799  public class BasicFileChooserUI extends
799        }        }
800      };      };
801    
802    /** DOCUMENT ME! */    /** An icon for the "list view" button. */
803    protected Icon listViewIcon = new Icon()    protected Icon listViewIcon = new Icon()
804      {      {
805        public int getIconHeight()        public int getIconHeight()
# Line 801  public class BasicFileChooserUI extends Line 841  public class BasicFileChooserUI extends
841        }        }
842      };      };
843    
844    /** DOCUMENT ME! */    /** An icon for the "new folder" button. */
845    protected Icon newFolderIcon = directoryIcon;    protected Icon newFolderIcon = directoryIcon;
846    
847    /** DOCUMENT ME! */    /** The localised mnemonic for the "open" button. */
848    protected int openButtonMnemonic;    protected int openButtonMnemonic;
849    
850    /** DOCUMENT ME! */    /** The localised text for the "open" button. */
851    protected String openButtonText;    protected String openButtonText;
852    
853    /** DOCUMENT ME! */    /** The localised tool tip text for the "open" button. */
854    protected String openButtonToolTipText;    protected String openButtonToolTipText;
855    
856    /** DOCUMENT ME! */    /** The localised mnemonic for the "save" button. */
857    protected int saveButtonMnemonic;    protected int saveButtonMnemonic;
858    
859    /** DOCUMENT ME! */    /** The localised text for the "save" button. */
860    protected String saveButtonText;    protected String saveButtonText;
861    
862    /** DOCUMENT ME! */    /** The localised tool tip text for the save button. */
863    protected String saveButtonToolTipText;    protected String saveButtonToolTipText;
864    
865    /** DOCUMENT ME! */    /** The localised mnemonic for the "update" button. */
866    protected int updateButtonMnemonic;    protected int updateButtonMnemonic;
867    
868    /** DOCUMENT ME! */    /** The localised text for the "update" button. */
869    protected String updateButtonText;    protected String updateButtonText;
870    
871    /** DOCUMENT ME! */    /** The localised tool tip text for the "update" button. */
872    protected String updateButtonToolTipText;    protected String updateButtonToolTipText;
873    
874    /** DOCUMENT ME! */    /** An icon for the "up folder" button. */
875    protected Icon upFolderIcon = new Icon()    protected Icon upFolderIcon = new Icon()
876      {      {
877        public int getIconHeight()        public int getIconHeight()
# Line 882  public class BasicFileChooserUI extends Line 922  public class BasicFileChooserUI extends
922    
923    // -- begin private, but package local since used in inner classes --    // -- begin private, but package local since used in inner classes --
924    
925      /** The file chooser component represented by this UI delegate. */
926    JFileChooser filechooser;    JFileChooser filechooser;
927    
928    /** DOCUMENT ME! */    /** The file list. */
929    JList filelist;    JList filelist;
930    
931    /** DOCUMENT ME! */    /** The combo box used to display/select file filters. */
932    JComboBox filters;    JComboBox filters;
933    
934    /** DOCUMENT ME! */    /** The model for the directory list. */
935    BasicDirectoryModel model;    BasicDirectoryModel model;
936    
937    /** DOCUMENT ME! */    /** The file filter for all files. */
938    FileFilter acceptAll = new AcceptAllFileFilter();    FileFilter acceptAll = new AcceptAllFileFilter();
939    
940    /** DOCUMENT ME! */    /** The default file view. */
941    FileView fv = new BasicFileView();    FileView fv = new BasicFileView();
942    
943    /** DOCUMENT ME! */    /** The icon size. */
944    static final int ICON_SIZE = 24;    static final int ICON_SIZE = 24;
945    
946    /** DOCUMENT ME! */    /** A combo box for display/selection of parent directories. */
947    JComboBox parents;    JComboBox parents;
948    
949    /** DOCUMENT ME! */    /** The current file name. */
950    String filename;    String filename;
951    
952    /** DOCUMENT ME! */    /** The accept (open/save) button. */
953    JButton accept;    JButton accept;
954    
955    /** DOCUMENT ME! */    /** The cancel button. */
956    JButton cancel;    JButton cancel;
957    
958    /** DOCUMENT ME! */    /** The button to move up to the parent directory. */
959    JButton upFolderButton;    JButton upFolderButton;
960    
961    /** DOCUMENT ME! */    /** The button to create a new directory. */
962    JButton newFolderButton;    JButton newFolderButton;
963    
964    /** DOCUMENT ME! */    /** The button to move to the user's home directory. */
965    JButton homeFolderButton;    JButton homeFolderButton;
966    
967    /** DOCUMENT ME! */    /** An optional accessory panel. */
968    JPanel accessoryPanel;    JPanel accessoryPanel;
969    
970    /** DOCUMENT ME! */    /** A property change listener. */
971    PropertyChangeListener propertyChangeListener;    PropertyChangeListener propertyChangeListener;
972    
973    /** DOCUMENT ME! */    /** The text describing the filter for "all files". */
974    String acceptAllFileFilterText;    String acceptAllFileFilterText;
975    
976    /** DOCUMENT ME! */    /** The text describing a directory type. */
977    String dirDescText;    String dirDescText;
978    
979    /** DOCUMENT ME! */    /** The text describing a file type. */
980    String fileDescText;    String fileDescText;
981    
982    /** DOCUMENT ME! */    /** Is a directory selected? */
983    boolean dirSelected = false;    boolean dirSelected = false;
984    
985    /** DOCUMENT ME! */    /** The current directory. */
986    File currDir = null;    File currDir = null;
987    
988      // FIXME: describe what is contained in the bottom panel
989      /** The bottom panel. */
990    JPanel bottomPanel;    JPanel bottomPanel;
991        
992    /** DOCUMENT ME! */    /** The close panel. */
993    JPanel closePanel;    JPanel closePanel;
994    
995    /** Text box that displays file name */    /** Text box that displays file name */
# Line 997  public class BasicFileChooserUI extends Line 1040  public class BasicFileChooserUI extends
1040      }      }
1041    }    }
1042    
1043      /**
1044       * Closes the dialog.
1045       */
1046    void closeDialog()    void closeDialog()
1047    {    {
1048      Window owner = SwingUtilities.windowForComponent(filechooser);      Window owner = SwingUtilities.windowForComponent(filechooser);
# Line 1005  public class BasicFileChooserUI extends Line 1051  public class BasicFileChooserUI extends
1051    }    }
1052    
1053    /**    /**
1054     * Creates a new BasicFileChooserUI object.     * Creates a new <code>BasicFileChooserUI</code> object.
1055     *     *
1056     * @param b DOCUMENT ME!     * @param b  the file chooser component.
1057     */     */
1058    public BasicFileChooserUI(JFileChooser b)    public BasicFileChooserUI(JFileChooser b)
1059    {    {
# Line 1015  public class BasicFileChooserUI extends Line 1061  public class BasicFileChooserUI extends
1061    }    }
1062    
1063    /**    /**
1064     * DOCUMENT ME!     * Returns a UI delegate for the given component.
1065     *     *
1066     * @param c DOCUMENT ME!     * @param c  the component (should be a {@link JFileChooser}).
1067     *     *
1068     * @return DOCUMENT ME!     * @return A new UI delegate.
1069     */     */
1070    public static ComponentUI createUI(JComponent c)    public static ComponentUI createUI(JComponent c)
1071    {    {
# Line 1027  public class BasicFileChooserUI extends Line 1073  public class BasicFileChooserUI extends
1073    }    }
1074    
1075    /**    /**
1076     * DOCUMENT ME!     * Installs the UI for the specified component.
1077     *     *
1078     * @param c     * @param c  the component (should be a {@link JFileChooser}).
    *          DOCUMENT ME!  
1079     */     */
1080    public void installUI(JComponent c)    public void installUI(JComponent c)
1081    {    {
# Line 1051  public class BasicFileChooserUI extends Line 1096  public class BasicFileChooserUI extends
1096    }    }
1097    
1098    /**    /**
1099     * DOCUMENT ME!     * Uninstalls this UI from the given component.
1100     *     *
1101     * @param c     * @param c  the component (should be a {@link JFileChooser}).
    *          DOCUMENT ME!  
1102     */     */
1103    public void uninstallUI(JComponent c)    public void uninstallUI(JComponent c)
1104    {    {
# Line 1161  public class BasicFileChooserUI extends Line 1205  public class BasicFileChooserUI extends
1205    }    }
1206    
1207    /**    /**
1208     * DOCUMENT ME!     * Creates and install the subcomponents for the file chooser.
1209     *     *
1210     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1211     */     */
1212    public void installComponents(JFileChooser fc)    public void installComponents(JFileChooser fc)
1213    {    {
# Line 1285  public class BasicFileChooserUI extends Line 1329  public class BasicFileChooserUI extends
1329    }    }
1330    
1331    /**    /**
1332     * DOCUMENT ME!     * Uninstalls the components from the file chooser.
1333     *     *
1334     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1335     */     */
1336    public void uninstallComponents(JFileChooser fc)    public void uninstallComponents(JFileChooser fc)
1337    {    {
# Line 1303  public class BasicFileChooserUI extends Line 1347  public class BasicFileChooserUI extends
1347    }    }
1348    
1349    /**    /**
1350     * DOCUMENT ME!     * Installs the listeners required by this UI delegate.
1351     *     *
1352     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1353     */     */
1354    protected void installListeners(JFileChooser fc)    protected void installListeners(JFileChooser fc)
1355    {    {
# Line 1325  public class BasicFileChooserUI extends Line 1369  public class BasicFileChooserUI extends
1369    }    }
1370    
1371    /**    /**
1372     * DOCUMENT ME!     * Uninstalls the listeners previously installed by this UI delegate.
1373     *     *
1374     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1375     */     */
1376    protected void uninstallListeners(JFileChooser fc)    protected void uninstallListeners(JFileChooser fc)
1377    {    {
# Line 1336  public class BasicFileChooserUI extends Line 1380  public class BasicFileChooserUI extends
1380    }    }
1381    
1382    /**    /**
1383     * DOCUMENT ME!     * Installs the defaults for this UI delegate.
1384     *     *
1385     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1386     */     */
1387    protected void installDefaults(JFileChooser fc)    protected void installDefaults(JFileChooser fc)
1388    {    {
# Line 1347  public class BasicFileChooserUI extends Line 1391  public class BasicFileChooserUI extends
1391    }    }
1392    
1393    /**    /**
1394     * DOCUMENT ME!     * Uninstalls the defaults previously added by this UI delegate.
1395     *     *
1396     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1397     */     */
1398    protected void uninstallDefaults(JFileChooser fc)    protected void uninstallDefaults(JFileChooser fc)
1399    {    {
# Line 1358  public class BasicFileChooserUI extends Line 1402  public class BasicFileChooserUI extends
1402    }    }
1403    
1404    /**    /**
1405     * DOCUMENT ME!     * Installs the icons for this UI delegate (NOT YET IMPLEMENTED).
1406     *     *
1407     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1408     */     */
1409    protected void installIcons(JFileChooser fc)    protected void installIcons(JFileChooser fc)
1410    {    {
# Line 1368  public class BasicFileChooserUI extends Line 1412  public class BasicFileChooserUI extends
1412    }    }
1413    
1414    /**    /**
1415     * DOCUMENT ME!     * Uninstalls the icons previously added by this UI delegate (NOT YET
1416       * IMPLEMENTED).
1417     *     *
1418     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1419     */     */
1420    protected void uninstallIcons(JFileChooser fc)    protected void uninstallIcons(JFileChooser fc)
1421    {    {
# Line 1378  public class BasicFileChooserUI extends Line 1423  public class BasicFileChooserUI extends
1423    }    }
1424    
1425    /**    /**
1426     * DOCUMENT ME!     * Installs the strings used by this UI delegate.
1427     *     *
1428     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1429     */     */
1430    protected void installStrings(JFileChooser fc)    protected void installStrings(JFileChooser fc)
1431    {    {
# Line 1408  public class BasicFileChooserUI extends Line 1453  public class BasicFileChooserUI extends
1453    }    }
1454    
1455    /**    /**
1456     * DOCUMENT ME!     * Uninstalls the strings previously added by this UI delegate.
1457     *     *
1458     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1459     */     */
1460    protected void uninstallStrings(JFileChooser fc)    protected void uninstallStrings(JFileChooser fc)
1461    {    {
# Line 1436  public class BasicFileChooserUI extends Line 1481  public class BasicFileChooserUI extends
1481    }    }
1482    
1483    /**    /**
1484     * DOCUMENT ME!     * Creates a new directory model.
1485     */     */
1486    protected void createModel()    protected void createModel()
1487    {    {
# Line 1444  public class BasicFileChooserUI extends Line 1489  public class BasicFileChooserUI extends
1489    }    }
1490    
1491    /**    /**
1492     * DOCUMENT ME!     * Returns the directory model.
1493     *     *
1494     * @return DOCUMENT ME!     * @return The directory model.
1495     */     */
1496    public BasicDirectoryModel getModel()    public BasicDirectoryModel getModel()
1497    {    {
# Line 1454  public class BasicFileChooserUI extends Line 1499  public class BasicFileChooserUI extends
1499    }    }
1500    
1501    /**    /**
1502     * DOCUMENT ME!     * Creates a listener to handle changes to the properties of the given
1503       * file chooser component.
1504     *     *
1505     * @param fc     * @param fc  the file chooser component.
1506     *          DOCUMENT ME!     *
1507     * @return DOCUMENT ME!     * @return A new listener.
1508     */     */
1509    public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)    public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
1510    {    {
# Line 1575  public class BasicFileChooserUI extends Line 1621  public class BasicFileChooserUI extends
1621    }    }
1622    
1623    /**    /**
1624     * DOCUMENT ME!     * Returns the current file name.
1625     *     *
1626     * @return DOCUMENT ME!     * @return The current file name.
1627     */     */
1628    public String getFileName()    public String getFileName()
1629    {    {
# Line 1585  public class BasicFileChooserUI extends Line 1631  public class BasicFileChooserUI extends
1631    }    }
1632    
1633    /**    /**
1634     * DOCUMENT ME!     * Returns the current directory name.
1635     *     *
1636     * @return DOCUMENT ME!     * @return The directory name.
1637       *
1638       * @see #setDirectoryName(String)
1639     */     */
1640    public String getDirectoryName()    public String getDirectoryName()
1641    {    {
# Line 1596  public class BasicFileChooserUI extends Line 1644  public class BasicFileChooserUI extends
1644    }    }
1645    
1646    /**    /**
1647     * DOCUMENT ME!     * Sets the file name.
1648     *     *
1649     * @param filename DOCUMENT ME!     * @param filename  the file name.
1650       *
1651       * @see #getFileName()
1652     */     */
1653    public void setFileName(String filename)    public void setFileName(String filename)
1654    {    {
# Line 1606  public class BasicFileChooserUI extends Line 1656  public class BasicFileChooserUI extends
1656    }    }
1657    
1658    /**    /**
1659     * DOCUMENT ME!     * Sets the directory name (NOT IMPLEMENTED).
1660     *     *
1661     * @param dirname DOCUMENT ME!     * @param dirname  the directory name.
1662       *
1663       * @see #getDirectoryName()
1664     */     */
1665    public void setDirectoryName(String dirname)    public void setDirectoryName(String dirname)
1666    {    {
# Line 1616  public class BasicFileChooserUI extends Line 1668  public class BasicFileChooserUI extends
1668    }    }
1669    
1670    /**    /**
1671     * DOCUMENT ME!     * Rescans the current directory.
1672     *     *
1673     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1674     */     */
1675    public void rescanCurrentDirectory(JFileChooser fc)    public void rescanCurrentDirectory(JFileChooser fc)
1676    {    {
# Line 1627  public class BasicFileChooserUI extends Line 1679  public class BasicFileChooserUI extends
1679    }    }
1680    
1681    /**    /**
1682     * DOCUMENT ME!     * NOT YET IMPLEMENTED.
1683     *     *
1684     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1685     * @param f DOCUMENT ME!     * @param f  the file.
1686     */     */
1687    public void ensureFileIsVisible(JFileChooser fc, File f)    public void ensureFileIsVisible(JFileChooser fc, File f)
1688    {    {
# Line 1638  public class BasicFileChooserUI extends Line 1690  public class BasicFileChooserUI extends
1690    }    }
1691    
1692    /**    /**
1693     * DOCUMENT ME!     * Returns the {@link JFileChooser} component that this UI delegate
1694       * represents.
1695     *     *
1696     * @return DOCUMENT ME!     * @return The component represented by this UI delegate.
1697     */     */
1698    public JFileChooser getFileChooser()    public JFileChooser getFileChooser()
1699    {    {
# Line 1648  public class BasicFileChooserUI extends Line 1701  public class BasicFileChooserUI extends
1701    }    }
1702    
1703    /**    /**
1704     * DOCUMENT ME!     * Returns the optional accessory panel.
1705     *     *
1706     * @return DOCUMENT ME!     * @return The optional accessory panel.
1707     */     */
1708    public JPanel getAccessoryPanel()    public JPanel getAccessoryPanel()
1709    {    {
# Line 1658  public class BasicFileChooserUI extends Line 1711  public class BasicFileChooserUI extends
1711    }    }
1712    
1713    /**    /**
1714     * DOCUMENT ME!     * Creates and returns an approve (open or save) button for the dialog.
1715     *     *
1716     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1717     *     *
1718     * @return DOCUMENT ME!     * @return The button.
1719     */     */
1720    public JButton getApproveButton(JFileChooser fc)    public JButton getApproveButton(JFileChooser fc)
1721    {    {
# Line 1673  public class BasicFileChooserUI extends Line 1726  public class BasicFileChooserUI extends
1726    }    }
1727    
1728    /**    /**
1729     * DOCUMENT ME!     * Returns the tool tip text for the approve (open/save) button.  This first
1730       * checks the file chooser to see if a value has been explicitly set - if
1731       * not, a default value appropriate for the type of file chooser is
1732       * returned.
1733     *     *
1734     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1735     *     *
1736     * @return DOCUMENT ME!     * @return The tool tip text.
1737     */     */
1738    public String getApproveButtonToolTipText(JFileChooser fc)    public String getApproveButtonToolTipText(JFileChooser fc)
1739    {    {
# Line 1690  public class BasicFileChooserUI extends Line 1746  public class BasicFileChooserUI extends
1746    }    }
1747    
1748    /**    /**
1749     * DOCUMENT ME!     * Clears the icon cache.
1750     */     */
1751    public void clearIconCache()    public void clearIconCache()
1752    {    {
# Line 1699  public class BasicFileChooserUI extends Line 1755  public class BasicFileChooserUI extends
1755    }    }
1756    
1757    /**    /**
1758     * DOCUMENT ME!     * Creates a new listener to handle selections in the file list.
1759     *     *
1760     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1761     *     *
1762     * @return DOCUMENT ME!     * @return A new instance of {@link SelectionListener}.
1763     */     */
1764    public ListSelectionListener createListSelectionListener(JFileChooser fc)    public ListSelectionListener createListSelectionListener(JFileChooser fc)
1765    {    {
# Line 1711  public class BasicFileChooserUI extends Line 1767  public class BasicFileChooserUI extends
1767    }    }
1768    
1769    /**    /**
1770     * DOCUMENT ME!     * Creates a new listener to handle double-click events.
1771     *     *
1772     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1773     * @param list DOCUMENT ME!     * @param list  the list.
1774     *     *
1775     * @return DOCUMENT ME!     * @return A new instance of {@link DoubleClickListener}.
1776     */     */
1777    protected MouseListener createDoubleClickListener(JFileChooser fc, JList list)    protected MouseListener createDoubleClickListener(JFileChooser fc, JList list)
1778    {    {
# Line 1724  public class BasicFileChooserUI extends Line 1780  public class BasicFileChooserUI extends
1780    }    }
1781    
1782    /**    /**
1783     * DOCUMENT ME!     * Returns <code>true</code> if a directory is selected, and
1784       * <code>false</code> otherwise.
1785     *     *
1786     * @return DOCUMENT ME!     * @return A boolean.
1787     */     */
1788    protected boolean isDirectorySelected()    protected boolean isDirectorySelected()
1789    {    {
# Line 1734  public class BasicFileChooserUI extends Line 1791  public class BasicFileChooserUI extends
1791    }    }
1792    
1793    /**    /**
1794     * DOCUMENT ME!     * Sets the flag that indicates whether the current directory is selected.
1795     *     *
1796     * @param selected DOCUMENT ME!     * @param selected  the new flag value.
1797     */     */
1798    protected void setDirectorySelected(boolean selected)    protected void setDirectorySelected(boolean selected)
1799    {    {
# Line 1744  public class BasicFileChooserUI extends Line 1801  public class BasicFileChooserUI extends
1801    }    }
1802    
1803    /**    /**
1804     * DOCUMENT ME!     * Returns the current directory.
1805     *     *
1806     * @return DOCUMENT ME!     * @return The current directory.
1807     */     */
1808    protected File getDirectory()    protected File getDirectory()
1809    {    {
# Line 1754  public class BasicFileChooserUI extends Line 1811  public class BasicFileChooserUI extends
1811    }    }
1812    
1813    /**    /**
1814     * DOCUMENT ME!     * Sets the current directory.
1815     *     *
1816     * @param f DOCUMENT ME!     * @param f  the directory.
1817     */     */
1818    protected void setDirectory(File f)    protected void setDirectory(File f)
1819    {    {
# Line 1764  public class BasicFileChooserUI extends Line 1821  public class BasicFileChooserUI extends
1821    }    }
1822    
1823    /**    /**
1824     * DOCUMENT ME!     * Returns the "accept all" file filter.
1825     *     *
1826     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1827     *     *
1828     * @return DOCUMENT ME!     * @return The "accept all" file filter.
1829     */     */
1830    public FileFilter getAcceptAllFileFilter(JFileChooser fc)    public FileFilter getAcceptAllFileFilter(JFileChooser fc)
1831    {    {
# Line 1776  public class BasicFileChooserUI extends Line 1833  public class BasicFileChooserUI extends
1833    }    }
1834    
1835    /**    /**
1836     * DOCUMENT ME!     * Returns the file view for the file chooser.  This returns either the
1837       * file view that has been explicitly set for the {@link JFileChooser}, or
1838       * a default file view.
1839     *     *
1840     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1841     *     *
1842     * @return DOCUMENT ME!     * @return The file view.
1843       *
1844       * @see JFileChooser#getFileView()
1845     */     */
1846    public FileView getFileView(JFileChooser fc)    public FileView getFileView(JFileChooser fc)
1847    {    {
     if (fc.getFileView() != null)  
       return fc.getFileView();  
1848      return fv;      return fv;
1849    }    }
1850    
1851    /**    /**
1852     * DOCUMENT ME!     * Returns the dialog title.
1853     *     *
1854     * @param fc DOCUMENT ME!     * @param fc  the file chooser (<code>null</code> not permitted).
1855     *     *
1856     * @return DOCUMENT ME!     * @return The dialog title.
1857       *
1858       * @see JFileChooser#getDialogTitle()
1859     */     */
1860    public String getDialogTitle(JFileChooser fc)    public String getDialogTitle(JFileChooser fc)
1861    {    {
# Line 1819  public class BasicFileChooserUI extends Line 1880  public class BasicFileChooserUI extends
1880    }    }
1881    
1882    /**    /**
1883     * DOCUMENT ME!     * Returns the approve button mnemonic.
1884     *     *
1885     * @param fc DOCUMENT ME!     * @param fc  the file chooser (<code>null</code> not permitted).
1886     *     *
1887     * @return DOCUMENT ME!     * @return The approve button mnemonic.
1888       *
1889       * @see JFileChooser#getApproveButtonMnemonic()
1890     */     */
1891    public int getApproveButtonMnemonic(JFileChooser fc)    public int getApproveButtonMnemonic(JFileChooser fc)
1892    {    {
# Line 1836  public class BasicFileChooserUI extends Line 1899  public class BasicFileChooserUI extends
1899    }    }
1900    
1901    /**    /**
1902     * DOCUMENT ME!     * Returns the approve button text.
1903     *     *
1904     * @param fc DOCUMENT ME!     * @param fc  the file chooser (<code>null</code> not permitted).
1905     *     *
1906     * @return DOCUMENT ME!     * @return The approve button text.
1907       *
1908       * @see JFileChooser#getApproveButtonText()
1909     */     */
1910    public String getApproveButtonText(JFileChooser fc)    public String getApproveButtonText(JFileChooser fc)
1911    {    {
# Line 1853  public class BasicFileChooserUI extends Line 1918  public class BasicFileChooserUI extends
1918    }    }
1919    
1920    /**    /**
1921     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "new folder"
1922       * button.
1923     *     *
1924     * @return DOCUMENT ME!     * @return A new instance of {@link GoHomeAction}.
1925     */     */
1926    public Action getNewFolderAction()    public Action getNewFolderAction()
1927    {    {
# Line 1863  public class BasicFileChooserUI extends Line 1929  public class BasicFileChooserUI extends
1929    }    }
1930    
1931    /**    /**
1932     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "home folder"
1933       * button.
1934     *     *
1935     * @return DOCUMENT ME!     * @return A new instance of {@link GoHomeAction}.
1936     */     */
1937    public Action getGoHomeAction()    public Action getGoHomeAction()
1938    {    {
# Line 1873  public class BasicFileChooserUI extends Line 1940  public class BasicFileChooserUI extends
1940    }    }
1941    
1942    /**    /**
1943     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "up folder"
1944       * button.
1945     *     *
1946     * @return DOCUMENT ME!     * @return A new instance of {@link ChangeToParentDirectoryAction}.
1947     */     */
1948    public Action getChangeToParentDirectoryAction()    public Action getChangeToParentDirectoryAction()
1949    {    {
# Line 1883  public class BasicFileChooserUI extends Line 1951  public class BasicFileChooserUI extends
1951    }    }
1952    
1953    /**    /**
1954     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "approve"
1955       * button.
1956     *     *
1957     * @return DOCUMENT ME!     * @return A new instance of {@link ApproveSelectionAction}.
1958     */     */
1959    public Action getApproveSelectionAction()    public Action getApproveSelectionAction()
1960    {    {
# Line 1893  public class BasicFileChooserUI extends Line 1962  public class BasicFileChooserUI extends
1962    }    }
1963    
1964    /**    /**
1965     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "cancel"
1966       * button.
1967     *     *
1968     * @return DOCUMENT ME!     * @return A new instance of {@link CancelSelectionAction}.
1969     */     */
1970    public Action getCancelSelectionAction()    public Action getCancelSelectionAction()
1971    {    {
# Line 1903  public class BasicFileChooserUI extends Line 1973  public class BasicFileChooserUI extends
1973    }    }
1974    
1975    /**    /**
1976     * DOCUMENT ME!     * Creates and returns a new instance of {@link UpdateAction}.
1977     *     *
1978     * @return DOCUMENT ME!     * @return An action.
1979     */     */
1980    public Action getUpdateAction()    public Action getUpdateAction()
1981    {    {

Legend:
Removed from v.1.2.2.5  
changed lines
  Added in v.1.2.2.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26