Top Description Fields Constructors Methods
org.fxmisc.richtext.util

public final Class UndoUtils

extends Object
Class Inheritance
Imports
org.fxmisc.richtext.GenericStyledArea, .MultiChangeBuilder, org.fxmisc.richtext.model.PlainTextChange, .RichTextChange, .TextChange, org.fxmisc.undo.UndoManager, .UndoManagerFactory, org.fxmisc.undo.impl.MultiChangeUndoManagerImpl, .UnlimitedChangeQueue, org.reactfx.SuspendableYes, org.reactfx.value.Val, javafx.beans.value.ObservableBooleanValue, java.time.Duration, java.util.List, java.util.function.Consumer

A class filled with factory methods to help easily construct an UndoManager for a GenericStyledArea.

Field Summary

Modifier and TypeField and Description
public static final Duration

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <PS, SEG, S> Consumer<List<PlainTextChange>>
applyMultiPlainTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a list of PlainTextChanges to the given area when the UndoManager's change stream emits an event by area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().

public static <PS, SEG, S> Consumer<List<RichTextChange<PS, SEG, S>>>
applyMultiRichTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a list of RichTextChange to the given area when the UndoManager's change stream emits an event by area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().

public static <PS, SEG, S> Consumer<PlainTextChange>
applyPlainTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a PlainTextChange to the given area when the UndoManager's change stream emits an event by area.replaceText(change.getPosition(), change.getRemovalEnd(), change.getInserted().

public static <PS, SEG, S> Consumer<RichTextChange<PS, SEG, S>>
applyRichTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a RichTextChange to the given area when the UndoManager's change stream emits an event by area.replace(change.getPosition(), change.getRemovalEnd(), change.getInserted().

public static <PS, SEG, S> UndoManager<C>
defaultUndoManager(GenericStyledArea<PS, SEG, S> area)

Constructs an UndoManager with an unlimited history: if the area's preserveStyle flag is true, the returned UndoManager can undo/redo multiple RichTextChanges; otherwise, it can undo/redo multiple PlainTextChanges.

private static void
moveToChange(GenericStyledArea<PS, SEG, S> area, TextChange<S, Self extends TextChange<S, Self>> chg)

public static UndoManager<C>
noOpUndoManager()

Constructs an UndoManager with no history

public static <PS, SEG, S> UndoManager<List<PlainTextChange>>
plainTextUndoManager(GenericStyledArea<PS, SEG, S> area)

Returns an UndoManager with an unlimited history that can undo/redo PlainTextChanges.

public static <PS, SEG, S> UndoManager<List<PlainTextChange>>
plainTextUndoManager(GenericStyledArea<PS, SEG, S> area, Duration preventMergeDelay)

Returns an UndoManager that can undo/redo PlainTextChanges.

public static <PS, SEG, S> UndoManager<List<PlainTextChange>>
plainTextUndoManager(GenericStyledArea<PS, SEG, S> area, UndoManagerFactory factory)

Returns an UndoManager that can undo/redo PlainTextChanges.

public static <PS, SEG, S> UndoManager<List<PlainTextChange>>
plainTextUndoManager(GenericStyledArea<PS, SEG, S> area, UndoManagerFactory factory, Duration preventMergeDelay)

Returns an UndoManager that can undo/redo PlainTextChanges.

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/redo RichTextChanges.

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/redo RichTextChanges.

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/redo RichTextChanges.

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/redo RichTextChanges.

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/redo RichTextChanges.

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/redo RichTextChanges.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_PREVENT_MERGE_DELAYback to summary
public static final Duration DEFAULT_PREVENT_MERGE_DELAY

Constructor Detail

UndoUtilsback to summary
private UndoUtils()

Method Detail

applyMultiPlainTextChangeback to summary
public static <PS, SEG, S> Consumer<List<PlainTextChange>> applyMultiPlainTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a list of PlainTextChanges to the given area when the UndoManager's change stream emits an event by area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().

applyMultiRichTextChangeback to summary
public static <PS, SEG, S> Consumer<List<RichTextChange<PS, SEG, S>>> applyMultiRichTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a list of RichTextChange to the given area when the UndoManager's change stream emits an event by area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted().

applyPlainTextChangeback to summary
public static <PS, SEG, S> Consumer<PlainTextChange> applyPlainTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a PlainTextChange to the given area when the UndoManager's change stream emits an event by area.replaceText(change.getPosition(), change.getRemovalEnd(), change.getInserted().

applyRichTextChangeback to summary
public static <PS, SEG, S> Consumer<RichTextChange<PS, SEG, S>> applyRichTextChange(GenericStyledArea<PS, SEG, S> area)

Applies a RichTextChange to the given area when the UndoManager's change stream emits an event by area.replace(change.getPosition(), change.getRemovalEnd(), change.getInserted().

defaultUndoManagerback to summary
public static <PS, SEG, S> UndoManager<C> defaultUndoManager(GenericStyledArea<PS, SEG, S> area)

Constructs an UndoManager with an unlimited history: if the area's preserveStyle flag is true, the returned UndoManager can undo/redo multiple RichTextChanges; otherwise, it can undo/redo multiple PlainTextChanges.

moveToChangeback to summary
private static void moveToChange(GenericStyledArea<PS, SEG, S> area, TextChange<S, Self extends TextChange<S, Self>> chg)
noOpUndoManagerback to summary
public static UndoManager<C> noOpUndoManager()

Constructs an UndoManager with no history

plainTextUndoManagerback to summary
public static <PS, SEG, S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS, SEG, S> area)

Returns an UndoManager with an unlimited history that can undo/redo PlainTextChanges. New changes emitted from the stream will not be merged with the previous change after DEFAULT_PREVENT_MERGE_DELAY

plainTextUndoManagerback to summary
public static <PS, SEG, S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS, SEG, S> area, Duration preventMergeDelay)

Returns an UndoManager that can undo/redo PlainTextChanges. New changes emitted from the stream will not be merged with the previous change after preventMergeDelay

plainTextUndoManagerback to summary
public static <PS, SEG, S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS, SEG, S> area, UndoManagerFactory factory)

Returns an UndoManager that can undo/redo PlainTextChanges. New changes emitted from the stream will not be merged with the previous change after DEFAULT_PREVENT_MERGE_DELAY

plainTextUndoManagerback to summary
public static <PS, SEG, S> UndoManager<List<PlainTextChange>> plainTextUndoManager(GenericStyledArea<PS, SEG, S> area, UndoManagerFactory factory, Duration preventMergeDelay)

Returns an UndoManager that can undo/redo PlainTextChanges. New changes emitted from the stream will not be merged with the previous change after preventMergeDelay

richTextSuspendableUndoManagerback to summary
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/redo RichTextChanges. New changes emitted from the stream will not be merged with the previous change after DEFAULT_PREVENT_MERGE_DELAY

Note

that only styling changes may occur during suspension of the undo manager.

richTextSuspendableUndoManagerback to summary
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/redo RichTextChanges. New changes emitted from the stream will not be merged with the previous change after preventMergeDelay.

Note

that only styling changes may occur during suspension of the undo manager.

richTextUndoManagerback to summary
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/redo RichTextChanges. New changes emitted from the stream will not be merged with the previous change after DEFAULT_PREVENT_MERGE_DELAY

richTextUndoManagerback to summary
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/redo RichTextChanges. New changes emitted from the stream will not be merged with the previous change after preventMergeDelay

richTextUndoManagerback to summary
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/redo RichTextChanges. New changes emitted from the stream will not be merged with the previous change after DEFAULT_PREVENT_MERGE_DELAY

richTextUndoManagerback to summary
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/redo RichTextChanges. New changes emitted from the stream will not be merged with the previous change after preventMergeDelay