source: trunk/gcc/libjava/javax/swing/JFileChooser.java

Last change on this file was 1389, checked in by bird, 21 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 19.3 KB
Line 
1/* JFileChooser.java --
2 Copyright (C) 2002 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38package javax.swing;
39
40// Imports
41import java.awt.*;
42import java.awt.event.*;
43import java.io.*;
44import java.util.*;
45import javax.accessibility.*;
46import javax.swing.filechooser.*;
47import javax.swing.filechooser.FileFilter;
48import javax.swing.plaf.*;
49
50/**
51 * JFileChooser
52 * @author Andrew Selkirk
53 * @version 1.0
54 */
55public class JFileChooser extends JComponent implements Accessible {
56
57 //-------------------------------------------------------------
58 // Classes ----------------------------------------------------
59 //-------------------------------------------------------------
60
61 /**
62 * AccessibleJFileChooser
63 */
64 protected class AccessibleJFileChooser extends AccessibleJComponent {
65
66 //-------------------------------------------------------------
67 // Variables --------------------------------------------------
68 //-------------------------------------------------------------
69
70
71 //-------------------------------------------------------------
72 // Initialization ---------------------------------------------
73 //-------------------------------------------------------------
74
75 /**
76 * Constructor AccessibleJFileChooser
77 * @param component TODO
78 */
79 protected AccessibleJFileChooser(JFileChooser component) {
80 super(component);
81 // TODO
82 } // AccessibleJFileChooser()
83
84
85 //-------------------------------------------------------------
86 // Methods ----------------------------------------------------
87 //-------------------------------------------------------------
88
89 /**
90 * getAccessibleRole
91 * @returns AccessibleRole
92 */
93 public AccessibleRole getAccessibleRole() {
94 return AccessibleRole.FILE_CHOOSER;
95 } // getAccessibleRole()
96
97
98 } // AccessibleJFileChooser
99
100
101 //-------------------------------------------------------------
102 // Variables --------------------------------------------------
103 //-------------------------------------------------------------
104
105 /**
106 * uiClassID
107 */
108 private static final String uiClassID = "FileChooserUI";
109
110 /**
111 * OPEN_DIALOG
112 */
113 public static final int OPEN_DIALOG = 0;
114
115 /**
116 * SAVE_DIALOG
117 */
118 public static final int SAVE_DIALOG = 1;
119
120 /**
121 * CUSTOM_DIALOG
122 */
123 public static final int CUSTOM_DIALOG = 2;
124
125 /**
126 * CANCEL_OPTION
127 */
128 public static final int CANCEL_OPTION = 1;
129
130 /**
131 * APPROVE_OPTION
132 */
133 public static final int APPROVE_OPTION = 0;
134
135 /**
136 * ERROR_OPTION
137 */
138 public static final int ERROR_OPTION = -1;
139
140 /**
141 * FILES_ONLY
142 */
143 public static final int FILES_ONLY = 0;
144
145 /**
146 * DIRECTORIES_ONLY
147 */
148 public static final int DIRECTORIES_ONLY = 1;
149
150 /**
151 * FILES_AND_DIRECTORIES
152 */
153 public static final int FILES_AND_DIRECTORIES = 2;
154
155 /**
156 * CANCEL_SELECTION
157 */
158 public static final String CANCEL_SELECTION = "CancelSelection";
159
160 /**
161 * APPROVE_SELECTION
162 */
163 public static final String APPROVE_SELECTION = "ApproveSelection";
164
165 /**
166 * APPROVE_BUTTON_TEXT_CHANGED_PROPERTY
167 */
168 public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY = "ApproveButtonTextChangedProperty";
169
170 /**
171 * APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY
172 */
173 public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY = "ApproveButtonToolTipTextChangedProperty";
174
175 /**
176 * APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY
177 */
178 public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY = "ApproveButtonMnemonicChangedProperty";
179
180 /**
181 * CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY
182 */
183 public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY = "ControlButtonsAreShownChangedProperty";
184
185 /**
186 * DIRECTORY_CHANGED_PROPERTY
187 */
188 public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";
189
190 /**
191 * SELECTED_FILE_CHANGED_PROPERTY
192 */
193 public static final String SELECTED_FILE_CHANGED_PROPERTY = "SelectedFileChangedProperty";
194
195 /**
196 * SELECTED_FILES_CHANGED_PROPERTY
197 */
198 public static final String SELECTED_FILES_CHANGED_PROPERTY = "SelectedFilesChangedProperty";
199
200 /**
201 * MULTI_SELECTION_ENABLED_CHANGED_PROPERTY
202 */
203 public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY = "MultiSelectionEnabledChangedProperty";
204
205 /**
206 * FILE_SYSTEM_VIEW_CHANGED_PROPERTY
207 */
208 public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY = "FileSystemViewChanged";
209
210 /**
211 * FILE_VIEW_CHANGED_PROPERTY
212 */
213 public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";
214
215 /**
216 * FILE_HIDING_CHANGED_PROPERTY
217 */
218 public static final String FILE_HIDING_CHANGED_PROPERTY = "FileHidingChanged";
219
220 /**
221 * FILE_FILTER_CHANGED_PROPERTY
222 */
223 public static final String FILE_FILTER_CHANGED_PROPERTY = "fileFilterChanged";
224
225 /**
226 * FILE_SELECTION_MODE_CHANGED_PROPERTY
227 */
228 public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY = "fileSelectionChanged";
229
230 /**
231 * ACCESSORY_CHANGED_PROPERTY
232 */
233 public static final String ACCESSORY_CHANGED_PROPERTY = "AccessoryChangedProperty";
234
235 /**
236 * ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY
237 */
238 public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY = "acceptAllFileFilterUsedChanged";
239
240 /**
241 * DIALOG_TITLE_CHANGED_PROPERTY
242 */
243 public static final String DIALOG_TITLE_CHANGED_PROPERTY = "DialogTitleChangedProperty";
244
245 /**
246 * DIALOG_TYPE_CHANGED_PROPERTY
247 */
248 public static final String DIALOG_TYPE_CHANGED_PROPERTY = "DialogTypeChangedProperty";
249
250 /**
251 * CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY
252 */
253 public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY = "ChoosableFileFilterChangedProperty";
254
255 /**
256 * dialogTitle
257 */
258 private String dialogTitle;
259
260 /**
261 * approveButtonText
262 */
263 private String approveButtonText;
264
265 /**
266 * approveButtonToolTipText
267 */
268 private String approveButtonToolTipText;
269
270 /**
271 * approveButtonMnemonic
272 */
273 private int approveButtonMnemonic;
274
275 /**
276 * actionListener
277 */
278 private ActionListener actionListener;
279
280 /**
281 * filters
282 */
283 private Vector filters;
284
285 /**
286 * dialog
287 */
288 private JDialog dialog;
289
290 /**
291 * dialogType
292 */
293 private int dialogType;
294
295 /**
296 * returnValue
297 */
298 private int returnValue;
299
300 /**
301 * accessory
302 */
303 private JComponent accessory;
304
305 /**
306 * fileView
307 */
308 private FileView fileView;
309
310 /**
311 * uiFileView
312 */
313 private FileView uiFileView;
314
315 /**
316 * controlsShown
317 */
318 private boolean controlsShown;
319
320 /**
321 * useFileHiding
322 */
323 private boolean useFileHiding;
324
325 /**
326 * fileSelectionMode
327 */
328 private int fileSelectionMode;
329
330 /**
331 * multiSelectionEnabled
332 */
333 private boolean multiSelectionEnabled;
334
335 /**
336 * useAcceptAllFileFilter
337 */
338 private boolean useAcceptAllFileFilter;
339
340 /**
341 * fileFilter
342 */
343 private FileFilter fileFilter;
344
345 /**
346 * fileSystemView
347 */
348 private FileSystemView fileSystemView;
349
350 /**
351 * currentDirectory
352 */
353 private File currentDirectory;
354
355 /**
356 * selectedFile
357 */
358 private File selectedFile;
359
360 /**
361 * selectedFiles
362 */
363 private File[] selectedFiles;
364
365 /**
366 * accessibleContext
367 */
368 protected AccessibleContext accessibleContext;
369
370
371 //-------------------------------------------------------------
372 // Initialization ---------------------------------------------
373 //-------------------------------------------------------------
374
375 /**
376 * Constructor JFileChooser
377 */
378 public JFileChooser() {
379 // TODO
380 } // JFileChooser()
381
382 /**
383 * Constructor JFileChooser
384 * @param currentDirectoryPath TODO
385 */
386 public JFileChooser(String currentDirectoryPath) {
387 // TODO
388 } // JFileChooser()
389
390 /**
391 * Constructor JFileChooser
392 * @param currentDirectory TODO
393 */
394 public JFileChooser(File currentDirectory) {
395 // TODO
396 } // JFileChooser()
397
398 /**
399 * Constructor JFileChooser
400 * @param value0 TODO
401 */
402 public JFileChooser(FileSystemView fsv) {
403 // TODO
404 } // JFileChooser()
405
406 /**
407 * Constructor JFileChooser
408 * @param currentDirectory TODO
409 * @param fsv TODO
410 */
411 public JFileChooser(File currentDirectory, FileSystemView fsv) {
412 // TODO
413 } // JFileChooser()
414
415 /**
416 * Constructor JFileChooser
417 * @param currentDirectoryPath TODO
418 * @param fsv TODO
419 */
420 public JFileChooser(String currentDirectoryPath, FileSystemView fsv) {
421 // TODO
422 } // JFileChooser()
423
424
425 //-------------------------------------------------------------
426 // Methods ----------------------------------------------------
427 //-------------------------------------------------------------
428
429 /**
430 * writeObject
431 * @param stream TODO
432 * @exception IOException TODO
433 */
434 private void writeObject(ObjectOutputStream stream) throws IOException {
435 // TODO
436 } // writeObject()
437
438 /**
439 * getName
440 * @param file TODO
441 * @returns String
442 */
443 public String getName(File file) {
444 return null; // TODO
445 } // getName()
446
447 /**
448 * setup
449 * @param view TODO
450 */
451 protected void setup(FileSystemView view) {
452 // TODO
453 } // setup()
454
455 /**
456 * accept
457 * @param file TODO
458 * @returns boolean
459 */
460 public boolean accept(File file) {
461 return false; // TODO
462 } // accept()
463
464 /**
465 * getSelectedFile
466 * @returns File
467 */
468 public File getSelectedFile() {
469 return null; // TODO
470 } // getSelectedFile()
471
472 /**
473 * setSelectedFile
474 * @param file TODO
475 */
476 public void setSelectedFile(File file) {
477 // TODO
478 } // setSelectedFile()
479
480 /**
481 * getSelectedFiles
482 * @returns File[]
483 */
484 public File[] getSelectedFiles() {
485 return null; // TODO
486 } // getSelectedFiles()
487
488 /**
489 * setSelectedFiles
490 * @param files TODO
491 */
492 public void setSelectedFiles(File[] files) {
493 // TODO
494 } // setSelectedFiles()
495
496 /**
497 * getCurrentDirectory
498 * @returns File
499 */
500 public File getCurrentDirectory() {
501 return null; // TODO
502 } // getCurrentDirectory()
503
504 /**
505 * setCurrentDirectory
506 * @param directory TODO
507 */
508 public void setCurrentDirectory(File directory) {
509 // TODO
510 } // setCurrentDirectory()
511
512 /**
513 * changeToParentDirectory
514 */
515 public void changeToParentDirectory() {
516 // TODO
517 } // changeToParentDirectory()
518
519 /**
520 * rescanCurrentDirectory
521 */
522 public void rescanCurrentDirectory() {
523 // TODO
524 } // rescanCurrentDirectory()
525
526 /**
527 * ensureFileIsVisible
528 * @param file TODO
529 */
530 public void ensureFileIsVisible(File file) {
531 // TODO
532 } // ensureFileIsVisible()
533
534 /**
535 * showOpenDialog
536 * @param parent TODO
537 * @returns int
538 */
539 public int showOpenDialog(Component parent) {
540 return 0; // TODO
541 } // showOpenDialog()
542
543 /**
544 * showSaveDialog
545 * @param parent TODO
546 * @returns int
547 */
548 public int showSaveDialog(Component parent) {
549 return 0; // TODO
550 } // showSaveDialog()
551
552 /**
553 * showDialog
554 * @param parent TODO
555 * @param approveButtonText TODO
556 * @returns int
557 */
558 public int showDialog(Component parent, String approveButtonText) {
559 return 0; // TODO
560 } // showDialog()
561
562 /**
563 * getControlButtonsAreShown
564 * @returns boolean
565 */
566 public boolean getControlButtonsAreShown() {
567 return false; // TODO
568 } // getControlButtonsAreShown()
569
570 /**
571 * setControlButtonsAreShown
572 * @param value TODO
573 */
574 public void setControlButtonsAreShown(boolean value) {
575 // TODO
576 } // setControlButtonsAreShown()
577
578 /**
579 * getDialogType
580 * @returns int
581 */
582 public int getDialogType() {
583 return 0; // TODO
584 } // getDialogType()
585
586 /**
587 * setDialogType
588 * @param type TODO
589 */
590 public void setDialogType(int type) {
591 // TODO
592 } // setDialogType()
593
594 /**
595 * setDialogTitle
596 * @param title TODO
597 */
598 public void setDialogTitle(String title) {
599 // TODO
600 } // setDialogTitle()
601
602 /**
603 * getDialogTitle
604 * @returns String
605 */
606 public String getDialogTitle() {
607 return null; // TODO
608 } // getDialogTitle()
609
610 /**
611 * setApproveButtonToolTipText
612 * @param text TODO
613 */
614 public void setApproveButtonToolTipText(String text) {
615 // TODO
616 } // setApproveButtonToolTipText()
617
618 /**
619 * getApproveButtonToolTipText
620 * @returns String
621 */
622 public String getApproveButtonToolTipText() {
623 return null; // TODO
624 } // getApproveButtonToolTipText()
625
626 /**
627 * getApproveButtonMnemonic
628 * @returns int
629 */
630 public int getApproveButtonMnemonic() {
631 return 0; // TODO
632 } // getApproveButtonMnemonic()
633
634 /**
635 * setApproveButtonMnemonic
636 * @param mnemonic TODO
637 */
638 public void setApproveButtonMnemonic(int mnemonic) {
639 // TODO
640 } // setApproveButtonMnemonic()
641
642 /**
643 * setApproveButtonMnemonic
644 * @param mnemonic TODO
645 */
646 public void setApproveButtonMnemonic(char mnemonic) {
647 // TODO
648 } // setApproveButtonMnemonic()
649
650 /**
651 * setApproveButtonText
652 * @param text TODO
653 */
654 public void setApproveButtonText(String text) {
655 // TODO
656 } // setApproveButtonText()
657
658 /**
659 * getApproveButtonText
660 * @returns String
661 */
662 public String getApproveButtonText() {
663 return null; // TODO
664 } // getApproveButtonText()
665
666 /**
667 * getChoosableFileFilters
668 * @returns FileFilter[]
669 */
670 public FileFilter[] getChoosableFileFilters() {
671 return null; // TODO
672 } // getChoosableFileFilters()
673
674 /**
675 * addChoosableFileFilter
676 * @param filter TODO
677 */
678 public void addChoosableFileFilter(FileFilter filter) {
679 // TODO
680 } // addChoosableFileFilter()
681
682 /**
683 * removeChoosableFileFilter
684 * @param filter TODO
685 * @returns boolean
686 */
687 public boolean removeChoosableFileFilter(FileFilter filter) {
688 return false; // TODO
689 } // removeChoosableFileFilter()
690
691 /**
692 * resetChoosableFileFilters
693 */
694 public void resetChoosableFileFilters() {
695 // TODO
696 } // resetChoosableFileFilters()
697
698 /**
699 * getAcceptAllFileFilter
700 * @returns FileFilter
701 */
702 public FileFilter getAcceptAllFileFilter() {
703 return null; // TODO
704 } // getAcceptAllFileFilter()
705
706 /**
707 * isAcceptAllFileFilterUsed
708 * @returns boolean
709 */
710 public boolean isAcceptAllFileFilterUsed() {
711 return false; // TODO
712 } // isAcceptAllFileFilterUsed()
713
714 /**
715 * setAcceptAllFileFilterUsed
716 * @param value TODO
717 */
718 public void setAcceptAllFileFilterUsed(boolean value) {
719 // TODO
720 } // setAcceptAllFileFilterUsed()
721
722 /**
723 * getAccessory
724 * @returns JComponent
725 */
726 public JComponent getAccessory() {
727 return null; // TODO
728 } // getAccessory()
729
730 /**
731 * setAccessory
732 * @param accessory TODO
733 */
734 public void setAccessory(JComponent accessory) {
735 // TODO
736 } // setAccessory()
737
738 /**
739 * setFileSelectionMode
740 * @param mode TODO
741 */
742 public void setFileSelectionMode(int mode) {
743 // TODO
744 } // setFileSelectionMode()
745
746 /**
747 * getFileSelectionMode
748 * @returns int
749 */
750 public int getFileSelectionMode() {
751 return 0; // TODO
752 } // getFileSelectionMode()
753
754 /**
755 * isFileSelectionEnabled
756 * @returns boolean
757 */
758 public boolean isFileSelectionEnabled() {
759 return false; // TODO
760 } // isFileSelectionEnabled()
761
762 /**
763 * isDirectorySelectionEnabled
764 * @returns boolean
765 */
766 public boolean isDirectorySelectionEnabled() {
767 return false; // TODO
768 } // isDirectorySelectionEnabled()
769
770 /**
771 * isMultiSelectionEnabled
772 * @returns boolean
773 */
774 public boolean isMultiSelectionEnabled() {
775 return false; // TODO
776 } // isMultiSelectionEnabled()
777
778 /**
779 * setMultiSelectionEnabled
780 * @param enabled TODO
781 */
782 public void setMultiSelectionEnabled(boolean enabled) {
783 // TODO
784 } // setMultiSelectionEnabled()
785
786 /**
787 * isFileHidingEnabled
788 * @returns boolean
789 */
790 public boolean isFileHidingEnabled() {
791 return false; // TODO
792 } // isFileHidingEnabled()
793
794 /**
795 * setFileHidingEnabled
796 * @param enabled TODO
797 */
798 public void setFileHidingEnabled(boolean enabled) {
799 // TODO
800 } // setFileHidingEnabled()
801
802 /**
803 * getFileFilter
804 * @returns FileFilter
805 */
806 public FileFilter getFileFilter() {
807 return null; // TODO
808 } // getFileFilter()
809
810 /**
811 * setFileFilter
812 * @param filter TODO
813 */
814 public void setFileFilter(FileFilter filter) {
815 // TODO
816 } // setFileFilter()
817
818 /**
819 * getFileView
820 * @returns FileView
821 */
822 public FileView getFileView() {
823 return null; // TODO
824 } // getFileView()
825
826 /**
827 * setFileView
828 * @param view TODO
829 */
830 public void setFileView(FileView view) {
831 // TODO
832 } // setFileView()
833
834 /**
835 * getDescription
836 * @param file TODO
837 * @returns String
838 */
839 public String getDescription(File file) {
840 return null; // TODO
841 } // getDescription()
842
843 /**
844 * getTypeDescription
845 * @param file TODO
846 * @returns String
847 */
848 public String getTypeDescription(File file) {
849 return null; // TODO
850 } // getTypeDescription()
851
852 /**
853 * getIcon
854 * @param file TODO
855 * @returns Icon
856 */
857 public Icon getIcon(File file) {
858 return null; // TODO
859 } // getIcon()
860
861 /**
862 * isTraversable
863 * @param file TODO
864 * @returns boolean
865 */
866 public boolean isTraversable(File file) {
867 return false; // TODO
868 } // isTraversable()
869
870 /**
871 * getFileSystemView
872 * @returns FileSystemView
873 */
874 public FileSystemView getFileSystemView() {
875 return null; // TODO
876 } // getFileSystemView()
877
878 /**
879 * setFileSystemView
880 * @param fsv TODO
881 */
882 public void setFileSystemView(FileSystemView fsv) {
883 // TODO
884 } // setFileSystemView()
885
886 /**
887 * approveSelection
888 */
889 public void approveSelection() {
890 // TODO
891 } // approveSelection()
892
893 /**
894 * cancelSelection
895 */
896 public void cancelSelection() {
897 // TODO
898 } // cancelSelection()
899
900 /**
901 * addActionListener
902 * @param listener TODO
903 */
904 public void addActionListener(ActionListener listener) {
905 // TODO
906 } // addActionListener()
907
908 /**
909 * removeActionListener
910 * @param listener TODO
911 */
912 public void removeActionListener(ActionListener listener) {
913 // TODO
914 } // removeActionListener()
915
916 /**
917 * fireActionPerformed
918 * @param command TODO
919 */
920 protected void fireActionPerformed(String command) {
921 // TODO
922 } // fireActionPerformed()
923
924 /**
925 * updateUI
926 */
927 public void updateUI() {
928 setUI((FileChooserUI) UIManager.get(this));
929 invalidate();
930 } // updateUI()
931
932 /**
933 * getUIClassID
934 * @returns String
935 */
936 public String getUIClassID() {
937 return uiClassID;
938 } // getUIClassID()
939
940 /**
941 * getUI
942 * @returns FileChooserUI
943 */
944 public FileChooserUI getUI() {
945 return (FileChooserUI) ui;
946 } // getUI()
947
948 /**
949 * paramString
950 * @returns String
951 */
952 protected String paramString() {
953 return null; // TODO
954 } // paramString()
955
956 /**
957 * getAccessibleContext
958 * @returns AccessibleContext
959 */
960 public AccessibleContext getAccessibleContext() {
961 if (accessibleContext == null) {
962 accessibleContext = new AccessibleJFileChooser(this);
963 } // if
964 return accessibleContext;
965 } // getAccessibleContext()
966
967
968} // JFileChooser
Note: See TracBrowser for help on using the repository browser.