This commit was manufactured by cvs2svn to create branch
[official-gcc.git] / libjava / javax / swing / JFileChooser.java
blobf653c708bd900b3367c435a47089a4a13d75cb1e
1 /* JFileChooser.java --
2 Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.swing;
41 import java.awt.Component;
42 import java.awt.event.ActionListener;
43 import java.io.File;
44 import java.io.IOException;
45 import java.io.ObjectOutputStream;
46 import java.util.Vector;
48 import javax.accessibility.Accessible;
49 import javax.accessibility.AccessibleContext;
50 import javax.accessibility.AccessibleRole;
51 import javax.swing.filechooser.FileFilter;
52 import javax.swing.filechooser.FileSystemView;
53 import javax.swing.filechooser.FileView;
54 import javax.swing.plaf.FileChooserUI;
56 /**
57 * JFileChooser
58 * @author Andrew Selkirk
59 * @version 1.0
61 public class JFileChooser extends JComponent implements Accessible {
63 private static final long serialVersionUID = 3162921138695327837L;
65 /**
66 * AccessibleJFileChooser
68 protected class AccessibleJFileChooser extends AccessibleJComponent
70 private static final long serialVersionUID = 8205148454060169244L;
72 /**
73 * Constructor AccessibleJFileChooser
74 * @param component TODO
76 protected AccessibleJFileChooser()
80 /**
81 * getAccessibleRole
82 * @return AccessibleRole
84 public AccessibleRole getAccessibleRole()
86 return AccessibleRole.FILE_CHOOSER;
90 /**
91 * uiClassID
93 private static final String uiClassID = "FileChooserUI";
95 /**
96 * OPEN_DIALOG
98 public static final int OPEN_DIALOG = 0;
101 * SAVE_DIALOG
103 public static final int SAVE_DIALOG = 1;
106 * CUSTOM_DIALOG
108 public static final int CUSTOM_DIALOG = 2;
111 * CANCEL_OPTION
113 public static final int CANCEL_OPTION = 1;
116 * APPROVE_OPTION
118 public static final int APPROVE_OPTION = 0;
121 * ERROR_OPTION
123 public static final int ERROR_OPTION = -1;
126 * FILES_ONLY
128 public static final int FILES_ONLY = 0;
131 * DIRECTORIES_ONLY
133 public static final int DIRECTORIES_ONLY = 1;
136 * FILES_AND_DIRECTORIES
138 public static final int FILES_AND_DIRECTORIES = 2;
141 * CANCEL_SELECTION
143 public static final String CANCEL_SELECTION = "CancelSelection";
146 * APPROVE_SELECTION
148 public static final String APPROVE_SELECTION = "ApproveSelection";
151 * APPROVE_BUTTON_TEXT_CHANGED_PROPERTY
153 public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY = "ApproveButtonTextChangedProperty";
156 * APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY
158 public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY = "ApproveButtonToolTipTextChangedProperty";
161 * APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY
163 public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY = "ApproveButtonMnemonicChangedProperty";
166 * CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY
168 public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY = "ControlButtonsAreShownChangedProperty";
171 * DIRECTORY_CHANGED_PROPERTY
173 public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";
176 * SELECTED_FILE_CHANGED_PROPERTY
178 public static final String SELECTED_FILE_CHANGED_PROPERTY = "SelectedFileChangedProperty";
181 * SELECTED_FILES_CHANGED_PROPERTY
183 public static final String SELECTED_FILES_CHANGED_PROPERTY = "SelectedFilesChangedProperty";
186 * MULTI_SELECTION_ENABLED_CHANGED_PROPERTY
188 public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY = "MultiSelectionEnabledChangedProperty";
191 * FILE_SYSTEM_VIEW_CHANGED_PROPERTY
193 public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY = "FileSystemViewChanged";
196 * FILE_VIEW_CHANGED_PROPERTY
198 public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";
201 * FILE_HIDING_CHANGED_PROPERTY
203 public static final String FILE_HIDING_CHANGED_PROPERTY = "FileHidingChanged";
206 * FILE_FILTER_CHANGED_PROPERTY
208 public static final String FILE_FILTER_CHANGED_PROPERTY = "fileFilterChanged";
211 * FILE_SELECTION_MODE_CHANGED_PROPERTY
213 public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY = "fileSelectionChanged";
216 * ACCESSORY_CHANGED_PROPERTY
218 public static final String ACCESSORY_CHANGED_PROPERTY = "AccessoryChangedProperty";
221 * ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY
223 public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY = "acceptAllFileFilterUsedChanged";
226 * DIALOG_TITLE_CHANGED_PROPERTY
228 public static final String DIALOG_TITLE_CHANGED_PROPERTY = "DialogTitleChangedProperty";
231 * DIALOG_TYPE_CHANGED_PROPERTY
233 public static final String DIALOG_TYPE_CHANGED_PROPERTY = "DialogTypeChangedProperty";
236 * CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY
238 public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY = "ChoosableFileFilterChangedProperty";
241 * dialogTitle
243 private String dialogTitle;
246 * approveButtonText
248 private String approveButtonText;
251 * approveButtonToolTipText
253 private String approveButtonToolTipText;
256 * approveButtonMnemonic
258 private int approveButtonMnemonic;
261 * actionListener
263 private ActionListener actionListener;
266 * filters
268 private Vector filters;
271 * dialog
273 private JDialog dialog;
276 * dialogType
278 private int dialogType;
281 * returnValue
283 private int returnValue;
286 * accessory
288 private JComponent accessory;
291 * fileView
293 private FileView fileView;
296 * uiFileView
298 private FileView uiFileView;
301 * controlsShown
303 private boolean controlsShown;
306 * useFileHiding
308 private boolean useFileHiding;
311 * fileSelectionMode
313 private int fileSelectionMode;
316 * multiSelectionEnabled
318 private boolean multiSelectionEnabled;
321 * useAcceptAllFileFilter
323 private boolean useAcceptAllFileFilter;
326 * fileFilter
328 private FileFilter fileFilter;
331 * fileSystemView
333 private FileSystemView fileSystemView;
336 * currentDirectory
338 private File currentDirectory;
341 * selectedFile
343 private File selectedFile;
346 * selectedFiles
348 private File[] selectedFiles;
351 * accessibleContext
353 protected AccessibleContext accessibleContext;
356 //-------------------------------------------------------------
357 // Initialization ---------------------------------------------
358 //-------------------------------------------------------------
361 * Constructor JFileChooser
363 public JFileChooser() {
364 // TODO
365 } // JFileChooser()
368 * Constructor JFileChooser
369 * @param currentDirectoryPath TODO
371 public JFileChooser(String currentDirectoryPath) {
372 // TODO
373 } // JFileChooser()
376 * Constructor JFileChooser
377 * @param currentDirectory TODO
379 public JFileChooser(File currentDirectory) {
380 // TODO
381 } // JFileChooser()
384 * Constructor JFileChooser
385 * @param value0 TODO
387 public JFileChooser(FileSystemView fsv) {
388 // TODO
389 } // JFileChooser()
392 * Constructor JFileChooser
393 * @param currentDirectory TODO
394 * @param fsv TODO
396 public JFileChooser(File currentDirectory, FileSystemView fsv) {
397 // TODO
398 } // JFileChooser()
401 * Constructor JFileChooser
402 * @param currentDirectoryPath TODO
403 * @param fsv TODO
405 public JFileChooser(String currentDirectoryPath, FileSystemView fsv) {
406 // TODO
407 } // JFileChooser()
410 //-------------------------------------------------------------
411 // Methods ----------------------------------------------------
412 //-------------------------------------------------------------
415 * writeObject
416 * @param stream TODO
417 * @exception IOException TODO
419 private void writeObject(ObjectOutputStream stream) throws IOException {
420 // TODO
421 } // writeObject()
424 * getName
425 * @param file TODO
426 * @returns String
428 public String getName(File file) {
429 return null; // TODO
430 } // getName()
433 * setup
434 * @param view TODO
436 protected void setup(FileSystemView view) {
437 // TODO
438 } // setup()
441 * accept
442 * @param file TODO
443 * @returns boolean
445 public boolean accept(File file) {
446 return false; // TODO
447 } // accept()
450 * getSelectedFile
451 * @returns File
453 public File getSelectedFile() {
454 return null; // TODO
455 } // getSelectedFile()
458 * setSelectedFile
459 * @param file TODO
461 public void setSelectedFile(File file) {
462 // TODO
463 } // setSelectedFile()
466 * getSelectedFiles
467 * @returns File[]
469 public File[] getSelectedFiles() {
470 return null; // TODO
471 } // getSelectedFiles()
474 * setSelectedFiles
475 * @param files TODO
477 public void setSelectedFiles(File[] files) {
478 // TODO
479 } // setSelectedFiles()
482 * getCurrentDirectory
483 * @returns File
485 public File getCurrentDirectory() {
486 return null; // TODO
487 } // getCurrentDirectory()
490 * setCurrentDirectory
491 * @param directory TODO
493 public void setCurrentDirectory(File directory) {
494 // TODO
495 } // setCurrentDirectory()
498 * changeToParentDirectory
500 public void changeToParentDirectory() {
501 // TODO
502 } // changeToParentDirectory()
505 * rescanCurrentDirectory
507 public void rescanCurrentDirectory() {
508 // TODO
509 } // rescanCurrentDirectory()
512 * ensureFileIsVisible
513 * @param file TODO
515 public void ensureFileIsVisible(File file) {
516 // TODO
517 } // ensureFileIsVisible()
520 * showOpenDialog
521 * @param parent TODO
522 * @returns int
524 public int showOpenDialog(Component parent) {
525 return 0; // TODO
526 } // showOpenDialog()
529 * showSaveDialog
530 * @param parent TODO
531 * @returns int
533 public int showSaveDialog(Component parent) {
534 return 0; // TODO
535 } // showSaveDialog()
538 * showDialog
539 * @param parent TODO
540 * @param approveButtonText TODO
541 * @returns int
543 public int showDialog(Component parent, String approveButtonText) {
544 return 0; // TODO
545 } // showDialog()
548 * getControlButtonsAreShown
549 * @returns boolean
551 public boolean getControlButtonsAreShown() {
552 return false; // TODO
553 } // getControlButtonsAreShown()
556 * setControlButtonsAreShown
557 * @param value TODO
559 public void setControlButtonsAreShown(boolean value) {
560 // TODO
561 } // setControlButtonsAreShown()
564 * getDialogType
565 * @returns int
567 public int getDialogType() {
568 return 0; // TODO
569 } // getDialogType()
572 * setDialogType
573 * @param type TODO
575 public void setDialogType(int type) {
576 // TODO
577 } // setDialogType()
580 * setDialogTitle
581 * @param title TODO
583 public void setDialogTitle(String title) {
584 // TODO
585 } // setDialogTitle()
588 * getDialogTitle
589 * @returns String
591 public String getDialogTitle() {
592 return null; // TODO
593 } // getDialogTitle()
596 * setApproveButtonToolTipText
597 * @param text TODO
599 public void setApproveButtonToolTipText(String text) {
600 // TODO
601 } // setApproveButtonToolTipText()
604 * getApproveButtonToolTipText
605 * @returns String
607 public String getApproveButtonToolTipText() {
608 return null; // TODO
609 } // getApproveButtonToolTipText()
612 * getApproveButtonMnemonic
613 * @returns int
615 public int getApproveButtonMnemonic() {
616 return 0; // TODO
617 } // getApproveButtonMnemonic()
620 * setApproveButtonMnemonic
621 * @param mnemonic TODO
623 public void setApproveButtonMnemonic(int mnemonic) {
624 // TODO
625 } // setApproveButtonMnemonic()
628 * setApproveButtonMnemonic
629 * @param mnemonic TODO
631 public void setApproveButtonMnemonic(char mnemonic) {
632 // TODO
633 } // setApproveButtonMnemonic()
636 * setApproveButtonText
637 * @param text TODO
639 public void setApproveButtonText(String text) {
640 // TODO
641 } // setApproveButtonText()
644 * getApproveButtonText
645 * @returns String
647 public String getApproveButtonText() {
648 return null; // TODO
649 } // getApproveButtonText()
652 * getChoosableFileFilters
653 * @returns FileFilter[]
655 public FileFilter[] getChoosableFileFilters() {
656 return null; // TODO
657 } // getChoosableFileFilters()
660 * addChoosableFileFilter
661 * @param filter TODO
663 public void addChoosableFileFilter(FileFilter filter) {
664 // TODO
665 } // addChoosableFileFilter()
668 * removeChoosableFileFilter
669 * @param filter TODO
670 * @returns boolean
672 public boolean removeChoosableFileFilter(FileFilter filter) {
673 return false; // TODO
674 } // removeChoosableFileFilter()
677 * resetChoosableFileFilters
679 public void resetChoosableFileFilters() {
680 // TODO
681 } // resetChoosableFileFilters()
684 * getAcceptAllFileFilter
685 * @returns FileFilter
687 public FileFilter getAcceptAllFileFilter() {
688 return null; // TODO
689 } // getAcceptAllFileFilter()
692 * isAcceptAllFileFilterUsed
693 * @returns boolean
695 public boolean isAcceptAllFileFilterUsed() {
696 return false; // TODO
697 } // isAcceptAllFileFilterUsed()
700 * setAcceptAllFileFilterUsed
701 * @param value TODO
703 public void setAcceptAllFileFilterUsed(boolean value) {
704 // TODO
705 } // setAcceptAllFileFilterUsed()
708 * getAccessory
709 * @returns JComponent
711 public JComponent getAccessory() {
712 return null; // TODO
713 } // getAccessory()
716 * setAccessory
717 * @param accessory TODO
719 public void setAccessory(JComponent accessory) {
720 // TODO
721 } // setAccessory()
724 * setFileSelectionMode
725 * @param mode TODO
727 public void setFileSelectionMode(int mode) {
728 // TODO
729 } // setFileSelectionMode()
732 * getFileSelectionMode
733 * @returns int
735 public int getFileSelectionMode() {
736 return 0; // TODO
737 } // getFileSelectionMode()
740 * isFileSelectionEnabled
741 * @returns boolean
743 public boolean isFileSelectionEnabled() {
744 return false; // TODO
745 } // isFileSelectionEnabled()
748 * isDirectorySelectionEnabled
749 * @returns boolean
751 public boolean isDirectorySelectionEnabled() {
752 return false; // TODO
753 } // isDirectorySelectionEnabled()
756 * isMultiSelectionEnabled
757 * @returns boolean
759 public boolean isMultiSelectionEnabled() {
760 return false; // TODO
761 } // isMultiSelectionEnabled()
764 * setMultiSelectionEnabled
765 * @param enabled TODO
767 public void setMultiSelectionEnabled(boolean enabled) {
768 // TODO
769 } // setMultiSelectionEnabled()
772 * isFileHidingEnabled
773 * @returns boolean
775 public boolean isFileHidingEnabled() {
776 return false; // TODO
777 } // isFileHidingEnabled()
780 * setFileHidingEnabled
781 * @param enabled TODO
783 public void setFileHidingEnabled(boolean enabled) {
784 // TODO
785 } // setFileHidingEnabled()
788 * getFileFilter
789 * @returns FileFilter
791 public FileFilter getFileFilter() {
792 return null; // TODO
793 } // getFileFilter()
796 * setFileFilter
797 * @param filter TODO
799 public void setFileFilter(FileFilter filter) {
800 // TODO
801 } // setFileFilter()
804 * getFileView
805 * @returns FileView
807 public FileView getFileView() {
808 return null; // TODO
809 } // getFileView()
812 * setFileView
813 * @param view TODO
815 public void setFileView(FileView view) {
816 // TODO
817 } // setFileView()
820 * getDescription
821 * @param file TODO
822 * @returns String
824 public String getDescription(File file) {
825 return null; // TODO
826 } // getDescription()
829 * getTypeDescription
830 * @param file TODO
831 * @returns String
833 public String getTypeDescription(File file) {
834 return null; // TODO
835 } // getTypeDescription()
838 * getIcon
839 * @param file TODO
840 * @returns Icon
842 public Icon getIcon(File file) {
843 return null; // TODO
844 } // getIcon()
847 * isTraversable
848 * @param file TODO
849 * @returns boolean
851 public boolean isTraversable(File file) {
852 return false; // TODO
853 } // isTraversable()
856 * getFileSystemView
857 * @returns FileSystemView
859 public FileSystemView getFileSystemView() {
860 return null; // TODO
861 } // getFileSystemView()
864 * setFileSystemView
865 * @param fsv TODO
867 public void setFileSystemView(FileSystemView fsv) {
868 // TODO
869 } // setFileSystemView()
872 * approveSelection
874 public void approveSelection() {
875 // TODO
876 } // approveSelection()
879 * cancelSelection
881 public void cancelSelection() {
882 // TODO
883 } // cancelSelection()
886 * addActionListener
887 * @param listener TODO
889 public void addActionListener(ActionListener listener)
891 listenerList.add (ActionListener.class, listener);
895 * removeActionListener
896 * @param listener TODO
898 public void removeActionListener(ActionListener listener)
900 listenerList.remove (ActionListener.class, listener);
903 public ActionListener[] getActionListeners()
905 return (ActionListener[]) listenerList.getListeners (ActionListener.class);
909 * fireActionPerformed
910 * @param command TODO
912 protected void fireActionPerformed(String command) {
913 // TODO
914 } // fireActionPerformed()
917 * updateUI
919 public void updateUI() {
920 setUI((FileChooserUI) UIManager.get(this));
921 invalidate();
922 } // updateUI()
925 * getUIClassID
926 * @returns String
928 public String getUIClassID() {
929 return uiClassID;
930 } // getUIClassID()
933 * getUI
934 * @returns FileChooserUI
936 public FileChooserUI getUI() {
937 return (FileChooserUI) ui;
938 } // getUI()
941 * paramString
942 * @returns String
944 protected String paramString() {
945 return null; // TODO
946 } // paramString()
949 * getAccessibleContext
950 * @returns AccessibleContext
952 public AccessibleContext getAccessibleContext()
954 if (accessibleContext == null)
955 accessibleContext = new AccessibleJFileChooser();
957 return accessibleContext;