org.faceless.pdf2.viewer2.feature

## Class SaveAs

- java.lang.Object
- - org.faceless.pdf2.viewer2.ViewerFeature
  - - org.faceless.pdf2.viewer2.ViewerWidget
    - - org.faceless.pdf2.viewer2.feature.SaveAs

- All Implemented Interfaces:
    DocumentPanelListener

      public class SaveAs
      extends ViewerWidget
      implements DocumentPanelListener

  Create a button that will open a dialog allowing the PDF to be saved to disk. Any `Exporter` formats included as features in the Viewer will be presented as options.
  The following initialization parameters can be specified to configure this feature.

  promptOnOverwrite | true to prompt before overwriting files, false otherwise (the default)
  disableUnlessDirty | true to disable this feature until the PDF has been marked as "dirty" (ie it has been altered), false to always enable this feature (the defualt)

  The name of this feature is Save

  This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.

  Since:
    2.17

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SaveAs()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `action(ViewerEvent event)` The method that's run when this feature is activated.
    `ActionListener` | `createActionListener()` Return an ActionListener that will be called when this Widget is activated.
    `void` | `documentUpdated(DocumentPanelEvent event)` Called when an `DocumentPanelEvent` is raised
    `void` | `initialize(PDFViewer viewer)` Called when the feature is first added to a viewer
    `boolean` | `isEnabledByDefault()` Return true if this feature is enabled by default (the default).
    `boolean` | `isPromptOnOverwrite()` Indicates whether this feature should prompt before overwriting a file
    `static void` | `saveAs(ViewerEvent event, Exporter initialexporter, String initialpath, boolean overwriteprompt)` /** Save the Document
    `void` | `setPromptOnOverwrite(boolean prompt)` Set whether this feature should prompt before overwriting a file

    - ### Methods inherited from class org.faceless.pdf2.viewer2.ViewerWidget

      `getComponent, getIcon, getViewer, isButtonEnabledByDefault, isDocumentRequired, isMenuEnabledByDefault, setButton, setComponent, setDocumentRequired, setMenu, setMenu, setToolBarEnabled, setToolBarEnabledAlways, setToolBarFloatable, setToolBarFloating, toString`

    - ### Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature

      `getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, setFeatureName, teardown`

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

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

- - ### Constructor Detail

    - #### SaveAs

          public SaveAs()

  - ### Method Detail

    - #### action

          public void action(ViewerEvent event)

      Description copied from class: `ViewerWidget`
      The method that's run when this feature is activated. This method is called by the `ActionListener` returned by the default implementation of `ViewerWidget.createActionListener()`, and by default is a no-op.
      Overrides:
        `action` in class `ViewerWidget`

    - #### createActionListener

          public ActionListener createActionListener()

      Description copied from class: `ViewerWidget`
      Return an ActionListener that will be called when this Widget is activated. Subclasses will typically not need to override this method except in special cases.
      Overrides:
        `createActionListener` in class `ViewerWidget`
      Returns:
        ActionListener the ActionListener to be notified when an event fires
      See Also:
        `Quit.createActionListener()`

    - #### isEnabledByDefault

          public boolean isEnabledByDefault()

      Description copied from class: `ViewerFeature`
      Return true if this feature is enabled by default (the default). Disabled features are excluded from the list returned by `ViewerFeature.getAllEnabledFeatures()` and by the `PDFViewerApplet` and `PDFTool`
      Overrides:
        `isEnabledByDefault` in class `ViewerFeature`

    - #### initialize

          public void initialize(PDFViewer viewer)

      Description copied from class: `ViewerFeature`
      Called when the feature is first added to a viewer
      Overrides:
        `initialize` in class `ViewerWidget`

    - #### documentUpdated

          public void documentUpdated(DocumentPanelEvent event)

      Description copied from interface: `DocumentPanelListener`
      Called when an `DocumentPanelEvent` is raised
      Specified by:
        `documentUpdated` in interface `DocumentPanelListener`

    - #### setPromptOnOverwrite

          public void setPromptOnOverwrite(boolean prompt)

      Set whether this feature should prompt before overwriting a file
      Parameters:
        `prompt` - whether to prompt before overwriting a file (detault is false)
      Since:
        2.11.25

    - #### isPromptOnOverwrite

          public boolean isPromptOnOverwrite()

      Indicates whether this feature should prompt before overwriting a file
      Since:
        2.18

    - #### saveAs

          public static void saveAs(ViewerEvent event,
                                    Exporter initialexporter,
                                    String initialpath,
                                    boolean overwriteprompt)

      /** Save the Document
      Parameters:
        `event` - the ViewerEvent that launched this action
        `initialexporter` - the `Exporter` to choose by default, or null to default to a `PDFExporter`
        `initialpath` - the Path to display by default, or `null` to use the same path as the source file
        `overwriteprompt` - whether to prompt the user if we are about to overwrite a filename.
      Since:
        2.11.10

Copyright © 2001-2015 Big Faceless Organization