org.faceless.pdf2.viewer2.feature

## Class Undo

- java.lang.Object
- - org.faceless.pdf2.viewer2.ViewerFeature
  - - org.faceless.pdf2.viewer2.feature.Undo

- All Implemented Interfaces:
    ActionListener, EventListener, UndoableEditListener, DocumentPanelListener

      public final class Undo
      extends ViewerFeature
      implements ActionListener, UndoableEditListener, DocumentPanelListener

  This features adds an "Undo" and "Redo" entry to the Edit menu, which interfaces with the `DocumentPanel.fireUndoableEditEvent(javax.swing.event.UndoableEditEvent)` method to provide undo/redo across the Document. The name of this feature is Undo

  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.11.19

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static UndoableEdit` | `DISCARD` An UndableEdit which can be passed into `DocumentPanel.fireUndoableEditEvent(javax.swing.event.UndoableEditEvent)` to clear the list.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Undo()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `actionPerformed(ActionEvent e)`
    `void` | `documentUpdated(DocumentPanelEvent event)` Called when an `DocumentPanelEvent` is raised
    `void` | `initialize(PDFViewer viewer)` Called when the feature is first added to a viewer
    `void` | `undoableEditHappened(UndoableEditEvent event)`

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

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

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

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

- - ### Field Detail

    - #### DISCARD

          public static final UndoableEdit DISCARD

      An UndableEdit which can be passed into `DocumentPanel.fireUndoableEditEvent(javax.swing.event.UndoableEditEvent)` to clear the list. This should be done when the list needs to be cleared, due to an action on the Document that permanently changes the state of the PDF.

  - ### Constructor Detail

    - #### Undo

          public Undo()

  - ### Method Detail

    - #### actionPerformed

          public void actionPerformed(ActionEvent e)

      Specified by:
        `actionPerformed` in interface `ActionListener`

    - #### 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 `ViewerFeature`

    - #### documentUpdated

          public void documentUpdated(DocumentPanelEvent event)

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

    - #### undoableEditHappened

          public void undoableEditHappened(UndoableEditEvent event)

      Specified by:
        `undoableEditHappened` in interface `UndoableEditListener`

Copyright © 2001-2015 Big Faceless Organization