2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libjava / javax / swing / JFileChooser.java
blob988e75b7743aaa1b3cdd198a700c19167753cfb7
1 /* JFileChooser.java --
2 Copyright (C) 2002 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;
47 import javax.accessibility.Accessible;
48 import javax.accessibility.AccessibleContext;
49 import javax.accessibility.AccessibleRole;
50 import javax.swing.filechooser.FileFilter;
51 import javax.swing.filechooser.FileSystemView;
52 import javax.swing.filechooser.FileView;
53 import javax.swing.plaf.FileChooserUI;
55 /**
56 * JFileChooser
57 * @author Andrew Selkirk
58 * @version 1.0
60 public class JFileChooser extends JComponent implements Accessible {
62 //-------------------------------------------------------------
63 // Classes ----------------------------------------------------
64 //-------------------------------------------------------------
66 /**
67 * AccessibleJFileChooser
69 protected class AccessibleJFileChooser extends AccessibleJComponent {
71 //-------------------------------------------------------------
72 // Variables --------------------------------------------------
73 //-------------------------------------------------------------
76 //-------------------------------------------------------------
77 // Initialization ---------------------------------------------
78 //-------------------------------------------------------------
80 /**
81 * Constructor AccessibleJFileChooser
82 * @param component TODO
84 protected AccessibleJFileChooser(JFileChooser component) {
85 super(component);
86 // TODO
87 } // AccessibleJFileChooser()
90 //-------------------------------------------------------------
91 // Methods ----------------------------------------------------
92 //-------------------------------------------------------------
94 /**
95 * getAccessibleRole
96 * @returns AccessibleRole
98 public AccessibleRole getAccessibleRole() {
99 return AccessibleRole.FILE_CHOOSER;
100 } // getAccessibleRole()
103 } // AccessibleJFileChooser
106 //-------------------------------------------------------------
107 // Variables --------------------------------------------------
108 //-------------------------------------------------------------
111 * uiClassID
113 private static final String uiClassID = "FileChooserUI";
116 * OPEN_DIALOG
118 public static final int OPEN_DIALOG = 0;
121 * SAVE_DIALOG
123 public static final int SAVE_DIALOG = 1;
126 * CUSTOM_DIALOG
128 public static final int CUSTOM_DIALOG = 2;
131 * CANCEL_OPTION
133 public static final int CANCEL_OPTION = 1;
136 * APPROVE_OPTION
138 public static final int APPROVE_OPTION = 0;
141 * ERROR_OPTION
143 public static final int ERROR_OPTION = -1;
146 * FILES_ONLY
148 public static final int FILES_ONLY = 0;
151 * DIRECTORIES_ONLY
153 public static final int DIRECTORIES_ONLY = 1;
156 * FILES_AND_DIRECTORIES
158 public static final int FILES_AND_DIRECTORIES = 2;
161 * CANCEL_SELECTION
163 public static final String CANCEL_SELECTION = "CancelSelection";
166 * APPROVE_SELECTION
168 public static final String APPROVE_SELECTION = "ApproveSelection";
171 * APPROVE_BUTTON_TEXT_CHANGED_PROPERTY
173 public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY = "ApproveButtonTextChangedProperty";
176 * APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY
178 public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY = "ApproveButtonToolTipTextChangedProperty";
181 * APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY
183 public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY = "ApproveButtonMnemonicChangedProperty";
186 * CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY
188 public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY = "ControlButtonsAreShownChangedProperty";
191 * DIRECTORY_CHANGED_PROPERTY
193 public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";
196 * SELECTED_FILE_CHANGED_PROPERTY
198 public static final String SELECTED_FILE_CHANGED_PROPERTY = "SelectedFileChangedProperty";
201 * SELECTED_FILES_CHANGED_PROPERTY
203 public static final String SELECTED_FILES_CHANGED_PROPERTY = "SelectedFilesChangedProperty";
206 * MULTI_SELECTION_ENABLED_CHANGED_PROPERTY
208 public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY = "MultiSelectionEnabledChangedProperty";
211 * FILE_SYSTEM_VIEW_CHANGED_PROPERTY
213 public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY = "FileSystemViewChanged";
216 * FILE_VIEW_CHANGED_PROPERTY
218 public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";
221 * FILE_HIDING_CHANGED_PROPERTY
223 public static final String FILE_HIDING_CHANGED_PROPERTY = "FileHidingChanged";
226 * FILE_FILTER_CHANGED_PROPERTY
228 public static final String FILE_FILTER_CHANGED_PROPERTY = "fileFilterChanged";
231 * FILE_SELECTION_MODE_CHANGED_PROPERTY
233 public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY = "fileSelectionChanged";
236 * ACCESSORY_CHANGED_PROPERTY
238 public static final String ACCESSORY_CHANGED_PROPERTY = "AccessoryChangedProperty";
241 * ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY
243 public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY = "acceptAllFileFilterUsedChanged";
246 * DIALOG_TITLE_CHANGED_PROPERTY
248 public static final String DIALOG_TITLE_CHANGED_PROPERTY = "DialogTitleChangedProperty";
251 * DIALOG_TYPE_CHANGED_PROPERTY
253 public static final String DIALOG_TYPE_CHANGED_PROPERTY = "DialogTypeChangedProperty";
256 * CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY
258 public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY = "ChoosableFileFilterChangedProperty";
261 * dialogTitle
263 private String dialogTitle;
266 * approveButtonText
268 private String approveButtonText;
271 * approveButtonToolTipText
273 private String approveButtonToolTipText;
276 * approveButtonMnemonic
278 private int approveButtonMnemonic;
281 * actionListener
283 private ActionListener actionListener;
286 * filters
288 private Vector filters;
291 * dialog
293 private JDialog dialog;
296 * dialogType
298 private int dialogType;
301 * returnValue
303 private int returnValue;
306 * accessory
308 private JComponent accessory;
311 * fileView
313 private FileView fileView;
316 * uiFileView
318 private FileView uiFileView;
321 * controlsShown
323 private boolean controlsShown;
326 * useFileHiding
328 private boolean useFileHiding;
331 * fileSelectionMode
333 private int fileSelectionMode;
336 * multiSelectionEnabled
338 private boolean multiSelectionEnabled;
341 * useAcceptAllFileFilter
343 private boolean useAcceptAllFileFilter;
346 * fileFilter
348 private FileFilter fileFilter;
351 * fileSystemView
353 private FileSystemView fileSystemView;
356 * currentDirectory
358 private File currentDirectory;
361 * selectedFile
363 private File selectedFile;
366 * selectedFiles
368 private File[] selectedFiles;
371 * accessibleContext
373 protected AccessibleContext accessibleContext;
376 //-------------------------------------------------------------
377 // Initialization ---------------------------------------------
378 //-------------------------------------------------------------
381 * Constructor JFileChooser
383 public JFileChooser() {
384 // TODO
385 } // JFileChooser()
388 * Constructor JFileChooser
389 * @param currentDirectoryPath TODO
391 public JFileChooser(String currentDirectoryPath) {
392 // TODO
393 } // JFileChooser()
396 * Constructor JFileChooser
397 * @param currentDirectory TODO
399 public JFileChooser(File currentDirectory) {
400 // TODO
401 } // JFileChooser()
404 * Constructor JFileChooser
405 * @param value0 TODO
407 public JFileChooser(FileSystemView fsv) {
408 // TODO
409 } // JFileChooser()
412 * Constructor JFileChooser
413 * @param currentDirectory TODO
414 * @param fsv TODO
416 public JFileChooser(File currentDirectory, FileSystemView fsv) {
417 // TODO
418 } // JFileChooser()
421 * Constructor JFileChooser
422 * @param currentDirectoryPath TODO
423 * @param fsv TODO
425 public JFileChooser(String currentDirectoryPath, FileSystemView fsv) {
426 // TODO
427 } // JFileChooser()
430 //-------------------------------------------------------------
431 // Methods ----------------------------------------------------
432 //-------------------------------------------------------------
435 * writeObject
436 * @param stream TODO
437 * @exception IOException TODO
439 private void writeObject(ObjectOutputStream stream) throws IOException {
440 // TODO
441 } // writeObject()
444 * getName
445 * @param file TODO
446 * @returns String
448 public String getName(File file) {
449 return null; // TODO
450 } // getName()
453 * setup
454 * @param view TODO
456 protected void setup(FileSystemView view) {
457 // TODO
458 } // setup()
461 * accept
462 * @param file TODO
463 * @returns boolean
465 public boolean accept(File file) {
466 return false; // TODO
467 } // accept()
470 * getSelectedFile
471 * @returns File
473 public File getSelectedFile() {
474 return null; // TODO
475 } // getSelectedFile()
478 * setSelectedFile
479 * @param file TODO
481 public void setSelectedFile(File file) {
482 // TODO
483 } // setSelectedFile()
486 * getSelectedFiles
487 * @returns File[]
489 public File[] getSelectedFiles() {
490 return null; // TODO
491 } // getSelectedFiles()
494 * setSelectedFiles
495 * @param files TODO
497 public void setSelectedFiles(File[] files) {
498 // TODO
499 } // setSelectedFiles()
502 * getCurrentDirectory
503 * @returns File
505 public File getCurrentDirectory() {
506 return null; // TODO
507 } // getCurrentDirectory()
510 * setCurrentDirectory
511 * @param directory TODO
513 public void setCurrentDirectory(File directory) {
514 // TODO
515 } // setCurrentDirectory()
518 * changeToParentDirectory
520 public void changeToParentDirectory() {
521 // TODO
522 } // changeToParentDirectory()
525 * rescanCurrentDirectory
527 public void rescanCurrentDirectory() {
528 // TODO
529 } // rescanCurrentDirectory()
532 * ensureFileIsVisible
533 * @param file TODO
535 public void ensureFileIsVisible(File file) {
536 // TODO
537 } // ensureFileIsVisible()
540 * showOpenDialog
541 * @param parent TODO
542 * @returns int
544 public int showOpenDialog(Component parent) {
545 return 0; // TODO
546 } // showOpenDialog()
549 * showSaveDialog
550 * @param parent TODO
551 * @returns int
553 public int showSaveDialog(Component parent) {
554 return 0; // TODO
555 } // showSaveDialog()
558 * showDialog
559 * @param parent TODO
560 * @param approveButtonText TODO
561 * @returns int
563 public int showDialog(Component parent, String approveButtonText) {
564 return 0; // TODO
565 } // showDialog()
568 * getControlButtonsAreShown
569 * @returns boolean
571 public boolean getControlButtonsAreShown() {
572 return false; // TODO
573 } // getControlButtonsAreShown()
576 * setControlButtonsAreShown
577 * @param value TODO
579 public void setControlButtonsAreShown(boolean value) {
580 // TODO
581 } // setControlButtonsAreShown()
584 * getDialogType
585 * @returns int
587 public int getDialogType() {
588 return 0; // TODO
589 } // getDialogType()
592 * setDialogType
593 * @param type TODO
595 public void setDialogType(int type) {
596 // TODO
597 } // setDialogType()
600 * setDialogTitle
601 * @param title TODO
603 public void setDialogTitle(String title) {
604 // TODO
605 } // setDialogTitle()
608 * getDialogTitle
609 * @returns String
611 public String getDialogTitle() {
612 return null; // TODO
613 } // getDialogTitle()
616 * setApproveButtonToolTipText
617 * @param text TODO
619 public void setApproveButtonToolTipText(String text) {
620 // TODO
621 } // setApproveButtonToolTipText()
624 * getApproveButtonToolTipText
625 * @returns String
627 public String getApproveButtonToolTipText() {
628 return null; // TODO
629 } // getApproveButtonToolTipText()
632 * getApproveButtonMnemonic
633 * @returns int
635 public int getApproveButtonMnemonic() {
636 return 0; // TODO
637 } // getApproveButtonMnemonic()
640 * setApproveButtonMnemonic
641 * @param mnemonic TODO
643 public void setApproveButtonMnemonic(int mnemonic) {
644 // TODO
645 } // setApproveButtonMnemonic()
648 * setApproveButtonMnemonic
649 * @param mnemonic TODO
651 public void setApproveButtonMnemonic(char mnemonic) {
652 // TODO
653 } // setApproveButtonMnemonic()
656 * setApproveButtonText
657 * @param text TODO
659 public void setApproveButtonText(String text) {
660 // TODO
661 } // setApproveButtonText()
664 * getApproveButtonText
665 * @returns String
667 public String getApproveButtonText() {
668 return null; // TODO
669 } // getApproveButtonText()
672 * getChoosableFileFilters
673 * @returns FileFilter[]
675 public FileFilter[] getChoosableFileFilters() {
676 return null; // TODO
677 } // getChoosableFileFilters()
680 * addChoosableFileFilter
681 * @param filter TODO
683 public void addChoosableFileFilter(FileFilter filter) {
684 // TODO
685 } // addChoosableFileFilter()
688 * removeChoosableFileFilter
689 * @param filter TODO
690 * @returns boolean
692 public boolean removeChoosableFileFilter(FileFilter filter) {
693 return false; // TODO
694 } // removeChoosableFileFilter()
697 * resetChoosableFileFilters
699 public void resetChoosableFileFilters() {
700 // TODO
701 } // resetChoosableFileFilters()
704 * getAcceptAllFileFilter
705 * @returns FileFilter
707 public FileFilter getAcceptAllFileFilter() {
708 return null; // TODO
709 } // getAcceptAllFileFilter()
712 * isAcceptAllFileFilterUsed
713 * @returns boolean
715 public boolean isAcceptAllFileFilterUsed() {
716 return false; // TODO
717 } // isAcceptAllFileFilterUsed()
720 * setAcceptAllFileFilterUsed
721 * @param value TODO
723 public void setAcceptAllFileFilterUsed(boolean value) {
724 // TODO
725 } // setAcceptAllFileFilterUsed()
728 * getAccessory
729 * @returns JComponent
731 public JComponent getAccessory() {
732 return null; // TODO
733 } // getAccessory()
736 * setAccessory
737 * @param accessory TODO
739 public void setAccessory(JComponent accessory) {
740 // TODO
741 } // setAccessory()
744 * setFileSelectionMode
745 * @param mode TODO
747 public void setFileSelectionMode(int mode) {
748 // TODO
749 } // setFileSelectionMode()
752 * getFileSelectionMode
753 * @returns int
755 public int getFileSelectionMode() {
756 return 0; // TODO
757 } // getFileSelectionMode()
760 * isFileSelectionEnabled
761 * @returns boolean
763 public boolean isFileSelectionEnabled() {
764 return false; // TODO
765 } // isFileSelectionEnabled()
768 * isDirectorySelectionEnabled
769 * @returns boolean
771 public boolean isDirectorySelectionEnabled() {
772 return false; // TODO
773 } // isDirectorySelectionEnabled()
776 * isMultiSelectionEnabled
777 * @returns boolean
779 public boolean isMultiSelectionEnabled() {
780 return false; // TODO
781 } // isMultiSelectionEnabled()
784 * setMultiSelectionEnabled
785 * @param enabled TODO
787 public void setMultiSelectionEnabled(boolean enabled) {
788 // TODO
789 } // setMultiSelectionEnabled()
792 * isFileHidingEnabled
793 * @returns boolean
795 public boolean isFileHidingEnabled() {
796 return false; // TODO
797 } // isFileHidingEnabled()
800 * setFileHidingEnabled
801 * @param enabled TODO
803 public void setFileHidingEnabled(boolean enabled) {
804 // TODO
805 } // setFileHidingEnabled()
808 * getFileFilter
809 * @returns FileFilter
811 public FileFilter getFileFilter() {
812 return null; // TODO
813 } // getFileFilter()
816 * setFileFilter
817 * @param filter TODO
819 public void setFileFilter(FileFilter filter) {
820 // TODO
821 } // setFileFilter()
824 * getFileView
825 * @returns FileView
827 public FileView getFileView() {
828 return null; // TODO
829 } // getFileView()
832 * setFileView
833 * @param view TODO
835 public void setFileView(FileView view) {
836 // TODO
837 } // setFileView()
840 * getDescription
841 * @param file TODO
842 * @returns String
844 public String getDescription(File file) {
845 return null; // TODO
846 } // getDescription()
849 * getTypeDescription
850 * @param file TODO
851 * @returns String
853 public String getTypeDescription(File file) {
854 return null; // TODO
855 } // getTypeDescription()
858 * getIcon
859 * @param file TODO
860 * @returns Icon
862 public Icon getIcon(File file) {
863 return null; // TODO
864 } // getIcon()
867 * isTraversable
868 * @param file TODO
869 * @returns boolean
871 public boolean isTraversable(File file) {
872 return false; // TODO
873 } // isTraversable()
876 * getFileSystemView
877 * @returns FileSystemView
879 public FileSystemView getFileSystemView() {
880 return null; // TODO
881 } // getFileSystemView()
884 * setFileSystemView
885 * @param fsv TODO
887 public void setFileSystemView(FileSystemView fsv) {
888 // TODO
889 } // setFileSystemView()
892 * approveSelection
894 public void approveSelection() {
895 // TODO
896 } // approveSelection()
899 * cancelSelection
901 public void cancelSelection() {
902 // TODO
903 } // cancelSelection()
906 * addActionListener
907 * @param listener TODO
909 public void addActionListener(ActionListener listener) {
910 // TODO
911 } // addActionListener()
914 * removeActionListener
915 * @param listener TODO
917 public void removeActionListener(ActionListener listener) {
918 // TODO
919 } // removeActionListener()
922 * fireActionPerformed
923 * @param command TODO
925 protected void fireActionPerformed(String command) {
926 // TODO
927 } // fireActionPerformed()
930 * updateUI
932 public void updateUI() {
933 setUI((FileChooserUI) UIManager.get(this));
934 invalidate();
935 } // updateUI()
938 * getUIClassID
939 * @returns String
941 public String getUIClassID() {
942 return uiClassID;
943 } // getUIClassID()
946 * getUI
947 * @returns FileChooserUI
949 public FileChooserUI getUI() {
950 return (FileChooserUI) ui;
951 } // getUI()
954 * paramString
955 * @returns String
957 protected String paramString() {
958 return null; // TODO
959 } // paramString()
962 * getAccessibleContext
963 * @returns AccessibleContext
965 public AccessibleContext getAccessibleContext() {
966 if (accessibleContext == null) {
967 accessibleContext = new AccessibleJFileChooser(this);
968 } // if
969 return accessibleContext;
970 } // getAccessibleContext()
973 } // JFileChooser