66 |
66 |
67 private FilePane filePane; |
67 private FilePane filePane; |
68 private JToggleButton listViewButton; |
68 private JToggleButton listViewButton; |
69 private JToggleButton detailsViewButton; |
69 private JToggleButton detailsViewButton; |
70 |
70 |
71 private boolean useShellFolder; |
|
72 |
|
73 private JButton approveButton; |
71 private JButton approveButton; |
74 private JButton cancelButton; |
72 private JButton cancelButton; |
75 |
73 |
76 private JPanel buttonPanel; |
74 private JPanel buttonPanel; |
77 private JPanel bottomPanel; |
75 private JPanel bottomPanel; |
202 } |
200 } |
203 |
201 |
204 public ListSelectionListener createListSelectionListener() { |
202 public ListSelectionListener createListSelectionListener() { |
205 return MetalFileChooserUI.this.createListSelectionListener(getFileChooser()); |
203 return MetalFileChooserUI.this.createListSelectionListener(getFileChooser()); |
206 } |
204 } |
207 |
|
208 public boolean usesShellFolder() { |
|
209 return useShellFolder; |
|
210 } |
|
211 } |
205 } |
212 |
206 |
213 public void installComponents(JFileChooser fc) { |
207 public void installComponents(JFileChooser fc) { |
214 FileSystemView fsv = fc.getFileSystemView(); |
208 FileSystemView fsv = fc.getFileSystemView(); |
215 |
209 |
216 fc.setBorder(new EmptyBorder(12, 12, 11, 11)); |
210 fc.setBorder(new EmptyBorder(12, 12, 11, 11)); |
217 fc.setLayout(new BorderLayout(0, 11)); |
211 fc.setLayout(new BorderLayout(0, 11)); |
218 |
212 |
219 filePane = new FilePane(new MetalFileChooserUIAccessor()); |
213 filePane = new FilePane(new MetalFileChooserUIAccessor()); |
220 fc.addPropertyChangeListener(filePane); |
214 fc.addPropertyChangeListener(filePane); |
221 |
|
222 updateUseShellFolder(); |
|
223 |
215 |
224 // ********************************* // |
216 // ********************************* // |
225 // **** Construct the top panel **** // |
217 // **** Construct the top panel **** // |
226 // ********************************* // |
218 // ********************************* // |
227 |
219 |
444 if(fc.getControlButtonsAreShown()) { |
436 if(fc.getControlButtonsAreShown()) { |
445 addControlButtons(); |
437 addControlButtons(); |
446 } |
438 } |
447 |
439 |
448 groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel }); |
440 groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel }); |
449 } |
|
450 |
|
451 private void updateUseShellFolder() { |
|
452 // Decide whether to use the ShellFolder class to populate shortcut |
|
453 // panel and combobox. |
|
454 JFileChooser fc = getFileChooser(); |
|
455 Boolean prop = |
|
456 (Boolean)fc.getClientProperty("FileChooser.useShellFolder"); |
|
457 if (prop != null) { |
|
458 useShellFolder = prop.booleanValue(); |
|
459 } else { |
|
460 useShellFolder = fc.getFileSystemView().equals(FileSystemView.getFileSystemView()); |
|
461 } |
|
462 } |
441 } |
463 |
442 |
464 protected JPanel getButtonPanel() { |
443 protected JPanel getButtonPanel() { |
465 if (buttonPanel == null) { |
444 if (buttonPanel == null) { |
466 buttonPanel = new JPanel(); |
445 buttonPanel = new JPanel(); |
784 JFileChooser cc = (JFileChooser)e.getSource(); |
763 JFileChooser cc = (JFileChooser)e.getSource(); |
785 if (o != e.getOldValue()) { |
764 if (o != e.getOldValue()) { |
786 cc.applyComponentOrientation(o); |
765 cc.applyComponentOrientation(o); |
787 } |
766 } |
788 } else if (s == "FileChooser.useShellFolder") { |
767 } else if (s == "FileChooser.useShellFolder") { |
789 updateUseShellFolder(); |
|
790 doDirectoryChanged(e); |
768 doDirectoryChanged(e); |
791 } else if (s.equals("ancestor")) { |
769 } else if (s.equals("ancestor")) { |
792 if (e.getOldValue() == null && e.getNewValue() != null) { |
770 if (e.getOldValue() == null && e.getNewValue() != null) { |
793 // Ancestor was added, set initial focus |
771 // Ancestor was added, set initial focus |
794 fileNameTextField.selectAll(); |
772 fileNameTextField.selectAll(); |