/[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.12 by langel, Thu Sep 15 17:54:39 2005 UTC revision 1.13 by trebligd, Tue Oct 4 21:02:10 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      }      }
110            
111      /**      /**
112       * DOCUMENT ME!       * Returns <code>true</code> always, as all files are accepted by this
113         * filter.
114       *       *
115       * @param f DOCUMENT ME!       * @param f  the file.
116       *       *
117       * @return DOCUMENT ME!       * @return Always <code>true</code>.
118       */       */
119      public boolean accept(File f)      public boolean accept(File f)
120      {      {
# Line 118  public class BasicFileChooserUI extends Line 122  public class BasicFileChooserUI extends
122      }      }
123    
124      /**      /**
125       * DOCUMENT ME!       * Returns a description for this filter.
126       *       *
127       * @return DOCUMENT ME!       * @return A description for the file filter.
128       */       */
129      public String getDescription()      public String getDescription()
130      {      {
# Line 129  public class BasicFileChooserUI extends Line 133  public class BasicFileChooserUI extends
133    }    }
134    
135    /**    /**
136     * DOCUMENT ME!     * Handles a user action to approve the dialog selection.
137       *
138       * @see BasicFileChooserUI#getApproveSelectionAction()
139     */     */
140    protected class ApproveSelectionAction extends AbstractAction    protected class ApproveSelectionAction extends AbstractAction
141    {    {
# Line 141  public class BasicFileChooserUI extends Line 147  public class BasicFileChooserUI extends
147      }      }
148    
149      /**      /**
150       * DOCUMENT ME!       * Sets the current selection and closes the dialog.
151       *       *
152       * @param e       * @param e  the action event.
      *          DOCUMENT ME!  
153       */       */
154      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
155      {      {
# Line 167  public class BasicFileChooserUI extends Line 172  public class BasicFileChooserUI extends
172    }    }
173    
174    /**    /**
175     * DOCUMENT ME!     * Provides presentation information about files and directories.
176     */     */
177    protected class BasicFileView extends FileView    protected class BasicFileView extends FileView
178    {    {
179      /** DOCUMENT ME! */      /** Storage for cached icons. */
180      protected Hashtable iconCache = new Hashtable();      protected Hashtable iconCache = new Hashtable();
181    
182        /**
183         * Creates a new instance.
184         */
185      public BasicFileView()      public BasicFileView()
186      {      {
187      }      }
188    
189      /**      /**
190       * DOCUMENT ME!       * Adds an icon to the cache, associating it with the given file/directory.
191       *       *
192       * @param f DOCUMENT ME!       * @param f  the file/directory.
193       * @param i DOCUMENT ME!       * @param i  the icon.
194       */       */
195      public void cacheIcon(File f, Icon i)      public void cacheIcon(File f, Icon i)
196      {      {
# Line 190  public class BasicFileChooserUI extends Line 198  public class BasicFileChooserUI extends
198      }      }
199    
200      /**      /**
201       * DOCUMENT ME!       * Clears the icon cache.
202       */       */
203      public void clearIconCache()      public void clearIconCache()
204      {      {
# Line 198  public class BasicFileChooserUI extends Line 206  public class BasicFileChooserUI extends
206      }      }
207    
208      /**      /**
209       * DOCUMENT ME!       * Retrieves the icon associated with the specified file/directory, if
210         * there is one.
211       *       *
212       * @param f DOCUMENT ME!       * @param f  the file/directory.
213       *       *
214       * @return DOCUMENT ME!       * @return The cached icon (or <code>null</code>).
215       */       */
216      public Icon getCachedIcon(File f)      public Icon getCachedIcon(File f)
217      {      {
# Line 210  public class BasicFileChooserUI extends Line 219  public class BasicFileChooserUI extends
219      }      }
220    
221      /**      /**
222       * DOCUMENT ME!       * Returns a description of the given file/directory.  In this
223         * implementation, the description is the same as the name returned by
224         * {@link #getName(File)}.
225       *       *
226       * @param f DOCUMENT ME!       * @param f  the file/directory.
227       *       *
228       * @return DOCUMENT ME!       * @return A description of the given file/directory.
229       */       */
230      public String getDescription(File f)      public String getDescription(File f)
231      {      {
# Line 222  public class BasicFileChooserUI extends Line 233  public class BasicFileChooserUI extends
233      }      }
234    
235      /**      /**
236       * DOCUMENT ME!       * Returns an icon appropriate for the given file or directory.
237       *       *
238       * @param f DOCUMENT ME!       * @param f  the file/directory.
239       *       *
240       * @return DOCUMENT ME!       * @return An icon.
241       */       */
242      public Icon getIcon(File f)      public Icon getIcon(File f)
243      {      {
# Line 242  public class BasicFileChooserUI extends Line 253  public class BasicFileChooserUI extends
253      }      }
254    
255      /**      /**
256       * DOCUMENT ME!       * Returns the name for the given file/directory.
257       *       *
258       * @param f DOCUMENT ME!       * @param f  the file/directory.
259       *       *
260       * @return DOCUMENT ME!       * @return The name of the file/directory.
261       */       */
262      public String getName(File f)      public String getName(File f)
263      {      {
# Line 254  public class BasicFileChooserUI extends Line 265  public class BasicFileChooserUI extends
265      }      }
266    
267      /**      /**
268       * DOCUMENT ME!       * Returns a localised description for the type of file/directory.
269       *       *
270       * @param f DOCUMENT ME!       * @param f  the file/directory.
271       *       *
272       * @return DOCUMENT ME!       * @return A type description for the given file/directory.
273       */       */
274      public String getTypeDescription(File f)      public String getTypeDescription(File f)
275      {      {
# Line 269  public class BasicFileChooserUI extends Line 280  public class BasicFileChooserUI extends
280      }      }
281    
282      /**      /**
283       * DOCUMENT ME!       * Returns {@link Boolean#TRUE} if the given file/directory is hidden,
284         * and {@link Boolean#FALSE} otherwise.
285       *       *
286       * @param f DOCUMENT ME!       * @param f  the file/directory.
287       *       *
288       * @return DOCUMENT ME!       * @return {@link Boolean#TRUE} or {@link Boolean#FALSE}.
289       */       */
290      public Boolean isHidden(File f)      public Boolean isHidden(File f)
291      {      {
# Line 282  public class BasicFileChooserUI extends Line 294  public class BasicFileChooserUI extends
294    }    }
295    
296    /**    /**
297     * DOCUMENT ME!     * Handles an action to cancel the file chooser.
298       *
299       * @see BasicFileChooserUI#getCancelSelectionAction()
300     */     */
301    protected class CancelSelectionAction extends AbstractAction    protected class CancelSelectionAction extends AbstractAction
302    {    {
303      /**      /**
304       * Creates a new CancelSelectionAction object.       * Creates a new <code>CancelSelectionAction</code> object.
305       */       */
306      protected CancelSelectionAction()      protected CancelSelectionAction()
307      {      {
308      }      }
309    
310      /**      /**
311       * DOCUMENT ME!       * Cancels the selection and closes the dialog.
312       *       *
313       * @param e DOCUMENT ME!       * @param e  the action event (ignored).
314       */       */
315      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
316      {      {
# Line 306  public class BasicFileChooserUI extends Line 320  public class BasicFileChooserUI extends
320    }    }
321    
322    /**    /**
323     * DOCUMENT ME!     * An action to handle changes to the parent directory (for example, via
324       * a click on the "up folder" button).
325       *
326       * @see BasicFileChooserUI#getChangeToParentDirectoryAction()
327     */     */
328    protected class ChangeToParentDirectoryAction extends AbstractAction    protected class ChangeToParentDirectoryAction extends AbstractAction
329    {    {
330      /**      /**
331       * Creates a new ChangeToParentDirectoryAction object.       * Creates a new <code>ChangeToParentDirectoryAction</code> object.
332       */       */
333      protected ChangeToParentDirectoryAction()      protected ChangeToParentDirectoryAction()
334      {      {
335      }      }
336    
337      /**      /**
338       * DOCUMENT ME!       * Handles the action event.
339       *       *
340       * @param e DOCUMENT ME!       * @param e  the action event.
341       */       */
342      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
343      {      {
# Line 331  public class BasicFileChooserUI extends Line 348  public class BasicFileChooserUI extends
348    }    }
349    
350    /**    /**
351     * DOCUMENT ME!     * A mouse listener that handles double-click events.
352       *
353       * @see BasicFileChooserUI#createDoubleClickListener(JFileChooser, JList)
354     */     */
355    protected class DoubleClickListener extends MouseAdapter    protected class DoubleClickListener extends MouseAdapter
356    {    {
357      /** DOCUMENT ME! */      /** A timer. */
358      private Timer timer = null;      private Timer timer = null;
359    
360      /** DOCUMENT ME! */      /** DOCUMENT ME! */
# Line 359  public class BasicFileChooserUI extends Line 378  public class BasicFileChooserUI extends
378      }      }
379    
380      /**      /**
381       * DOCUMENT ME!       * Handles a mouse click event.
382       *       *
383       * @param e       * @param e  the event.
      *          DOCUMENT ME!  
384       */       */
385      public void mouseClicked(MouseEvent e)      public void mouseClicked(MouseEvent e)
386      {      {
# Line 408  public class BasicFileChooserUI extends Line 426  public class BasicFileChooserUI extends
426      }      }
427    
428      /**      /**
429       * DOCUMENT ME!       * Handles a mouse entered event (NOT IMPLEMENTED).
430       *       *
431       * @param e       * @param e  the mouse event.
      *          DOCUMENT ME!  
432       */       */
433      public void mouseEntered(MouseEvent e)      public void mouseEntered(MouseEvent e)
434      {      {
# Line 420  public class BasicFileChooserUI extends Line 437  public class BasicFileChooserUI extends
437    }    }
438    
439    /**    /**
440     * DOCUMENT ME!     * An action that changes the file chooser to display the user's home
441       * directory.
442       *
443       * @see BasicFileChooserUI#getGoHomeAction()
444     */     */
445    protected class GoHomeAction extends AbstractAction    protected class GoHomeAction extends AbstractAction
446    {    {
447      /**      /**
448       * Creates a new GoHomeAction object.       * Creates a new <code>GoHomeAction</code> object.
449       */       */
450      protected GoHomeAction()      protected GoHomeAction()
451      {      {
452      }      }
453    
454      /**      /**
455       * DOCUMENT ME!       * Sets the directory to the user's home directory, and repaints the
456         * file chooser component.
457       *       *
458       * @param e DOCUMENT ME!       * @param e  the action event (ignored).
459       */       */
460      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
461      {      {
# Line 446  public class BasicFileChooserUI extends Line 467  public class BasicFileChooserUI extends
467    }    }
468    
469    /**    /**
470     * DOCUMENT ME!     * An action that handles the creation of a new folder/directory.
471       *
472       * @see BasicFileChooserUI#getNewFolderAction()
473     */     */
474    protected class NewFolderAction extends AbstractAction    protected class NewFolderAction extends AbstractAction
475    {    {
476      /**      /**
477       * Creates a new NewFolderAction object.       * Creates a new <code>NewFolderAction</code> object.
478       */       */
479      protected NewFolderAction()      protected NewFolderAction()
480      {      {
481      }      }
482    
483      /**      /**
484       * DOCUMENT ME!       * Handles the event by creating a new folder.
485       *       *
486       * @param e DOCUMENT ME!       * @param e  the action event (ignored).
487       */       */
488      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
489      {      {
# Line 479  public class BasicFileChooserUI extends Line 502  public class BasicFileChooserUI extends
502    }    }
503    
504    /**    /**
505     * DOCUMENT ME!     * A listener for selection events in the file list.
506       *
507       * @see BasicFileChooserUI#createListSelectionListener(JFileChooser)
508     */     */
509    protected class SelectionListener implements ListSelectionListener    protected class SelectionListener implements ListSelectionListener
510    {    {
511      /**      /**
512       * Creates a new SelectionListener object.       * Creates a new <code>SelectionListener</code> object.
513       */       */
514      protected SelectionListener()      protected SelectionListener()
515      {      {
# Line 510  public class BasicFileChooserUI extends Line 535  public class BasicFileChooserUI extends
535    
536    /**    /**
537     * DOCUMENT ME!     * DOCUMENT ME!
538       *
539       * @see BasicFileChooserUI#getUpdateAction()
540     */     */
541    protected class UpdateAction extends AbstractAction    protected class UpdateAction extends AbstractAction
542    {    {
# Line 521  public class BasicFileChooserUI extends Line 548  public class BasicFileChooserUI extends
548      }      }
549    
550      /**      /**
551       * DOCUMENT ME!       * NOT YET IMPLEMENTED.
552       *       *
553       * @param e DOCUMENT ME!       * @param e  the action event.
554       */       */
555      public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
556      {      {
557          // FIXME: implement this
558      }      }
559    }    }
560    
561    /** DOCUMENT ME! */    /** The localised mnemonic for the cancel button. */
562    protected int cancelButtonMnemonic;    protected int cancelButtonMnemonic;
563    
564    /** DOCUMENT ME! */    /** The localised text for the cancel button. */
565    protected String cancelButtonText;    protected String cancelButtonText;
566    
567    /** DOCUMENT ME! */    /** The localised tool tip text for the cancel button. */
568    protected String cancelButtonToolTipText;    protected String cancelButtonToolTipText;
569    
570    /** DOCUMENT ME! */    /** An icon representing a computer. */
571    protected Icon computerIcon = new Icon()    protected Icon computerIcon = new Icon()
572      {      {
573        public int getIconHeight()        public int getIconHeight()
# Line 554  public class BasicFileChooserUI extends Line 582  public class BasicFileChooserUI extends
582    
583        public void paintIcon(Component c, Graphics g, int x, int y)        public void paintIcon(Component c, Graphics g, int x, int y)
584        {        {
585            // FIXME: is this not implemented, or is the icon intentionally blank?
586        }        }
587      };      };
588    
589    /** DOCUMENT ME! */    /** An icon for the "details view" button. */
590    protected Icon detailsViewIcon = new Icon()    protected Icon detailsViewIcon = new Icon()
591      {      {
592        public int getIconHeight()        public int getIconHeight()
# Line 586  public class BasicFileChooserUI extends Line 615  public class BasicFileChooserUI extends
615        }        }
616      };      };
617    
618    /** DOCUMENT ME! */    /** An icon representing a directory. */
619    protected Icon directoryIcon = new Icon()    protected Icon directoryIcon = new Icon()
620      {      {
621        public int getIconHeight()        public int getIconHeight()
# Line 625  public class BasicFileChooserUI extends Line 654  public class BasicFileChooserUI extends
654        }        }
655      };      };
656    
657    /** DOCUMENT ME! */    /** The localised Mnemonic for the open button. */
658    protected int directoryOpenButtonMnemonic;    protected int directoryOpenButtonMnemonic;
659    
660    /** DOCUMENT ME! */    /** The localised text for the open button. */
661    protected String directoryOpenButtonText;    protected String directoryOpenButtonText;
662    
663    /** DOCUMENT ME! */    /** The localised tool tip text for the open button. */
664    protected String directoryOpenButtonToolTipText;    protected String directoryOpenButtonToolTipText;
665    
666    /** DOCUMENT ME! */    /** An icon representing a file. */
667    protected Icon fileIcon = new Icon()    protected Icon fileIcon = new Icon()
668      {      {
669        public int getIconHeight()        public int getIconHeight()
# Line 674  public class BasicFileChooserUI extends Line 703  public class BasicFileChooserUI extends
703        }        }
704      };      };
705    
706    /** DOCUMENT ME! */    /** An icon representing a floppy drive. */
707    protected Icon floppyDriveIcon = new Icon()    protected Icon floppyDriveIcon = new Icon()
708      {      {
709        public int getIconHeight()        public int getIconHeight()
# Line 689  public class BasicFileChooserUI extends Line 718  public class BasicFileChooserUI extends
718    
719        public void paintIcon(Component c, Graphics g, int x, int y)        public void paintIcon(Component c, Graphics g, int x, int y)
720        {        {
721            // FIXME: is this not implemented, or is the icon intentionally blank?
722        }        }
723      };      };
724    
725    /** DOCUMENT ME! */    /** An icon representing a hard drive. */
726    protected Icon hardDriveIcon = new Icon()    protected Icon hardDriveIcon = new Icon()
727      {      {
728        public int getIconHeight()        public int getIconHeight()
# Line 707  public class BasicFileChooserUI extends Line 737  public class BasicFileChooserUI extends
737    
738        public void paintIcon(Component c, Graphics g, int x, int y)        public void paintIcon(Component c, Graphics g, int x, int y)
739        {        {
740            // FIXME: is this not implemented, or is the icon intentionally blank?
741        }        }
742      };      };
743    
744    /** DOCUMENT ME! */    /** The localised mnemonic for the "help" button. */
745    protected int helpButtonMnemonic;    protected int helpButtonMnemonic;
746    
747    /** DOCUMENT ME! */    /** The localised text for the "help" button. */
748    protected String helpButtonText;    protected String helpButtonText;
749    
750    /** DOCUMENT ME! */    /** The localised tool tip text for the help button. */
751    protected String helpButtonToolTipText;    protected String helpButtonToolTipText;
752    
753    /** DOCUMENT ME! */    /** An icon representing the user's home folder. */
754    protected Icon homeFolderIcon = new Icon()    protected Icon homeFolderIcon = new Icon()
755      {      {
756        public int getIconHeight()        public int getIconHeight()
# Line 759  public class BasicFileChooserUI extends Line 790  public class BasicFileChooserUI extends
790        }        }
791      };      };
792    
793    /** DOCUMENT ME! */    /** An icon for the "list view" button. */
794    protected Icon listViewIcon = new Icon()    protected Icon listViewIcon = new Icon()
795      {      {
796        public int getIconHeight()        public int getIconHeight()
# Line 801  public class BasicFileChooserUI extends Line 832  public class BasicFileChooserUI extends
832        }        }
833      };      };
834    
835    /** DOCUMENT ME! */    /** An icon for the "new folder" button. */
836    protected Icon newFolderIcon = directoryIcon;    protected Icon newFolderIcon = directoryIcon;
837    
838    /** DOCUMENT ME! */    /** The localised mnemonic for the "open" button. */
839    protected int openButtonMnemonic;    protected int openButtonMnemonic;
840    
841    /** DOCUMENT ME! */    /** The localised text for the "open" button. */
842    protected String openButtonText;    protected String openButtonText;
843    
844    /** DOCUMENT ME! */    /** The localised tool tip text for the "open" button. */
845    protected String openButtonToolTipText;    protected String openButtonToolTipText;
846    
847    /** DOCUMENT ME! */    /** The localised mnemonic for the "save" button. */
848    protected int saveButtonMnemonic;    protected int saveButtonMnemonic;
849    
850    /** DOCUMENT ME! */    /** The localised text for the "save" button. */
851    protected String saveButtonText;    protected String saveButtonText;
852    
853    /** DOCUMENT ME! */    /** The localised tool tip text for the save button. */
854    protected String saveButtonToolTipText;    protected String saveButtonToolTipText;
855    
856    /** DOCUMENT ME! */    /** The localised mnemonic for the "update" button. */
857    protected int updateButtonMnemonic;    protected int updateButtonMnemonic;
858    
859    /** DOCUMENT ME! */    /** The localised text for the "update" button. */
860    protected String updateButtonText;    protected String updateButtonText;
861    
862    /** DOCUMENT ME! */    /** The localised tool tip text for the "update" button. */
863    protected String updateButtonToolTipText;    protected String updateButtonToolTipText;
864    
865    /** DOCUMENT ME! */    /** An icon for the "up folder" button. */
866    protected Icon upFolderIcon = new Icon()    protected Icon upFolderIcon = new Icon()
867      {      {
868        public int getIconHeight()        public int getIconHeight()
# Line 882  public class BasicFileChooserUI extends Line 913  public class BasicFileChooserUI extends
913    
914    // -- begin private, but package local since used in inner classes --    // -- begin private, but package local since used in inner classes --
915    
916      /** The file chooser component represented by this UI delegate. */
917    JFileChooser filechooser;    JFileChooser filechooser;
918    
919    /** DOCUMENT ME! */    /** The file list. */
920    JList filelist;    JList filelist;
921    
922    /** DOCUMENT ME! */    /** The combo box used to display/select file filters. */
923    JComboBox filters;    JComboBox filters;
924    
925    /** DOCUMENT ME! */    /** The model for the directory list. */
926    BasicDirectoryModel model;    BasicDirectoryModel model;
927    
928    /** DOCUMENT ME! */    /** The file filter for all files. */
929    FileFilter acceptAll = new AcceptAllFileFilter();    FileFilter acceptAll = new AcceptAllFileFilter();
930    
931    /** DOCUMENT ME! */    /** The default file view. */
932    FileView fv = new BasicFileView();    FileView fv = new BasicFileView();
933    
934    /** DOCUMENT ME! */    /** The icon size. */
935    static final int ICON_SIZE = 24;    static final int ICON_SIZE = 24;
936    
937    /** DOCUMENT ME! */    /** A combo box for display/selection of parent directories. */
938    JComboBox parents;    JComboBox parents;
939    
940    /** DOCUMENT ME! */    /** The current file name. */
941    String filename;    String filename;
942    
943    /** DOCUMENT ME! */    /** The accept (open/save) button. */
944    JButton accept;    JButton accept;
945    
946    /** DOCUMENT ME! */    /** The cancel button. */
947    JButton cancel;    JButton cancel;
948    
949    /** DOCUMENT ME! */    /** The button to move up to the parent directory. */
950    JButton upFolderButton;    JButton upFolderButton;
951    
952    /** DOCUMENT ME! */    /** The button to create a new directory. */
953    JButton newFolderButton;    JButton newFolderButton;
954    
955    /** DOCUMENT ME! */    /** The button to move to the user's home directory. */
956    JButton homeFolderButton;    JButton homeFolderButton;
957    
958    /** DOCUMENT ME! */    /** An optional accessory panel. */
959    JPanel accessoryPanel;    JPanel accessoryPanel;
960    
961    /** DOCUMENT ME! */    /** A property change listener. */
962    PropertyChangeListener propertyChangeListener;    PropertyChangeListener propertyChangeListener;
963    
964    /** DOCUMENT ME! */    /** The text describing the filter for "all files". */
965    String acceptAllFileFilterText;    String acceptAllFileFilterText;
966    
967    /** DOCUMENT ME! */    /** The text describing a directory type. */
968    String dirDescText;    String dirDescText;
969    
970    /** DOCUMENT ME! */    /** The text describing a file type. */
971    String fileDescText;    String fileDescText;
972    
973    /** DOCUMENT ME! */    /** Is a directory selected? */
974    boolean dirSelected = false;    boolean dirSelected = false;
975    
976    /** DOCUMENT ME! */    /** The current directory. */
977    File currDir = null;    File currDir = null;
978    
979      // FIXME: describe what is contained in the bottom panel
980      /** The bottom panel. */
981    JPanel bottomPanel;    JPanel bottomPanel;
982        
983    /** DOCUMENT ME! */    /** The close panel. */
984    JPanel closePanel;    JPanel closePanel;
985    
986    /** Text box that displays file name */    /** Text box that displays file name */
# Line 997  public class BasicFileChooserUI extends Line 1031  public class BasicFileChooserUI extends
1031      }      }
1032    }    }
1033    
1034      /**
1035       * Closes the dialog.
1036       */
1037    void closeDialog()    void closeDialog()
1038    {    {
1039      Window owner = SwingUtilities.windowForComponent(filechooser);      Window owner = SwingUtilities.windowForComponent(filechooser);
# Line 1005  public class BasicFileChooserUI extends Line 1042  public class BasicFileChooserUI extends
1042    }    }
1043    
1044    /**    /**
1045     * Creates a new BasicFileChooserUI object.     * Creates a new <code>BasicFileChooserUI</code> object.
1046     *     *
1047     * @param b DOCUMENT ME!     * @param b  the file chooser component.
1048     */     */
1049    public BasicFileChooserUI(JFileChooser b)    public BasicFileChooserUI(JFileChooser b)
1050    {    {
# Line 1015  public class BasicFileChooserUI extends Line 1052  public class BasicFileChooserUI extends
1052    }    }
1053    
1054    /**    /**
1055     * DOCUMENT ME!     * Returns a UI delegate for the given component.
1056     *     *
1057     * @param c DOCUMENT ME!     * @param c  the component (should be a {@link JFileChooser}).
1058     *     *
1059     * @return DOCUMENT ME!     * @return A new UI delegate.
1060     */     */
1061    public static ComponentUI createUI(JComponent c)    public static ComponentUI createUI(JComponent c)
1062    {    {
# Line 1027  public class BasicFileChooserUI extends Line 1064  public class BasicFileChooserUI extends
1064    }    }
1065    
1066    /**    /**
1067     * DOCUMENT ME!     * Installs the UI for the specified component.
1068     *     *
1069     * @param c     * @param c  the component (should be a {@link JFileChooser}).
    *          DOCUMENT ME!  
1070     */     */
1071    public void installUI(JComponent c)    public void installUI(JComponent c)
1072    {    {
# Line 1051  public class BasicFileChooserUI extends Line 1087  public class BasicFileChooserUI extends
1087    }    }
1088    
1089    /**    /**
1090     * DOCUMENT ME!     * Uninstalls this UI from the given component.
1091     *     *
1092     * @param c     * @param c  the component (should be a {@link JFileChooser}).
    *          DOCUMENT ME!  
1093     */     */
1094    public void uninstallUI(JComponent c)    public void uninstallUI(JComponent c)
1095    {    {
# Line 1161  public class BasicFileChooserUI extends Line 1196  public class BasicFileChooserUI extends
1196    }    }
1197    
1198    /**    /**
1199     * DOCUMENT ME!     * Creates and install the subcomponents for the file chooser.
1200     *     *
1201     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1202     */     */
1203    public void installComponents(JFileChooser fc)    public void installComponents(JFileChooser fc)
1204    {    {
# Line 1285  public class BasicFileChooserUI extends Line 1320  public class BasicFileChooserUI extends
1320    }    }
1321    
1322    /**    /**
1323     * DOCUMENT ME!     * Uninstalls the components from the file chooser.
1324     *     *
1325     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1326     */     */
1327    public void uninstallComponents(JFileChooser fc)    public void uninstallComponents(JFileChooser fc)
1328    {    {
# Line 1303  public class BasicFileChooserUI extends Line 1338  public class BasicFileChooserUI extends
1338    }    }
1339    
1340    /**    /**
1341     * DOCUMENT ME!     * Installs the listeners required by this UI delegate.
1342     *     *
1343     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1344     */     */
1345    protected void installListeners(JFileChooser fc)    protected void installListeners(JFileChooser fc)
1346    {    {
# Line 1325  public class BasicFileChooserUI extends Line 1360  public class BasicFileChooserUI extends
1360    }    }
1361    
1362    /**    /**
1363     * DOCUMENT ME!     * Uninstalls the listeners previously installed by this UI delegate.
1364     *     *
1365     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1366     */     */
1367    protected void uninstallListeners(JFileChooser fc)    protected void uninstallListeners(JFileChooser fc)
1368    {    {
# Line 1336  public class BasicFileChooserUI extends Line 1371  public class BasicFileChooserUI extends
1371    }    }
1372    
1373    /**    /**
1374     * DOCUMENT ME!     * Installs the defaults for this UI delegate.
1375     *     *
1376     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1377     */     */
1378    protected void installDefaults(JFileChooser fc)    protected void installDefaults(JFileChooser fc)
1379    {    {
# Line 1347  public class BasicFileChooserUI extends Line 1382  public class BasicFileChooserUI extends
1382    }    }
1383    
1384    /**    /**
1385     * DOCUMENT ME!     * Uninstalls the defaults previously added by this UI delegate.
1386     *     *
1387     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1388     */     */
1389    protected void uninstallDefaults(JFileChooser fc)    protected void uninstallDefaults(JFileChooser fc)
1390    {    {
# Line 1358  public class BasicFileChooserUI extends Line 1393  public class BasicFileChooserUI extends
1393    }    }
1394    
1395    /**    /**
1396     * DOCUMENT ME!     * Installs the icons for this UI delegate (NOT YET IMPLEMENTED).
1397     *     *
1398     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1399     */     */
1400    protected void installIcons(JFileChooser fc)    protected void installIcons(JFileChooser fc)
1401    {    {
# Line 1368  public class BasicFileChooserUI extends Line 1403  public class BasicFileChooserUI extends
1403    }    }
1404    
1405    /**    /**
1406     * DOCUMENT ME!     * Uninstalls the icons previously added by this UI delegate (NOT YET
1407       * IMPLEMENTED).
1408     *     *
1409     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1410     */     */
1411    protected void uninstallIcons(JFileChooser fc)    protected void uninstallIcons(JFileChooser fc)
1412    {    {
# Line 1378  public class BasicFileChooserUI extends Line 1414  public class BasicFileChooserUI extends
1414    }    }
1415    
1416    /**    /**
1417     * DOCUMENT ME!     * Installs the strings used by this UI delegate.
1418     *     *
1419     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1420     */     */
1421    protected void installStrings(JFileChooser fc)    protected void installStrings(JFileChooser fc)
1422    {    {
# Line 1408  public class BasicFileChooserUI extends Line 1444  public class BasicFileChooserUI extends
1444    }    }
1445    
1446    /**    /**
1447     * DOCUMENT ME!     * Uninstalls the strings previously added by this UI delegate.
1448     *     *
1449     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1450     */     */
1451    protected void uninstallStrings(JFileChooser fc)    protected void uninstallStrings(JFileChooser fc)
1452    {    {
# Line 1436  public class BasicFileChooserUI extends Line 1472  public class BasicFileChooserUI extends
1472    }    }
1473    
1474    /**    /**
1475     * DOCUMENT ME!     * Creates a new directory model.
1476     */     */
1477    protected void createModel()    protected void createModel()
1478    {    {
# Line 1444  public class BasicFileChooserUI extends Line 1480  public class BasicFileChooserUI extends
1480    }    }
1481    
1482    /**    /**
1483     * DOCUMENT ME!     * Returns the directory model.
1484     *     *
1485     * @return DOCUMENT ME!     * @return The directory model.
1486     */     */
1487    public BasicDirectoryModel getModel()    public BasicDirectoryModel getModel()
1488    {    {
# Line 1454  public class BasicFileChooserUI extends Line 1490  public class BasicFileChooserUI extends
1490    }    }
1491    
1492    /**    /**
1493     * DOCUMENT ME!     * Creates a listener to handle changes to the properties of the given
1494       * file chooser component.
1495     *     *
1496     * @param fc     * @param fc  the file chooser component.
1497     *          DOCUMENT ME!     *
1498     * @return DOCUMENT ME!     * @return A new listener.
1499     */     */
1500    public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)    public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
1501    {    {
# Line 1575  public class BasicFileChooserUI extends Line 1612  public class BasicFileChooserUI extends
1612    }    }
1613    
1614    /**    /**
1615     * DOCUMENT ME!     * Returns the current file name.
1616     *     *
1617     * @return DOCUMENT ME!     * @return The current file name.
1618     */     */
1619    public String getFileName()    public String getFileName()
1620    {    {
# Line 1585  public class BasicFileChooserUI extends Line 1622  public class BasicFileChooserUI extends
1622    }    }
1623    
1624    /**    /**
1625     * DOCUMENT ME!     * Returns the current directory name.
1626     *     *
1627     * @return DOCUMENT ME!     * @return The directory name.
1628       *
1629       * @see #setDirectoryName(String)
1630     */     */
1631    public String getDirectoryName()    public String getDirectoryName()
1632    {    {
# Line 1596  public class BasicFileChooserUI extends Line 1635  public class BasicFileChooserUI extends
1635    }    }
1636    
1637    /**    /**
1638     * DOCUMENT ME!     * Sets the file name.
1639     *     *
1640     * @param filename DOCUMENT ME!     * @param filename  the file name.
1641       *
1642       * @see #getFileName()
1643     */     */
1644    public void setFileName(String filename)    public void setFileName(String filename)
1645    {    {
# Line 1606  public class BasicFileChooserUI extends Line 1647  public class BasicFileChooserUI extends
1647    }    }
1648    
1649    /**    /**
1650     * DOCUMENT ME!     * Sets the directory name (NOT IMPLEMENTED).
1651     *     *
1652     * @param dirname DOCUMENT ME!     * @param dirname  the directory name.
1653       *
1654       * @see #getDirectoryName()
1655     */     */
1656    public void setDirectoryName(String dirname)    public void setDirectoryName(String dirname)
1657    {    {
# Line 1616  public class BasicFileChooserUI extends Line 1659  public class BasicFileChooserUI extends
1659    }    }
1660    
1661    /**    /**
1662     * DOCUMENT ME!     * Rescans the current directory.
1663     *     *
1664     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1665     */     */
1666    public void rescanCurrentDirectory(JFileChooser fc)    public void rescanCurrentDirectory(JFileChooser fc)
1667    {    {
# Line 1627  public class BasicFileChooserUI extends Line 1670  public class BasicFileChooserUI extends
1670    }    }
1671    
1672    /**    /**
1673     * DOCUMENT ME!     * NOT YET IMPLEMENTED.
1674     *     *
1675     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1676     * @param f DOCUMENT ME!     * @param f  the file.
1677     */     */
1678    public void ensureFileIsVisible(JFileChooser fc, File f)    public void ensureFileIsVisible(JFileChooser fc, File f)
1679    {    {
# Line 1638  public class BasicFileChooserUI extends Line 1681  public class BasicFileChooserUI extends
1681    }    }
1682    
1683    /**    /**
1684     * DOCUMENT ME!     * Returns the {@link JFileChooser} component that this UI delegate
1685       * represents.
1686     *     *
1687     * @return DOCUMENT ME!     * @return The component represented by this UI delegate.
1688     */     */
1689    public JFileChooser getFileChooser()    public JFileChooser getFileChooser()
1690    {    {
# Line 1648  public class BasicFileChooserUI extends Line 1692  public class BasicFileChooserUI extends
1692    }    }
1693    
1694    /**    /**
1695     * DOCUMENT ME!     * Returns the optional accessory panel.
1696     *     *
1697     * @return DOCUMENT ME!     * @return The optional accessory panel.
1698     */     */
1699    public JPanel getAccessoryPanel()    public JPanel getAccessoryPanel()
1700    {    {
# Line 1658  public class BasicFileChooserUI extends Line 1702  public class BasicFileChooserUI extends
1702    }    }
1703    
1704    /**    /**
1705     * DOCUMENT ME!     * Creates and returns an approve (open or save) button for the dialog.
1706     *     *
1707     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1708     *     *
1709     * @return DOCUMENT ME!     * @return The button.
1710     */     */
1711    public JButton getApproveButton(JFileChooser fc)    public JButton getApproveButton(JFileChooser fc)
1712    {    {
# Line 1673  public class BasicFileChooserUI extends Line 1717  public class BasicFileChooserUI extends
1717    }    }
1718    
1719    /**    /**
1720     * DOCUMENT ME!     * Returns the tool tip text for the approve (open/save) button.  This first
1721       * checks the file chooser to see if a value has been explicitly set - if
1722       * not, a default value appropriate for the type of file chooser is
1723       * returned.
1724     *     *
1725     * @param fc DOCUMENT ME!     * @param fc  the file chooser.
1726     *     *
1727     * @return DOCUMENT ME!     * @return The tool tip text.
1728     */     */
1729    public String getApproveButtonToolTipText(JFileChooser fc)    public String getApproveButtonToolTipText(JFileChooser fc)
1730    {    {
# Line 1690  public class BasicFileChooserUI extends Line 1737  public class BasicFileChooserUI extends
1737    }    }
1738    
1739    /**    /**
1740     * DOCUMENT ME!     * Clears the icon cache.
1741     */     */
1742    public void clearIconCache()    public void clearIconCache()
1743    {    {
# Line 1699  public class BasicFileChooserUI extends Line 1746  public class BasicFileChooserUI extends
1746    }    }
1747    
1748    /**    /**
1749     * DOCUMENT ME!     * Creates a new listener to handle selections in the file list.
1750     *     *
1751     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1752     *     *
1753     * @return DOCUMENT ME!     * @return A new instance of {@link SelectionListener}.
1754     */     */
1755    public ListSelectionListener createListSelectionListener(JFileChooser fc)    public ListSelectionListener createListSelectionListener(JFileChooser fc)
1756    {    {
# Line 1711  public class BasicFileChooserUI extends Line 1758  public class BasicFileChooserUI extends
1758    }    }
1759    
1760    /**    /**
1761     * DOCUMENT ME!     * Creates a new listener to handle double-click events.
1762     *     *
1763     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1764     * @param list DOCUMENT ME!     * @param list  the list.
1765     *     *
1766     * @return DOCUMENT ME!     * @return A new instance of {@link DoubleClickListener}.
1767     */     */
1768    protected MouseListener createDoubleClickListener(JFileChooser fc, JList list)    protected MouseListener createDoubleClickListener(JFileChooser fc, JList list)
1769    {    {
# Line 1724  public class BasicFileChooserUI extends Line 1771  public class BasicFileChooserUI extends
1771    }    }
1772    
1773    /**    /**
1774     * DOCUMENT ME!     * Returns <code>true</code> if a directory is selected, and
1775       * <code>false</code> otherwise.
1776     *     *
1777     * @return DOCUMENT ME!     * @return A boolean.
1778     */     */
1779    protected boolean isDirectorySelected()    protected boolean isDirectorySelected()
1780    {    {
# Line 1734  public class BasicFileChooserUI extends Line 1782  public class BasicFileChooserUI extends
1782    }    }
1783    
1784    /**    /**
1785     * DOCUMENT ME!     * Sets the flag that indicates whether the current directory is selected.
1786     *     *
1787     * @param selected DOCUMENT ME!     * @param selected  the new flag value.
1788     */     */
1789    protected void setDirectorySelected(boolean selected)    protected void setDirectorySelected(boolean selected)
1790    {    {
# Line 1744  public class BasicFileChooserUI extends Line 1792  public class BasicFileChooserUI extends
1792    }    }
1793    
1794    /**    /**
1795     * DOCUMENT ME!     * Returns the current directory.
1796     *     *
1797     * @return DOCUMENT ME!     * @return The current directory.
1798     */     */
1799    protected File getDirectory()    protected File getDirectory()
1800    {    {
# Line 1754  public class BasicFileChooserUI extends Line 1802  public class BasicFileChooserUI extends
1802    }    }
1803    
1804    /**    /**
1805     * DOCUMENT ME!     * Sets the current directory.
1806     *     *
1807     * @param f DOCUMENT ME!     * @param f  the directory.
1808     */     */
1809    protected void setDirectory(File f)    protected void setDirectory(File f)
1810    {    {
# Line 1764  public class BasicFileChooserUI extends Line 1812  public class BasicFileChooserUI extends
1812    }    }
1813    
1814    /**    /**
1815     * DOCUMENT ME!     * Returns the "accept all" file filter.
1816     *     *
1817     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1818     *     *
1819     * @return DOCUMENT ME!     * @return The "accept all" file filter.
1820     */     */
1821    public FileFilter getAcceptAllFileFilter(JFileChooser fc)    public FileFilter getAcceptAllFileFilter(JFileChooser fc)
1822    {    {
# Line 1776  public class BasicFileChooserUI extends Line 1824  public class BasicFileChooserUI extends
1824    }    }
1825    
1826    /**    /**
1827     * DOCUMENT ME!     * Returns the file view for the file chooser.  This returns either the
1828       * file view that has been explicitly set for the {@link JFileChooser}, or
1829       * a default file view.
1830     *     *
1831     * @param fc DOCUMENT ME!     * @param fc  the file chooser component.
1832     *     *
1833     * @return DOCUMENT ME!     * @return The file view.
1834       *
1835       * @see JFileChooser#getFileView()
1836     */     */
1837    public FileView getFileView(JFileChooser fc)    public FileView getFileView(JFileChooser fc)
1838    {    {
# Line 1790  public class BasicFileChooserUI extends Line 1842  public class BasicFileChooserUI extends
1842    }    }
1843    
1844    /**    /**
1845     * DOCUMENT ME!     * Returns the dialog title.
1846     *     *
1847     * @param fc DOCUMENT ME!     * @param fc  the file chooser (<code>null</code> not permitted).
1848     *     *
1849     * @return DOCUMENT ME!     * @return The dialog title.
1850       *
1851       * @see JFileChooser#getDialogTitle()
1852     */     */
1853    public String getDialogTitle(JFileChooser fc)    public String getDialogTitle(JFileChooser fc)
1854    {    {
# Line 1819  public class BasicFileChooserUI extends Line 1873  public class BasicFileChooserUI extends
1873    }    }
1874    
1875    /**    /**
1876     * DOCUMENT ME!     * Returns the approve button mnemonic.
1877     *     *
1878     * @param fc DOCUMENT ME!     * @param fc  the file chooser (<code>null</code> not permitted).
1879     *     *
1880     * @return DOCUMENT ME!     * @return The approve button mnemonic.
1881       *
1882       * @see JFileChooser#getApproveButtonMnemonic()
1883     */     */
1884    public int getApproveButtonMnemonic(JFileChooser fc)    public int getApproveButtonMnemonic(JFileChooser fc)
1885    {    {
# Line 1836  public class BasicFileChooserUI extends Line 1892  public class BasicFileChooserUI extends
1892    }    }
1893    
1894    /**    /**
1895     * DOCUMENT ME!     * Returns the approve button text.
1896     *     *
1897     * @param fc DOCUMENT ME!     * @param fc  the file chooser (<code>null</code> not permitted).
1898     *     *
1899     * @return DOCUMENT ME!     * @return The approve button text.
1900       *
1901       * @see JFileChooser#getApproveButtonText()
1902     */     */
1903    public String getApproveButtonText(JFileChooser fc)    public String getApproveButtonText(JFileChooser fc)
1904    {    {
# Line 1853  public class BasicFileChooserUI extends Line 1911  public class BasicFileChooserUI extends
1911    }    }
1912    
1913    /**    /**
1914     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "new folder"
1915       * button.
1916     *     *
1917     * @return DOCUMENT ME!     * @return A new instance of {@link GoHomeAction}.
1918     */     */
1919    public Action getNewFolderAction()    public Action getNewFolderAction()
1920    {    {
# Line 1863  public class BasicFileChooserUI extends Line 1922  public class BasicFileChooserUI extends
1922    }    }
1923    
1924    /**    /**
1925     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "home folder"
1926       * button.
1927     *     *
1928     * @return DOCUMENT ME!     * @return A new instance of {@link GoHomeAction}.
1929     */     */
1930    public Action getGoHomeAction()    public Action getGoHomeAction()
1931    {    {
# Line 1873  public class BasicFileChooserUI extends Line 1933  public class BasicFileChooserUI extends
1933    }    }
1934    
1935    /**    /**
1936     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "up folder"
1937       * button.
1938     *     *
1939     * @return DOCUMENT ME!     * @return A new instance of {@link ChangeToParentDirectoryAction}.
1940     */     */
1941    public Action getChangeToParentDirectoryAction()    public Action getChangeToParentDirectoryAction()
1942    {    {
# Line 1883  public class BasicFileChooserUI extends Line 1944  public class BasicFileChooserUI extends
1944    }    }
1945    
1946    /**    /**
1947     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "approve"
1948       * button.
1949     *     *
1950     * @return DOCUMENT ME!     * @return A new instance of {@link ApproveSelectionAction}.
1951     */     */
1952    public Action getApproveSelectionAction()    public Action getApproveSelectionAction()
1953    {    {
# Line 1893  public class BasicFileChooserUI extends Line 1955  public class BasicFileChooserUI extends
1955    }    }
1956    
1957    /**    /**
1958     * DOCUMENT ME!     * Creates and returns a new action that will be used with the "cancel"
1959       * button.
1960     *     *
1961     * @return DOCUMENT ME!     * @return A new instance of {@link CancelSelectionAction}.
1962     */     */
1963    public Action getCancelSelectionAction()    public Action getCancelSelectionAction()
1964    {    {
# Line 1903  public class BasicFileChooserUI extends Line 1966  public class BasicFileChooserUI extends
1966    }    }
1967    
1968    /**    /**
1969     * DOCUMENT ME!     * Creates and returns a new instance of {@link UpdateAction}.
1970     *     *
1971     * @return DOCUMENT ME!     * @return An action.
1972     */     */
1973    public Action getUpdateAction()    public Action getUpdateAction()
1974    {    {

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

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