home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / swing / JFileChooser.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  16.6 KB  |  873 lines

  1. package javax.swing;
  2.  
  3. import java.awt.AWTEvent;
  4. import java.awt.BorderLayout;
  5. import java.awt.Component;
  6. import java.awt.Container;
  7. import java.awt.Dialog;
  8. import java.awt.EventQueue;
  9. import java.awt.Frame;
  10. import java.awt.GraphicsEnvironment;
  11. import java.awt.HeadlessException;
  12. import java.awt.Toolkit;
  13. import java.awt.Window;
  14. import java.awt.event.ActionEvent;
  15. import java.awt.event.ActionListener;
  16. import java.awt.event.InputEvent;
  17. import java.beans.PropertyChangeListener;
  18. import java.io.File;
  19. import java.io.IOException;
  20. import java.io.ObjectInputStream;
  21. import java.io.ObjectOutputStream;
  22. import java.util.Vector;
  23. import javax.accessibility.Accessible;
  24. import javax.accessibility.AccessibleContext;
  25. import javax.swing.filechooser.FileFilter;
  26. import javax.swing.filechooser.FileSystemView;
  27. import javax.swing.filechooser.FileView;
  28. import javax.swing.plaf.FileChooserUI;
  29.  
  30. public class JFileChooser extends JComponent implements Accessible {
  31.    private static final String uiClassID = "FileChooserUI";
  32.    public static final int OPEN_DIALOG = 0;
  33.    public static final int SAVE_DIALOG = 1;
  34.    public static final int CUSTOM_DIALOG = 2;
  35.    public static final int CANCEL_OPTION = 1;
  36.    public static final int APPROVE_OPTION = 0;
  37.    public static final int ERROR_OPTION = -1;
  38.    public static final int FILES_ONLY = 0;
  39.    public static final int DIRECTORIES_ONLY = 1;
  40.    public static final int FILES_AND_DIRECTORIES = 2;
  41.    public static final String CANCEL_SELECTION = "CancelSelection";
  42.    public static final String APPROVE_SELECTION = "ApproveSelection";
  43.    public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY = "ApproveButtonTextChangedProperty";
  44.    public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY = "ApproveButtonToolTipTextChangedProperty";
  45.    public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY = "ApproveButtonMnemonicChangedProperty";
  46.    public static final String CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY = "ControlButtonsAreShownChangedProperty";
  47.    public static final String DIRECTORY_CHANGED_PROPERTY = "directoryChanged";
  48.    public static final String SELECTED_FILE_CHANGED_PROPERTY = "SelectedFileChangedProperty";
  49.    public static final String SELECTED_FILES_CHANGED_PROPERTY = "SelectedFilesChangedProperty";
  50.    public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY = "MultiSelectionEnabledChangedProperty";
  51.    public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY = "FileSystemViewChanged";
  52.    public static final String FILE_VIEW_CHANGED_PROPERTY = "fileViewChanged";
  53.    public static final String FILE_HIDING_CHANGED_PROPERTY = "FileHidingChanged";
  54.    public static final String FILE_FILTER_CHANGED_PROPERTY = "fileFilterChanged";
  55.    public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY = "fileSelectionChanged";
  56.    public static final String ACCESSORY_CHANGED_PROPERTY = "AccessoryChangedProperty";
  57.    public static final String ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY = "acceptAllFileFilterUsedChanged";
  58.    public static final String DIALOG_TITLE_CHANGED_PROPERTY = "DialogTitleChangedProperty";
  59.    public static final String DIALOG_TYPE_CHANGED_PROPERTY = "DialogTypeChangedProperty";
  60.    public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY = "ChoosableFileFilterChangedProperty";
  61.    private String dialogTitle;
  62.    private String approveButtonText;
  63.    private String approveButtonToolTipText;
  64.    private int approveButtonMnemonic;
  65.    private ActionListener actionListener;
  66.    private Vector filters;
  67.    private JDialog dialog;
  68.    private int dialogType;
  69.    private int returnValue;
  70.    private JComponent accessory;
  71.    private FileView fileView;
  72.    private transient FileView uiFileView;
  73.    private boolean controlsShown;
  74.    private boolean useFileHiding;
  75.    private static final String SHOW_HIDDEN_PROP = "awt.file.showHiddenFiles";
  76.    private transient PropertyChangeListener showFilesListener;
  77.    private int fileSelectionMode;
  78.    private boolean multiSelectionEnabled;
  79.    private boolean useAcceptAllFileFilter;
  80.    private boolean dragEnabled;
  81.    private FileFilter fileFilter;
  82.    private FileSystemView fileSystemView;
  83.    private File currentDirectory;
  84.    private File selectedFile;
  85.    private File[] selectedFiles;
  86.    protected AccessibleContext accessibleContext;
  87.  
  88.    public JFileChooser() {
  89.       this((File)null, (FileSystemView)null);
  90.    }
  91.  
  92.    public JFileChooser(String var1) {
  93.       this(var1, (FileSystemView)null);
  94.    }
  95.  
  96.    public JFileChooser(File var1) {
  97.       this(var1, (FileSystemView)null);
  98.    }
  99.  
  100.    public JFileChooser(FileSystemView var1) {
  101.       this((File)null, var1);
  102.    }
  103.  
  104.    public JFileChooser(File var1, FileSystemView var2) {
  105.       this.dialogTitle = null;
  106.       this.approveButtonText = null;
  107.       this.approveButtonToolTipText = null;
  108.       this.approveButtonMnemonic = 0;
  109.       this.actionListener = null;
  110.       this.filters = new Vector(5);
  111.       this.dialog = null;
  112.       this.dialogType = 0;
  113.       this.returnValue = -1;
  114.       this.accessory = null;
  115.       this.fileView = null;
  116.       this.uiFileView = null;
  117.       this.controlsShown = true;
  118.       this.useFileHiding = true;
  119.       this.showFilesListener = null;
  120.       this.fileSelectionMode = 0;
  121.       this.multiSelectionEnabled = false;
  122.       this.useAcceptAllFileFilter = true;
  123.       this.dragEnabled = false;
  124.       this.fileFilter = null;
  125.       this.fileSystemView = null;
  126.       this.currentDirectory = null;
  127.       this.selectedFile = null;
  128.       this.accessibleContext = null;
  129.       this.setup(var2);
  130.       this.setCurrentDirectory(var1);
  131.    }
  132.  
  133.    public JFileChooser(String var1, FileSystemView var2) {
  134.       this.dialogTitle = null;
  135.       this.approveButtonText = null;
  136.       this.approveButtonToolTipText = null;
  137.       this.approveButtonMnemonic = 0;
  138.       this.actionListener = null;
  139.       this.filters = new Vector(5);
  140.       this.dialog = null;
  141.       this.dialogType = 0;
  142.       this.returnValue = -1;
  143.       this.accessory = null;
  144.       this.fileView = null;
  145.       this.uiFileView = null;
  146.       this.controlsShown = true;
  147.       this.useFileHiding = true;
  148.       this.showFilesListener = null;
  149.       this.fileSelectionMode = 0;
  150.       this.multiSelectionEnabled = false;
  151.       this.useAcceptAllFileFilter = true;
  152.       this.dragEnabled = false;
  153.       this.fileFilter = null;
  154.       this.fileSystemView = null;
  155.       this.currentDirectory = null;
  156.       this.selectedFile = null;
  157.       this.accessibleContext = null;
  158.       this.setup(var2);
  159.       if (var1 == null) {
  160.          this.setCurrentDirectory((File)null);
  161.       } else {
  162.          this.setCurrentDirectory(this.fileSystemView.createFileObject(var1));
  163.       }
  164.  
  165.    }
  166.  
  167.    protected void setup(FileSystemView var1) {
  168.       this.installShowFilesListener();
  169.       if (var1 == null) {
  170.          var1 = FileSystemView.getFileSystemView();
  171.       }
  172.  
  173.       this.setFileSystemView(var1);
  174.       this.updateUI();
  175.       if (this.isAcceptAllFileFilterUsed()) {
  176.          this.setFileFilter(this.getAcceptAllFileFilter());
  177.       }
  178.  
  179.       this.enableEvents(16L);
  180.    }
  181.  
  182.    private void installShowFilesListener() {
  183.       Toolkit var1 = Toolkit.getDefaultToolkit();
  184.       Object var2 = var1.getDesktopProperty("awt.file.showHiddenFiles");
  185.       if (var2 instanceof Boolean) {
  186.          this.useFileHiding = !(Boolean)var2;
  187.          this.showFilesListener = new WeakPCL(this);
  188.          var1.addPropertyChangeListener("awt.file.showHiddenFiles", this.showFilesListener);
  189.       }
  190.  
  191.    }
  192.  
  193.    public void setDragEnabled(boolean var1) {
  194.       if (var1 && GraphicsEnvironment.isHeadless()) {
  195.          throw new HeadlessException();
  196.       } else {
  197.          this.dragEnabled = var1;
  198.       }
  199.    }
  200.  
  201.    public boolean getDragEnabled() {
  202.       return this.dragEnabled;
  203.    }
  204.  
  205.    public File getSelectedFile() {
  206.       return this.selectedFile;
  207.    }
  208.  
  209.    public void setSelectedFile(File var1) {
  210.       File var2 = this.selectedFile;
  211.       this.selectedFile = var1;
  212.       if (this.selectedFile != null) {
  213.          if (var1.isAbsolute() && !this.getFileSystemView().isParent(this.getCurrentDirectory(), this.selectedFile)) {
  214.             this.setCurrentDirectory(this.selectedFile.getParentFile());
  215.          }
  216.  
  217.          if (!this.isMultiSelectionEnabled() || this.selectedFiles == null || this.selectedFiles.length == 1) {
  218.             this.ensureFileIsVisible(this.selectedFile);
  219.          }
  220.       }
  221.  
  222.       this.firePropertyChange("SelectedFileChangedProperty", var2, this.selectedFile);
  223.    }
  224.  
  225.    public File[] getSelectedFiles() {
  226.       return this.selectedFiles == null ? new File[0] : (File[])((File[])this.selectedFiles.clone());
  227.    }
  228.  
  229.    public void setSelectedFiles(File[] var1) {
  230.       File[] var2 = this.selectedFiles;
  231.       if (var1 != null && var1.length == 0) {
  232.          var1 = null;
  233.       }
  234.  
  235.       this.selectedFiles = var1;
  236.       this.setSelectedFile(var1 != null ? var1[0] : null);
  237.       this.firePropertyChange("SelectedFilesChangedProperty", var2, this.selectedFiles);
  238.    }
  239.  
  240.    public File getCurrentDirectory() {
  241.       return this.currentDirectory;
  242.    }
  243.  
  244.    public void setCurrentDirectory(File var1) {
  245.       File var2 = this.currentDirectory;
  246.       if (var1 != null && !var1.exists()) {
  247.          var1 = this.currentDirectory;
  248.       }
  249.  
  250.       if (var1 == null) {
  251.          var1 = this.getFileSystemView().getDefaultDirectory();
  252.       }
  253.  
  254.       if (this.currentDirectory == null || !this.currentDirectory.equals(var1)) {
  255.          for(File var3 = null; !this.isTraversable(var1) && var3 != var1; var1 = this.getFileSystemView().getParentDirectory(var1)) {
  256.             var3 = var1;
  257.          }
  258.  
  259.          this.currentDirectory = var1;
  260.          this.firePropertyChange("directoryChanged", var2, this.currentDirectory);
  261.       }
  262.    }
  263.  
  264.    public void changeToParentDirectory() {
  265.       this.selectedFile = null;
  266.       File var1 = this.getCurrentDirectory();
  267.       this.setCurrentDirectory(this.getFileSystemView().getParentDirectory(var1));
  268.    }
  269.  
  270.    public void rescanCurrentDirectory() {
  271.       this.getUI().rescanCurrentDirectory(this);
  272.    }
  273.  
  274.    public void ensureFileIsVisible(File var1) {
  275.       this.getUI().ensureFileIsVisible(this, var1);
  276.    }
  277.  
  278.    public int showOpenDialog(Component var1) throws HeadlessException {
  279.       this.setDialogType(0);
  280.       return this.showDialog(var1, (String)null);
  281.    }
  282.  
  283.    public int showSaveDialog(Component var1) throws HeadlessException {
  284.       this.setDialogType(1);
  285.       return this.showDialog(var1, (String)null);
  286.    }
  287.  
  288.    public int showDialog(Component var1, String var2) throws HeadlessException {
  289.       if (var2 != null) {
  290.          this.setApproveButtonText(var2);
  291.          this.setDialogType(2);
  292.       }
  293.  
  294.       this.dialog = this.createDialog(var1);
  295.       this.dialog.addWindowListener(new 1(this));
  296.       this.returnValue = -1;
  297.       this.rescanCurrentDirectory();
  298.       this.dialog.show();
  299.       this.firePropertyChange("JFileChooserDialogIsClosingProperty", this.dialog, (Object)null);
  300.       this.dialog.dispose();
  301.       this.dialog = null;
  302.       return this.returnValue;
  303.    }
  304.  
  305.    protected JDialog createDialog(Component var1) throws HeadlessException {
  306.       String var2 = this.getUI().getDialogTitle(this);
  307.       this.putClientProperty("AccessibleDescription", var2);
  308.       Window var4 = JOptionPane.getWindowForComponent(var1);
  309.       JDialog var3;
  310.       if (var4 instanceof Frame) {
  311.          var3 = new JDialog((Frame)var4, var2, true);
  312.       } else {
  313.          var3 = new JDialog((Dialog)var4, var2, true);
  314.       }
  315.  
  316.       var3.setComponentOrientation(this.getComponentOrientation());
  317.       Container var5 = var3.getContentPane();
  318.       var5.setLayout(new BorderLayout());
  319.       var5.add(this, "Center");
  320.       if (JDialog.isDefaultLookAndFeelDecorated()) {
  321.          boolean var6 = UIManager.getLookAndFeel().getSupportsWindowDecorations();
  322.          if (var6) {
  323.             var3.getRootPane().setWindowDecorationStyle(6);
  324.          }
  325.       }
  326.  
  327.       var3.pack();
  328.       var3.setLocationRelativeTo(var1);
  329.       return var3;
  330.    }
  331.  
  332.    public boolean getControlButtonsAreShown() {
  333.       return this.controlsShown;
  334.    }
  335.  
  336.    public void setControlButtonsAreShown(boolean var1) {
  337.       if (this.controlsShown != var1) {
  338.          boolean var2 = this.controlsShown;
  339.          this.controlsShown = var1;
  340.          this.firePropertyChange("ControlButtonsAreShownChangedProperty", var2, this.controlsShown);
  341.       }
  342.    }
  343.  
  344.    public int getDialogType() {
  345.       return this.dialogType;
  346.    }
  347.  
  348.    public void setDialogType(int var1) {
  349.       if (this.dialogType != var1) {
  350.          if (var1 != 0 && var1 != 1 && var1 != 2) {
  351.             throw new IllegalArgumentException("Incorrect Dialog Type: " + var1);
  352.          } else {
  353.             int var2 = this.dialogType;
  354.             this.dialogType = var1;
  355.             if (var1 == 0 || var1 == 1) {
  356.                this.setApproveButtonText((String)null);
  357.             }
  358.  
  359.             this.firePropertyChange("DialogTypeChangedProperty", var2, var1);
  360.          }
  361.       }
  362.    }
  363.  
  364.    public void setDialogTitle(String var1) {
  365.       String var2 = this.dialogTitle;
  366.       this.dialogTitle = var1;
  367.       if (this.dialog != null) {
  368.          this.dialog.setTitle(var1);
  369.       }
  370.  
  371.       this.firePropertyChange("DialogTitleChangedProperty", var2, var1);
  372.    }
  373.  
  374.    public String getDialogTitle() {
  375.       return this.dialogTitle;
  376.    }
  377.  
  378.    public void setApproveButtonToolTipText(String var1) {
  379.       if (this.approveButtonToolTipText != var1) {
  380.          String var2 = this.approveButtonToolTipText;
  381.          this.approveButtonToolTipText = var1;
  382.          this.firePropertyChange("ApproveButtonToolTipTextChangedProperty", var2, this.approveButtonToolTipText);
  383.       }
  384.    }
  385.  
  386.    public String getApproveButtonToolTipText() {
  387.       return this.approveButtonToolTipText;
  388.    }
  389.  
  390.    public int getApproveButtonMnemonic() {
  391.       return this.approveButtonMnemonic;
  392.    }
  393.  
  394.    public void setApproveButtonMnemonic(int var1) {
  395.       if (this.approveButtonMnemonic != var1) {
  396.          int var2 = this.approveButtonMnemonic;
  397.          this.approveButtonMnemonic = var1;
  398.          this.firePropertyChange("ApproveButtonMnemonicChangedProperty", var2, this.approveButtonMnemonic);
  399.       }
  400.    }
  401.  
  402.    public void setApproveButtonMnemonic(char var1) {
  403.       int var2 = var1;
  404.       if (var1 >= 'a' && var1 <= 'z') {
  405.          var2 = var1 - 32;
  406.       }
  407.  
  408.       this.setApproveButtonMnemonic(var2);
  409.    }
  410.  
  411.    public void setApproveButtonText(String var1) {
  412.       if (this.approveButtonText != var1) {
  413.          String var2 = this.approveButtonText;
  414.          this.approveButtonText = var1;
  415.          this.firePropertyChange("ApproveButtonTextChangedProperty", var2, var1);
  416.       }
  417.    }
  418.  
  419.    public String getApproveButtonText() {
  420.       return this.approveButtonText;
  421.    }
  422.  
  423.    public FileFilter[] getChoosableFileFilters() {
  424.       FileFilter[] var1 = new FileFilter[this.filters.size()];
  425.       this.filters.copyInto(var1);
  426.       return var1;
  427.    }
  428.  
  429.    public void addChoosableFileFilter(FileFilter var1) {
  430.       if (var1 != null && !this.filters.contains(var1)) {
  431.          FileFilter[] var2 = this.getChoosableFileFilters();
  432.          this.filters.addElement(var1);
  433.          this.firePropertyChange("ChoosableFileFilterChangedProperty", var2, this.getChoosableFileFilters());
  434.       }
  435.  
  436.       this.setFileFilter(var1);
  437.    }
  438.  
  439.    public boolean removeChoosableFileFilter(FileFilter var1) {
  440.       if (this.filters.contains(var1)) {
  441.          if (this.getFileFilter() == var1) {
  442.             this.setFileFilter((FileFilter)null);
  443.          }
  444.  
  445.          FileFilter[] var2 = this.getChoosableFileFilters();
  446.          this.filters.removeElement(var1);
  447.          this.firePropertyChange("ChoosableFileFilterChangedProperty", var2, this.getChoosableFileFilters());
  448.          return true;
  449.       } else {
  450.          return false;
  451.       }
  452.    }
  453.  
  454.    public void resetChoosableFileFilters() {
  455.       FileFilter[] var1 = this.getChoosableFileFilters();
  456.       this.setFileFilter((FileFilter)null);
  457.       this.filters.removeAllElements();
  458.       if (this.isAcceptAllFileFilterUsed()) {
  459.          this.addChoosableFileFilter(this.getAcceptAllFileFilter());
  460.       }
  461.  
  462.       this.firePropertyChange("ChoosableFileFilterChangedProperty", var1, this.getChoosableFileFilters());
  463.    }
  464.  
  465.    public FileFilter getAcceptAllFileFilter() {
  466.       FileFilter var1 = null;
  467.       if (this.getUI() != null) {
  468.          var1 = this.getUI().getAcceptAllFileFilter(this);
  469.       }
  470.  
  471.       return var1;
  472.    }
  473.  
  474.    public boolean isAcceptAllFileFilterUsed() {
  475.       return this.useAcceptAllFileFilter;
  476.    }
  477.  
  478.    public void setAcceptAllFileFilterUsed(boolean var1) {
  479.       boolean var2 = this.useAcceptAllFileFilter;
  480.       this.useAcceptAllFileFilter = var1;
  481.       if (!var1) {
  482.          this.removeChoosableFileFilter(this.getAcceptAllFileFilter());
  483.       } else {
  484.          this.removeChoosableFileFilter(this.getAcceptAllFileFilter());
  485.          this.addChoosableFileFilter(this.getAcceptAllFileFilter());
  486.       }
  487.  
  488.       this.firePropertyChange("acceptAllFileFilterUsedChanged", var2, this.useAcceptAllFileFilter);
  489.    }
  490.  
  491.    public JComponent getAccessory() {
  492.       return this.accessory;
  493.    }
  494.  
  495.    public void setAccessory(JComponent var1) {
  496.       JComponent var2 = this.accessory;
  497.       this.accessory = var1;
  498.       this.firePropertyChange("AccessoryChangedProperty", var2, this.accessory);
  499.    }
  500.  
  501.    public void setFileSelectionMode(int var1) {
  502.       if (this.fileSelectionMode != var1) {
  503.          if (var1 != 0 && var1 != 1 && var1 != 2) {
  504.             throw new IllegalArgumentException("Incorrect Mode for file selection: " + var1);
  505.          } else {
  506.             int var2 = this.fileSelectionMode;
  507.             this.fileSelectionMode = var1;
  508.             this.firePropertyChange("fileSelectionChanged", var2, this.fileSelectionMode);
  509.          }
  510.       }
  511.    }
  512.  
  513.    public int getFileSelectionMode() {
  514.       return this.fileSelectionMode;
  515.    }
  516.  
  517.    public boolean isFileSelectionEnabled() {
  518.       return this.fileSelectionMode == 0 || this.fileSelectionMode == 2;
  519.    }
  520.  
  521.    public boolean isDirectorySelectionEnabled() {
  522.       return this.fileSelectionMode == 1 || this.fileSelectionMode == 2;
  523.    }
  524.  
  525.    public void setMultiSelectionEnabled(boolean var1) {
  526.       if (this.multiSelectionEnabled != var1) {
  527.          boolean var2 = this.multiSelectionEnabled;
  528.          this.multiSelectionEnabled = var1;
  529.          this.firePropertyChange("MultiSelectionEnabledChangedProperty", var2, this.multiSelectionEnabled);
  530.       }
  531.    }
  532.  
  533.    public boolean isMultiSelectionEnabled() {
  534.       return this.multiSelectionEnabled;
  535.    }
  536.  
  537.    public boolean isFileHidingEnabled() {
  538.       return this.useFileHiding;
  539.    }
  540.  
  541.    public void setFileHidingEnabled(boolean var1) {
  542.       if (this.showFilesListener != null) {
  543.          Toolkit.getDefaultToolkit().removePropertyChangeListener("awt.file.showHiddenFiles", this.showFilesListener);
  544.          this.showFilesListener = null;
  545.       }
  546.  
  547.       boolean var2 = this.useFileHiding;
  548.       this.useFileHiding = var1;
  549.       this.firePropertyChange("FileHidingChanged", var2, this.useFileHiding);
  550.    }
  551.  
  552.    public void setFileFilter(FileFilter var1) {
  553.       FileFilter var2 = this.fileFilter;
  554.       this.fileFilter = var1;
  555.       if (var1 != null) {
  556.          if (this.isMultiSelectionEnabled() && this.selectedFiles != null && this.selectedFiles.length > 0) {
  557.             Vector var3 = new Vector();
  558.             boolean var4 = false;
  559.  
  560.             for(int var5 = 0; var5 < this.selectedFiles.length; ++var5) {
  561.                if (var1.accept(this.selectedFiles[var5])) {
  562.                   var3.add(this.selectedFiles[var5]);
  563.                } else {
  564.                   var4 = true;
  565.                }
  566.             }
  567.  
  568.             if (var4) {
  569.                this.setSelectedFiles(var3.size() == 0 ? null : (File[])((File[])var3.toArray(new File[var3.size()])));
  570.             }
  571.          } else if (this.selectedFile != null && !var1.accept(this.selectedFile)) {
  572.             this.setSelectedFile((File)null);
  573.          }
  574.       }
  575.  
  576.       this.firePropertyChange("fileFilterChanged", var2, this.fileFilter);
  577.    }
  578.  
  579.    public FileFilter getFileFilter() {
  580.       return this.fileFilter;
  581.    }
  582.  
  583.    public void setFileView(FileView var1) {
  584.       FileView var2 = this.fileView;
  585.       this.fileView = var1;
  586.       this.firePropertyChange("fileViewChanged", var2, var1);
  587.    }
  588.  
  589.    public FileView getFileView() {
  590.       return this.fileView;
  591.    }
  592.  
  593.    public String getName(File var1) {
  594.       String var2 = null;
  595.       if (var1 != null) {
  596.          if (this.getFileView() != null) {
  597.             var2 = this.getFileView().getName(var1);
  598.          }
  599.  
  600.          if (var2 == null && this.uiFileView != null) {
  601.             var2 = this.uiFileView.getName(var1);
  602.          }
  603.       }
  604.  
  605.       return var2;
  606.    }
  607.  
  608.    public String getDescription(File var1) {
  609.       String var2 = null;
  610.       if (var1 != null) {
  611.          if (this.getFileView() != null) {
  612.             var2 = this.getFileView().getDescription(var1);
  613.          }
  614.  
  615.          if (var2 == null && this.uiFileView != null) {
  616.             var2 = this.uiFileView.getDescription(var1);
  617.          }
  618.       }
  619.  
  620.       return var2;
  621.    }
  622.  
  623.    public String getTypeDescription(File var1) {
  624.       String var2 = null;
  625.       if (var1 != null) {
  626.          if (this.getFileView() != null) {
  627.             var2 = this.getFileView().getTypeDescription(var1);
  628.          }
  629.  
  630.          if (var2 == null && this.uiFileView != null) {
  631.             var2 = this.uiFileView.getTypeDescription(var1);
  632.          }
  633.       }
  634.  
  635.       return var2;
  636.    }
  637.  
  638.    public Icon getIcon(File var1) {
  639.       Icon var2 = null;
  640.       if (var1 != null) {
  641.          if (this.getFileView() != null) {
  642.             var2 = this.getFileView().getIcon(var1);
  643.          }
  644.  
  645.          if (var2 == null && this.uiFileView != null) {
  646.             var2 = this.uiFileView.getIcon(var1);
  647.          }
  648.       }
  649.  
  650.       return var2;
  651.    }
  652.  
  653.    public boolean isTraversable(File var1) {
  654.       Boolean var2 = null;
  655.       if (var1 != null) {
  656.          if (this.getFileView() != null) {
  657.             var2 = this.getFileView().isTraversable(var1);
  658.          }
  659.  
  660.          if (var2 == null && this.uiFileView != null) {
  661.             var2 = this.uiFileView.isTraversable(var1);
  662.          }
  663.  
  664.          if (var2 == null) {
  665.             var2 = this.getFileSystemView().isTraversable(var1);
  666.          }
  667.       }
  668.  
  669.       return var2 != null && var2;
  670.    }
  671.  
  672.    public boolean accept(File var1) {
  673.       boolean var2 = true;
  674.       if (var1 != null && this.fileFilter != null) {
  675.          var2 = this.fileFilter.accept(var1);
  676.       }
  677.  
  678.       return var2;
  679.    }
  680.  
  681.    public void setFileSystemView(FileSystemView var1) {
  682.       FileSystemView var2 = this.fileSystemView;
  683.       this.fileSystemView = var1;
  684.       this.firePropertyChange("FileSystemViewChanged", var2, this.fileSystemView);
  685.    }
  686.  
  687.    public FileSystemView getFileSystemView() {
  688.       return this.fileSystemView;
  689.    }
  690.  
  691.    public void approveSelection() {
  692.       this.returnValue = 0;
  693.       if (this.dialog != null) {
  694.          this.dialog.setVisible(false);
  695.       }
  696.  
  697.       this.fireActionPerformed("ApproveSelection");
  698.    }
  699.  
  700.    public void cancelSelection() {
  701.       this.returnValue = 1;
  702.       if (this.dialog != null) {
  703.          this.dialog.setVisible(false);
  704.       }
  705.  
  706.       this.fireActionPerformed("CancelSelection");
  707.    }
  708.  
  709.    public void addActionListener(ActionListener var1) {
  710.       this.listenerList.add(ActionListener.class, var1);
  711.    }
  712.  
  713.    public void removeActionListener(ActionListener var1) {
  714.       this.listenerList.remove(ActionListener.class, var1);
  715.    }
  716.  
  717.    public ActionListener[] getActionListeners() {
  718.       return (ActionListener[])this.listenerList.getListeners(ActionListener.class);
  719.    }
  720.  
  721.    protected void fireActionPerformed(String var1) {
  722.       Object[] var2 = this.listenerList.getListenerList();
  723.       long var3 = EventQueue.getMostRecentEventTime();
  724.       int var5 = 0;
  725.       AWTEvent var6 = EventQueue.getCurrentEvent();
  726.       if (var6 instanceof InputEvent) {
  727.          var5 = ((InputEvent)var6).getModifiers();
  728.       } else if (var6 instanceof ActionEvent) {
  729.          var5 = ((ActionEvent)var6).getModifiers();
  730.       }
  731.  
  732.       ActionEvent var7 = null;
  733.  
  734.       for(int var8 = var2.length - 2; var8 >= 0; var8 -= 2) {
  735.          if (var2[var8] == ActionListener.class) {
  736.             if (var7 == null) {
  737.                var7 = new ActionEvent(this, 1001, var1, var3, var5);
  738.             }
  739.  
  740.             ((ActionListener)var2[var8 + 1]).actionPerformed(var7);
  741.          }
  742.       }
  743.  
  744.    }
  745.  
  746.    public void updateUI() {
  747.       if (this.isAcceptAllFileFilterUsed()) {
  748.          this.removeChoosableFileFilter(this.getAcceptAllFileFilter());
  749.       }
  750.  
  751.       FileChooserUI var1 = (FileChooserUI)UIManager.getUI(this);
  752.       if (this.fileSystemView == null) {
  753.          this.setFileSystemView(FileSystemView.getFileSystemView());
  754.       }
  755.  
  756.       this.setUI(var1);
  757.       this.uiFileView = this.getUI().getFileView(this);
  758.       if (this.isAcceptAllFileFilterUsed()) {
  759.          this.addChoosableFileFilter(this.getAcceptAllFileFilter());
  760.       }
  761.  
  762.    }
  763.  
  764.    public String getUIClassID() {
  765.       return "FileChooserUI";
  766.    }
  767.  
  768.    public FileChooserUI getUI() {
  769.       return (FileChooserUI)this.ui;
  770.    }
  771.  
  772.    private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
  773.       var1.defaultReadObject();
  774.       this.installShowFilesListener();
  775.    }
  776.  
  777.    private void writeObject(ObjectOutputStream var1) throws IOException {
  778.       FileSystemView var2 = null;
  779.       if (this.isAcceptAllFileFilterUsed()) {
  780.          this.removeChoosableFileFilter(this.getAcceptAllFileFilter());
  781.       }
  782.  
  783.       if (this.fileSystemView.equals(FileSystemView.getFileSystemView())) {
  784.          var2 = this.fileSystemView;
  785.          this.fileSystemView = null;
  786.       }
  787.  
  788.       var1.defaultWriteObject();
  789.       if (var2 != null) {
  790.          this.fileSystemView = var2;
  791.       }
  792.  
  793.       if (this.isAcceptAllFileFilterUsed()) {
  794.          this.addChoosableFileFilter(this.getAcceptAllFileFilter());
  795.       }
  796.  
  797.       if (this.getUIClassID().equals("FileChooserUI")) {
  798.          byte var3 = JComponent.getWriteObjCounter(this);
  799.          --var3;
  800.          JComponent.setWriteObjCounter(this, var3);
  801.          if (var3 == 0 && this.ui != null) {
  802.             this.ui.installUI(this);
  803.          }
  804.       }
  805.  
  806.    }
  807.  
  808.    protected String paramString() {
  809.       String var1 = this.approveButtonText != null ? this.approveButtonText : "";
  810.       String var2 = this.dialogTitle != null ? this.dialogTitle : "";
  811.       String var3;
  812.       if (this.dialogType == 0) {
  813.          var3 = "OPEN_DIALOG";
  814.       } else if (this.dialogType == 1) {
  815.          var3 = "SAVE_DIALOG";
  816.       } else if (this.dialogType == 2) {
  817.          var3 = "CUSTOM_DIALOG";
  818.       } else {
  819.          var3 = "";
  820.       }
  821.  
  822.       String var4;
  823.       if (this.returnValue == 1) {
  824.          var4 = "CANCEL_OPTION";
  825.       } else if (this.returnValue == 0) {
  826.          var4 = "APPROVE_OPTION";
  827.       } else if (this.returnValue == -1) {
  828.          var4 = "ERROR_OPTION";
  829.       } else {
  830.          var4 = "";
  831.       }
  832.  
  833.       String var5 = this.useFileHiding ? "true" : "false";
  834.       String var6;
  835.       if (this.fileSelectionMode == 0) {
  836.          var6 = "FILES_ONLY";
  837.       } else if (this.fileSelectionMode == 1) {
  838.          var6 = "DIRECTORIES_ONLY";
  839.       } else if (this.fileSelectionMode == 2) {
  840.          var6 = "FILES_AND_DIRECTORIES";
  841.       } else {
  842.          var6 = "";
  843.       }
  844.  
  845.       String var7 = this.currentDirectory != null ? this.currentDirectory.toString() : "";
  846.       String var8 = this.selectedFile != null ? this.selectedFile.toString() : "";
  847.       return super.paramString() + ",approveButtonText=" + var1 + ",currentDirectory=" + var7 + ",dialogTitle=" + var2 + ",dialogType=" + var3 + ",fileSelectionMode=" + var6 + ",returnValue=" + var4 + ",selectedFile=" + var8 + ",useFileHiding=" + var5;
  848.    }
  849.  
  850.    public AccessibleContext getAccessibleContext() {
  851.       if (this.accessibleContext == null) {
  852.          this.accessibleContext = new AccessibleJFileChooser(this);
  853.       }
  854.  
  855.       return this.accessibleContext;
  856.    }
  857.  
  858.    // $FF: synthetic method
  859.    static int access$002(JFileChooser var0, int var1) {
  860.       return var0.returnValue = var1;
  861.    }
  862.  
  863.    // $FF: synthetic method
  864.    static boolean access$100(JFileChooser var0) {
  865.       return var0.useFileHiding;
  866.    }
  867.  
  868.    // $FF: synthetic method
  869.    static boolean access$102(JFileChooser var0, boolean var1) {
  870.       return var0.useFileHiding = var1;
  871.    }
  872. }
  873.