Interface UndoManager
-
- All Implemented Interfaces:
public interface UndoManager
A generic manager for undoing/redoing edits on a PdfFragment. This can be retrieved using PdfFragment.getUndoManager.
-
-
Method Summary
Modifier and Type Method Description abstract Boolean
canUndo()
Returns whether there are edits that can be undone or not. abstract Boolean
canRedo()
Returns whether there are edits that can be redone or not. abstract Unit
undo()
Undoes the last edit or throws an exception if an undo operation is not possible. abstract Unit
redo()
Redoes the next edit or throws an exception if a redo operation is not possible. abstract Unit
clearHistory()
Clears the history of all currently recorded edits. abstract Unit
addOnUndoHistoryChangeListener(OnUndoHistoryChangeListener listener)
Adds an OnUndoHistoryChangeListener for being notified of changes to the undo manager's edit history (i.e. abstract Unit
removeOnUndoHistoryChangeListener(OnUndoHistoryChangeListener listener)
Removes a previously added OnUndoHistoryChangeListener. abstract Unit
setOnAddNewEditListener(OnAddNewEditListener listener)
Sets the OnAddNewEditListener for being notified when new com.pspdfkit.undo.edit.Edit are being added. -
-
Method Detail
-
canUndo
abstract Boolean canUndo()
Returns whether there are edits that can be undone or not. If this returns
false
a call to undo will throw an exception.- Returns:
true
if an undo operation is possible,false
otherwise.
-
canRedo
abstract Boolean canRedo()
Returns whether there are edits that can be redone or not. If this returns
false
a call to redo will throw an exception.- Returns:
true
if a redo operation is possible,false
otherwise.
-
undo
abstract Unit undo()
Undoes the last edit or throws an exception if an undo operation is not possible. It's recommended that you check whether an undo operation is available using (canUndo) before calling this method. Undoing may be unavailable if there are no edits on the undo stack or if the latest edit on the undo stack cannot be undone. When undoing an edit, the edit is moved to the internal redo stack.
-
redo
abstract Unit redo()
Redoes the next edit or throws an exception if a redo operation is not possible. It's recommended that you check whether a redo operation is available using (canRedo) before calling this method. Redoing may be unavailable if there are no edits on the redo stack or if the latest edit on the redo stack cannot be redone. When redoing an edit, the edit is moved to the internal undo stack.
-
clearHistory
abstract Unit clearHistory()
Clears the history of all currently recorded edits. After calling this method, this UndoManager will have no edits that can be undone or redone.
-
addOnUndoHistoryChangeListener
abstract Unit addOnUndoHistoryChangeListener(OnUndoHistoryChangeListener listener)
Adds an OnUndoHistoryChangeListener for being notified of changes to the undo manager's edit history (i.e. its undo and redo stacks). If a listener has already been added previously, this method will be a no-op. Passing
null
is not allowed and will result in an exception.- Parameters:
listener
- OnUndoHistoryChangeListener that should be notified.
-
removeOnUndoHistoryChangeListener
abstract Unit removeOnUndoHistoryChangeListener(OnUndoHistoryChangeListener listener)
Removes a previously added OnUndoHistoryChangeListener. Upon calling this method,
listener
will no longer be notified of any changes. If listener has not been added previously, this method will be a no-op. Passingnull
is not allowed, and will result in an exception.- Parameters:
listener
- OnUndoHistoryChangeListener that should be removed.
-
setOnAddNewEditListener
abstract Unit setOnAddNewEditListener(OnAddNewEditListener listener)
Sets the OnAddNewEditListener for being notified when new com.pspdfkit.undo.edit.Edit are being added. This can be used to prevent edits from being added or reading edit information when they are getting added.
-
-
-
-