javax.swing.plaf.metal
Class MetalFileChooserUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.FileChooserUI
          extended by javax.swing.plaf.basic.BasicFileChooserUI
              extended by javax.swing.plaf.metal.MetalFileChooserUI

public class MetalFileChooserUI
extends BasicFileChooserUI

A UI delegate for the JFileChooser component. This class is only partially implemented and is not usable yet.


Nested Class Summary
protected  class MetalFileChooserUI.DirectoryComboBoxAction
          Handles changes to the selection in the directory combo box.
protected  class MetalFileChooserUI.DirectoryComboBoxModel
          A combo box model containing the selected directory and all its parent directories.
protected  class MetalFileChooserUI.FileRenderer
          A renderer for the files and directories in the file chooser.
protected  class MetalFileChooserUI.FilterComboBoxModel
          A combo box model for the file selection filters.
 class MetalFileChooserUI.FilterComboBoxRenderer
          A renderer for the items in the file filter combo box.
protected  class MetalFileChooserUI.SingleClickListener
          A mouse listener for the JFileChooser.
 
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicFileChooserUI
BasicFileChooserUI.AcceptAllFileFilter, BasicFileChooserUI.ApproveSelectionAction, BasicFileChooserUI.BasicFileView, BasicFileChooserUI.CancelSelectionAction, BasicFileChooserUI.ChangeToParentDirectoryAction, BasicFileChooserUI.DoubleClickListener, BasicFileChooserUI.GoHomeAction, BasicFileChooserUI.NewFolderAction, BasicFileChooserUI.SelectionListener, BasicFileChooserUI.UpdateAction
 
Field Summary
 
Fields inherited from class javax.swing.plaf.basic.BasicFileChooserUI
cancelButtonMnemonic, cancelButtonText, cancelButtonToolTipText, computerIcon, detailsViewIcon, directoryIcon, directoryOpenButtonMnemonic, directoryOpenButtonText, directoryOpenButtonToolTipText, fileIcon, floppyDriveIcon, hardDriveIcon, helpButtonMnemonic, helpButtonText, helpButtonToolTipText, homeFolderIcon, listViewIcon, newFolderIcon, openButtonMnemonic, openButtonText, openButtonToolTipText, saveButtonMnemonic, saveButtonText, saveButtonToolTipText, updateButtonMnemonic, updateButtonText, updateButtonToolTipText, upFolderIcon
 
Constructor Summary
MetalFileChooserUI(JFileChooser filechooser)
          Creates a new instance of this UI delegate.
 
Method Summary
protected  void addControlButtons()
          Adds the control buttons ('up', 'home' etc.) to the panel.
protected  ActionMap createActionMap()
          Creates and returns an action map.
protected  JPanel createDetailsView(JFileChooser fc)
          Creates a panel containing a table within a scroll pane.
protected  MetalFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(JFileChooser fc)
          Creates and returns a new instance of MetalFileChooserUI.DirectoryComboBoxModel.
protected  javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(JFileChooser fc)
          Creates a new instance of the renderer used in the directory combo box.
protected  MetalFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()
          Creates and returns a new instance of MetalFileChooserUI.FilterComboBoxModel.
protected  MetalFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()
          Creates and returns a new instance of MetalFileChooserUI.FilterComboBoxRenderer.
protected  JPanel createList(JFileChooser fc)
          Creates a panel containing a list of files.
 ListSelectionListener createListSelectionListener(JFileChooser fc)
          Creates a listener that monitors selections in the directory/file list and keeps the JFileChooser component up to date.
 PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
          Creates a property change listener that monitors the JFileChooser for property change events and updates the component display accordingly.
static ComponentUI createUI(JComponent c)
          A factory method that returns a UI delegate for the specified component.
protected  ActionMap getActionMap()
           
protected  JButton getApproveButton(JFileChooser fc)
          Returns the approve button.
protected  JPanel getBottomPanel()
          Creates and returns a new panel that will be used for the controls at the bottom of the file chooser.
protected  JPanel getButtonPanel()
          Returns the panel that contains the 'Open' (or 'Save') and 'Cancel' buttons.
 String getFileName()
          Returns the file name in the text field.
 Dimension getMaximumSize(JComponent c)
          Returns the maximum size for the file chooser component.
 Dimension getMinimumSize(JComponent c)
          Returns the minimum size for the file chooser component.
 Dimension getPreferredSize(JComponent c)
          Returns the preferred size for the file chooser component.
 void installComponents(JFileChooser fc)
          Installs the sub-components of the file chooser.
protected  void installListeners(JFileChooser fc)
          Installs the listeners required.
protected  void installStrings(JFileChooser fc)
          Fetches localised strings for use by the labels and buttons on the file chooser.
 void installUI(JComponent c)
          Installs the UI for the specified component.
protected  void removeControlButtons()
          Removes all the buttons from the control panel.
 void rescanCurrentDirectory(JFileChooser fc)
          Updates the current directory.
 void setFileName(String filename)
          Sets the file name in the text field.
 void uninstallComponents(JFileChooser fc)
          Uninstalls the components added by installComponents(JFileChooser).
protected  void uninstallListeners(JFileChooser fc)
          Uninstalls the listeners previously installed by this UI delegate.
 void uninstallUI(JComponent c)
          Uninstalls this UI from the given component.
 void valueChanged(ListSelectionEvent e)
          DOCUMENT ME!!
 
Methods inherited from class javax.swing.plaf.basic.BasicFileChooserUI
clearIconCache, createDoubleClickListener, createModel, ensureFileIsVisible, getAcceptAllFileFilter, getAccessoryPanel, getApproveButtonMnemonic, getApproveButtonText, getApproveButtonToolTipText, getApproveSelectionAction, getCancelSelectionAction, getChangeToParentDirectoryAction, getDialogTitle, getDirectory, getDirectoryName, getFileChooser, getFileView, getGoHomeAction, getModel, getNewFolderAction, getUpdateAction, installDefaults, installIcons, isDirectorySelected, setDirectory, setDirectoryName, setDirectorySelected, uninstallDefaults, uninstallIcons, uninstallStrings
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, paint, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetalFileChooserUI

public MetalFileChooserUI(JFileChooser filechooser)
Creates a new instance of this UI delegate.

Parameters:
filechooser - the file chooser component.
Method Detail

createUI

public static ComponentUI createUI(JComponent c)
A factory method that returns a UI delegate for the specified component.

Parameters:
c - the component (which should be a JFileChooser).

installUI

public void installUI(JComponent c)
Description copied from class: BasicFileChooserUI
Installs the UI for the specified component.

Overrides:
installUI in class BasicFileChooserUI
Parameters:
c - the component (should be a JFileChooser).
See Also:
ComponentUI.uninstallUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

uninstallUI

public void uninstallUI(JComponent c)
Description copied from class: BasicFileChooserUI
Uninstalls this UI from the given component.

Overrides:
uninstallUI in class BasicFileChooserUI
Parameters:
c - the component (should be a JFileChooser).
See Also:
ComponentUI.installUI(javax.swing.JComponent), JComponent.setUI(javax.swing.plaf.ComponentUI), JComponent.updateUI()

installComponents

public void installComponents(JFileChooser fc)
Installs the sub-components of the file chooser.

Overrides:
installComponents in class BasicFileChooserUI
Parameters:
fc - the file chooser component.

uninstallComponents

public void uninstallComponents(JFileChooser fc)
Uninstalls the components added by installComponents(JFileChooser).

Overrides:
uninstallComponents in class BasicFileChooserUI
Parameters:
fc - the file chooser.

getButtonPanel

protected JPanel getButtonPanel()
Returns the panel that contains the 'Open' (or 'Save') and 'Cancel' buttons.

Returns:
The panel.

getBottomPanel

protected JPanel getBottomPanel()
Creates and returns a new panel that will be used for the controls at the bottom of the file chooser.

Returns:
A new panel.

installStrings

protected void installStrings(JFileChooser fc)
Fetches localised strings for use by the labels and buttons on the file chooser.

Overrides:
installStrings in class BasicFileChooserUI
Parameters:
fc - the file chooser.

installListeners

protected void installListeners(JFileChooser fc)
Installs the listeners required.

Overrides:
installListeners in class BasicFileChooserUI
Parameters:
fc - the file chooser.

uninstallListeners

protected void uninstallListeners(JFileChooser fc)
Description copied from class: BasicFileChooserUI
Uninstalls the listeners previously installed by this UI delegate.

Overrides:
uninstallListeners in class BasicFileChooserUI
Parameters:
fc - the file chooser.

getActionMap

protected ActionMap getActionMap()

createActionMap

protected ActionMap createActionMap()
Creates and returns an action map.

Returns:
The action map.

createList

protected JPanel createList(JFileChooser fc)
Creates a panel containing a list of files.

Parameters:
fc - the file chooser.
Returns:
A panel.

createDetailsView

protected JPanel createDetailsView(JFileChooser fc)
Creates a panel containing a table within a scroll pane.

Parameters:
fc - the file chooser.
Returns:
The details view.

createListSelectionListener

public ListSelectionListener createListSelectionListener(JFileChooser fc)
Creates a listener that monitors selections in the directory/file list and keeps the JFileChooser component up to date.

Overrides:
createListSelectionListener in class BasicFileChooserUI
Parameters:
fc - the file chooser.
Returns:
The listener.
See Also:
installListeners(JFileChooser)

getPreferredSize

public Dimension getPreferredSize(JComponent c)
Returns the preferred size for the file chooser component.

Overrides:
getPreferredSize in class ComponentUI
Parameters:
c - the component for which this delegate performs services.
Returns:
The preferred size.

getMinimumSize

public Dimension getMinimumSize(JComponent c)
Returns the minimum size for the file chooser component.

Overrides:
getMinimumSize in class ComponentUI
Parameters:
c - the component for which this delegate performs services.
Returns:
The minimum size.

getMaximumSize

public Dimension getMaximumSize(JComponent c)
Returns the maximum size for the file chooser component.

Overrides:
getMaximumSize in class ComponentUI
Parameters:
c - the component for which this delegate performs services.
Returns:
The maximum size.

createPropertyChangeListener

public PropertyChangeListener createPropertyChangeListener(JFileChooser fc)
Creates a property change listener that monitors the JFileChooser for property change events and updates the component display accordingly.

Overrides:
createPropertyChangeListener in class BasicFileChooserUI
Parameters:
fc - the file chooser.
Returns:
The property change listener.
See Also:
installListeners(JFileChooser)

createDirectoryComboBoxModel

protected MetalFileChooserUI.DirectoryComboBoxModel createDirectoryComboBoxModel(JFileChooser fc)
Creates and returns a new instance of MetalFileChooserUI.DirectoryComboBoxModel.

Returns:
A new instance of MetalFileChooserUI.DirectoryComboBoxModel.

createDirectoryComboBoxRenderer

protected javax.swing.plaf.metal.MetalFileChooserUI.DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(JFileChooser fc)
Creates a new instance of the renderer used in the directory combo box.

Parameters:
fc - the file chooser.
Returns:
The renderer.

createFilterComboBoxModel

protected MetalFileChooserUI.FilterComboBoxModel createFilterComboBoxModel()
Creates and returns a new instance of MetalFileChooserUI.FilterComboBoxModel.

Returns:
A new instance of MetalFileChooserUI.FilterComboBoxModel.

createFilterComboBoxRenderer

protected MetalFileChooserUI.FilterComboBoxRenderer createFilterComboBoxRenderer()
Creates and returns a new instance of MetalFileChooserUI.FilterComboBoxRenderer.

Returns:
A new instance of MetalFileChooserUI.FilterComboBoxRenderer.

addControlButtons

protected void addControlButtons()
Adds the control buttons ('up', 'home' etc.) to the panel.


removeControlButtons

protected void removeControlButtons()
Removes all the buttons from the control panel.


rescanCurrentDirectory

public void rescanCurrentDirectory(JFileChooser fc)
Updates the current directory.

Overrides:
rescanCurrentDirectory in class BasicFileChooserUI
Parameters:
fc - the file chooser to update.

getFileName

public String getFileName()
Returns the file name in the text field.

Overrides:
getFileName in class BasicFileChooserUI
Returns:
The file name.

setFileName

public void setFileName(String filename)
Sets the file name in the text field.

Overrides:
setFileName in class BasicFileChooserUI
Parameters:
filename - the file name.
See Also:
BasicFileChooserUI.getFileName()

valueChanged

public void valueChanged(ListSelectionEvent e)
DOCUMENT ME!!

Parameters:
e - - DOCUMENT ME!

getApproveButton

protected JButton getApproveButton(JFileChooser fc)
Returns the approve button.

Overrides:
getApproveButton in class BasicFileChooserUI
Parameters:
fc - the file chooser.
Returns:
The approve button.