Package org.fxmisc.richtext.util
Class UndoUtils
- java.lang.Object
-
- org.fxmisc.richtext.util.UndoUtils
-
public final class UndoUtils extends Object
A class filled with factory methods to help easily construct anUndoManagerfor aGenericStyledArea.
-
-
Field Summary
Fields Modifier and Type Field Description static DurationDEFAULT_PREVENT_MERGE_DELAY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <PS,SEG,S>
Consumer<List<PlainTextChange>>applyMultiPlainTextChange(GenericStyledArea<PS,SEG,S> area)Applies a list ofPlainTextChanges to the given area when theUndoManager's change stream emits an event byarea.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().static <PS,SEG,S>
Consumer<List<RichTextChange<PS,SEG,S>>>applyMultiRichTextChange(GenericStyledArea<PS,SEG,S> area)Applies a list ofRichTextChangeto the given area when theUndoManager's change stream emits an event byarea.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().static <PS,SEG,S>
Consumer<PlainTextChange>applyPlainTextChange(GenericStyledArea<PS,SEG,S> area)Applies aPlainTextChangeto the given area when theUndoManager's change stream emits an event byarea.replaceText(change.getPosition(), change.getRemovalEnd(), change.getInserted().static <PS,SEG,S>
Consumer<RichTextChange<PS,SEG,S>>applyRichTextChange(GenericStyledArea<PS,SEG,S> area)Applies aRichTextChangeto the given area when theUndoManager's change stream emits an event byarea.replace(change.getPosition(), change.getRemovalEnd(), change.getInserted().static <PS,SEG,S>
UndoManagerdefaultUndoManager(GenericStyledArea<PS,SEG,S> area)Constructs an UndoManager with an unlimited history: ifthe area's preserveStyle flag is true, the returned UndoManager can undo/redo multipleRichTextChanges; otherwise, it can undo/redo multiplePlainTextChanges.static UndoManagernoOpUndoManager()Constructs an UndoManager with no historystatic <PS,SEG,S>
UndoManager<List<PlainTextChange>>plainTextUndoManager(GenericStyledArea<PS,SEG,S> area)Returns an UndoManager with an unlimited history that can undo/redoPlainTextChanges.static <PS,SEG,S>
UndoManager<List<PlainTextChange>>plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, Duration preventMergeDelay)Returns an UndoManager that can undo/redoPlainTextChanges.static <PS,SEG,S>
UndoManager<List<PlainTextChange>>plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)Returns an UndoManager that can undo/redoPlainTextChanges.static <PS,SEG,S>
UndoManager<List<PlainTextChange>>plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, Duration preventMergeDelay)Returns an UndoManager that can undo/redoPlainTextChanges.static <PS,SEG,S>
UndoManager<List<RichTextChange<PS,SEG,S>>>richTextSuspendableUndoManager(GenericStyledArea<PS,SEG,S> area, Duration preventMergeDelay, SuspendableYes suspendUndo)Returns an UndoManager with an unlimited history that can undo/redoRichTextChanges.static <PS,SEG,S>
UndoManager<List<RichTextChange<PS,SEG,S>>>richTextSuspendableUndoManager(GenericStyledArea<PS,SEG,S> area, SuspendableYes suspendUndo)Returns an UndoManager with an unlimited history that can undo/redoRichTextChanges.static <PS,SEG,S>
UndoManager<List<RichTextChange<PS,SEG,S>>>richTextUndoManager(GenericStyledArea<PS,SEG,S> area)Returns an UndoManager with an unlimited history that can undo/redoRichTextChanges.static <PS,SEG,S>
UndoManager<List<RichTextChange<PS,SEG,S>>>richTextUndoManager(GenericStyledArea<PS,SEG,S> area, Duration preventMergeDelay)Returns an UndoManager that can undo/redoRichTextChanges.static <PS,SEG,S>
UndoManager<List<RichTextChange<PS,SEG,S>>>richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)Returns an UndoManager that can undo/redoRichTextChanges.static <PS,SEG,S>
UndoManager<List<RichTextChange<PS,SEG,S>>>richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, Duration preventMergeDelay)Returns an UndoManager that can undo/redoRichTextChanges.
-
-
-
Field Detail
-
DEFAULT_PREVENT_MERGE_DELAY
public static final Duration DEFAULT_PREVENT_MERGE_DELAY
-
-
Method Detail
-
defaultUndoManager
public static <PS,SEG,S> UndoManager defaultUndoManager(GenericStyledArea<PS,SEG,S> area)
Constructs an UndoManager with an unlimited history: ifthe area's preserveStyle flag is true, the returned UndoManager can undo/redo multipleRichTextChanges; otherwise, it can undo/redo multiplePlainTextChanges.
-
noOpUndoManager
public static UndoManager noOpUndoManager()
Constructs an UndoManager with no history
-
richTextUndoManager
public static <PS,SEG,S> UndoManager<List<RichTextChange<PS,SEG,S>>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area)
Returns an UndoManager with an unlimited history that can undo/redoRichTextChanges. New changes emitted from the stream will not be merged with the previous change afterDEFAULT_PREVENT_MERGE_DELAY
-
richTextUndoManager
public static <PS,SEG,S> UndoManager<List<RichTextChange<PS,SEG,S>>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, Duration preventMergeDelay)
Returns an UndoManager that can undo/redoRichTextChanges. New changes emitted from the stream will not be merged with the previous change afterpreventMergeDelay
-
richTextUndoManager
public static <PS,SEG,S> UndoManager<List<RichTextChange<PS,SEG,S>>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)
Returns an UndoManager that can undo/redoRichTextChanges. New changes emitted from the stream will not be merged with the previous change afterDEFAULT_PREVENT_MERGE_DELAY
-
richTextUndoManager
public static <PS,SEG,S> UndoManager<List<RichTextChange<PS,SEG,S>>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, Duration preventMergeDelay)
Returns an UndoManager that can undo/redoRichTextChanges. New changes emitted from the stream will not be merged with the previous change afterpreventMergeDelay
-
richTextSuspendableUndoManager
public static <PS,SEG,S> UndoManager<List<RichTextChange<PS,SEG,S>>> richTextSuspendableUndoManager(GenericStyledArea<PS,SEG,S> area, SuspendableYes suspendUndo)
Returns an UndoManager with an unlimited history that can undo/redoRichTextChanges. New changes emitted from the stream will not be merged with the previous change afterDEFAULT_PREVENT_MERGE_DELAYNote: that only styling changes may occur during suspension of the undo manager.
-
richTextSuspendableUndoManager
public static <PS,SEG,S> UndoManager<List<RichTextChange<PS,SEG,S>>> richTextSuspendableUndoManager(GenericStyledArea<PS,SEG,S> area, Duration preventMergeDelay, SuspendableYes suspendUndo)
Returns an UndoManager with an unlimited history that can undo/redoRichTextChanges. New changes emitted from the stream will not be merged with the previous change afterpreventMergeDelay.Note: that only styling changes may occur during suspension of the undo manager.
-
plainTextUndoManager
public static <PS,SEG,S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area)
Returns an UndoManager with an unlimited history that can undo/redoPlainTextChanges. New changes emitted from the stream will not be merged with the previous change afterDEFAULT_PREVENT_MERGE_DELAY
-
plainTextUndoManager
public static <PS,SEG,S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, Duration preventMergeDelay)
Returns an UndoManager that can undo/redoPlainTextChanges. New changes emitted from the stream will not be merged with the previous change afterpreventMergeDelay
-
plainTextUndoManager
public static <PS,SEG,S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)
Returns an UndoManager that can undo/redoPlainTextChanges. New changes emitted from the stream will not be merged with the previous change afterDEFAULT_PREVENT_MERGE_DELAY
-
plainTextUndoManager
public static <PS,SEG,S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, Duration preventMergeDelay)
Returns an UndoManager that can undo/redoPlainTextChanges. New changes emitted from the stream will not be merged with the previous change afterpreventMergeDelay
-
applyPlainTextChange
public static <PS,SEG,S> Consumer<PlainTextChange> applyPlainTextChange(GenericStyledArea<PS,SEG,S> area)
Applies aPlainTextChangeto the given area when theUndoManager's change stream emits an event byarea.replaceText(change.getPosition(), change.getRemovalEnd(), change.getInserted().
-
applyRichTextChange
public static <PS,SEG,S> Consumer<RichTextChange<PS,SEG,S>> applyRichTextChange(GenericStyledArea<PS,SEG,S> area)
Applies aRichTextChangeto the given area when theUndoManager's change stream emits an event byarea.replace(change.getPosition(), change.getRemovalEnd(), change.getInserted().
-
applyMultiPlainTextChange
public static <PS,SEG,S> Consumer<List<PlainTextChange>> applyMultiPlainTextChange(GenericStyledArea<PS,SEG,S> area)
Applies a list ofPlainTextChanges to the given area when theUndoManager's change stream emits an event byarea.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().
-
applyMultiRichTextChange
public static <PS,SEG,S> Consumer<List<RichTextChange<PS,SEG,S>>> applyMultiRichTextChange(GenericStyledArea<PS,SEG,S> area)
Applies a list ofRichTextChangeto the given area when theUndoManager's change stream emits an event byarea.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().
-
-