org.jfree.ui.action

## Class AbstractFileSelectionAction

- java.lang.Object
- - javax.swing.AbstractAction
  - - org.jfree.ui.action.AbstractActionDowngrade
    - - org.jfree.ui.action.AbstractFileSelectionAction

- All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, ActionDowngrade

      public abstract class AbstractFileSelectionAction
      extends AbstractActionDowngrade

  A base class for all file operations. This implementation provides all methods to let the user select a file.
  Author:
    Thomas Morgner
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.jfree.ui.action.AbstractActionDowngrade

      `ACCELERATOR_KEY, MNEMONIC_KEY`

    - ### Fields inherited from class javax.swing.AbstractAction

      `changeSupport, enabled`

    - ### Fields inherited from interface javax.swing.Action

      `ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractFileSelectionAction(java.awt.Component parent)` Creates a new FileSelectionAction with the given optional parent component as parent for the file chooser dialog.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected javax.swing.JFileChooser` | `createFileChooser()` Creates the file chooser.
    `protected java.io.File` | `getCurrentDirectory()` Returns the working directory that should be used when initializing the FileChooser.
    `protected abstract java.lang.String` | `getFileDescription()` Returns a descriptive text describing the file extension.
    `protected abstract java.lang.String` | `getFileExtension()` Returns the file extension that should be used for the operation.
    `protected java.io.File` | `performSelectFile(java.io.File selectedFile, int dialogType, boolean appendExtension)` Selects a file to use as target for the operation.

    - ### Methods inherited from class javax.swing.AbstractAction

      `addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.swing.Action

      `addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled`

    - ### Methods inherited from interface java.awt.event.ActionListener

      `actionPerformed`

- - ### Constructor Detail

    - #### AbstractFileSelectionAction

          public AbstractFileSelectionAction(java.awt.Component parent)

      Creates a new FileSelectionAction with the given optional parent component as parent for the file chooser dialog.
      Parameters:
        `parent` - the parent

  - ### Method Detail

    - #### getFileExtension

          protected abstract java.lang.String getFileExtension()

      Returns the file extension that should be used for the operation.
      Returns:
        the file extension.

    - #### getFileDescription

          protected abstract java.lang.String getFileDescription()

      Returns a descriptive text describing the file extension.
      Returns:
        the file description.

    - #### getCurrentDirectory

          protected java.io.File getCurrentDirectory()

      Returns the working directory that should be used when initializing the FileChooser.
      Returns:
        the working directory.

    - #### performSelectFile

          protected java.io.File performSelectFile(java.io.File selectedFile,
                                       int dialogType,
                                       boolean appendExtension)

      Selects a file to use as target for the operation.
      Parameters:
        `selectedFile` - the selected file.
        `dialogType` - the dialog type.
        `appendExtension` - true, if the file extension should be added if necessary, false if the unmodified filename should be used.
      Returns:
        the selected and approved file or null, if the user canceled the operation

    - #### createFileChooser

          protected javax.swing.JFileChooser createFileChooser()

      Creates the file chooser.
      Returns:
        the initialized file chooser.