public final class UndoUtils
extends java.lang.Object
UndoManager for a GenericStyledArea.| Modifier and Type | Field and Description |
|---|---|
static java.time.Duration |
DEFAULT_PREVENT_MERGE_DELAY |
| Modifier and Type | Method and Description |
|---|---|
static <PS,SEG,S> java.util.function.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(). |
static <PS,SEG,S> java.util.function.Consumer<RichTextChange<PS,SEG,S>> |
applyRichTextChange(GenericStyledArea<PS,SEG,S> area)
Applies a
PlainTextChange to the given area when the UndoManager's change stream emits an event
by area.replace(change.getPosition(), change.getRemovalEnd(), change.getInserted(). |
static <PS,SEG,S> UndoManager |
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 RichTextChanges; otherwise, it can undo/redo PlainTextChanges. |
static <PS,SEG,S> UndoManager<PlainTextChange> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area)
Returns an UndoManager with an unlimited history that can undo/redo
PlainTextChanges. |
static <PS,SEG,S> UndoManager<PlainTextChange> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area,
java.time.Duration preventMergeDelay)
Returns an UndoManager that can undo/redo
PlainTextChanges. |
static <PS,SEG,S> UndoManager<PlainTextChange> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area,
UndoManagerFactory factory)
Returns an UndoManager that can undo/redo
PlainTextChanges. |
static <PS,SEG,S> UndoManager<PlainTextChange> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area,
UndoManagerFactory factory,
java.time.Duration preventMergeDelay)
Returns an UndoManager that can undo/redo
PlainTextChanges. |
static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> |
richTextUndoManager(GenericStyledArea<PS,SEG,S> area)
Returns an UndoManager with an unlimited history that can undo/redo
RichTextChanges. |
static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> |
richTextUndoManager(GenericStyledArea<PS,SEG,S> area,
java.time.Duration preventMergeDelay)
Returns an UndoManager that can undo/redo
RichTextChanges. |
static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> |
richTextUndoManager(GenericStyledArea<PS,SEG,S> area,
UndoManagerFactory factory)
Returns an UndoManager that can undo/redo
RichTextChanges. |
static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> |
richTextUndoManager(GenericStyledArea<PS,SEG,S> area,
UndoManagerFactory factory,
java.time.Duration preventMergeDelay)
Returns an UndoManager that can undo/redo
RichTextChanges. |
static <T> UndoManager<T> |
wrap(UndoManager<T> undoManager,
EventStream<T> changeStream,
java.time.Duration preventMergeDelay)
Deprecated.
No longer needed since UndoFX 1.4.0
|
public static final java.time.Duration DEFAULT_PREVENT_MERGE_DELAY
public static <PS,SEG,S> UndoManager defaultUndoManager(GenericStyledArea<PS,SEG,S> area)
the area's preserveStyle flag is true, the returned UndoManager
can undo/redo RichTextChanges; otherwise, it can undo/redo PlainTextChanges.public static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area)
RichTextChanges. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAYpublic static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, java.time.Duration preventMergeDelay)
RichTextChanges. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelaypublic static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)
RichTextChanges. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAYpublic static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, java.time.Duration preventMergeDelay)
RichTextChanges. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelaypublic static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area)
PlainTextChanges. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAYpublic static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, java.time.Duration preventMergeDelay)
PlainTextChanges. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelaypublic static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)
PlainTextChanges. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAYpublic static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, java.time.Duration preventMergeDelay)
PlainTextChanges. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelaypublic static <PS,SEG,S> java.util.function.Consumer<PlainTextChange> applyPlainTextChange(GenericStyledArea<PS,SEG,S> area)
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> java.util.function.Consumer<RichTextChange<PS,SEG,S>> applyRichTextChange(GenericStyledArea<PS,SEG,S> area)
PlainTextChange to the given area when the UndoManager's change stream emits an event
by area.replace(change.getPosition(), change.getRemovalEnd(), change.getInserted().@Deprecated public static <T> UndoManager<T> wrap(UndoManager<T> undoManager, EventStream<T> changeStream, java.time.Duration preventMergeDelay)
UndoManager and prevents the next emitted change from merging with the previous one are a
period of inactivity (i.e., the changeStream has not emitted an event in preventMergeDelay