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 RichTextChange s; otherwise, it can undo/redo PlainTextChange s. |
static <PS,SEG,S> UndoManager<PlainTextChange> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area)
Returns an UndoManager with an unlimited history that can undo/redo
PlainTextChange s. |
static <PS,SEG,S> UndoManager<PlainTextChange> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area,
java.time.Duration preventMergeDelay)
Returns an UndoManager that can undo/redo
PlainTextChange s. |
static <PS,SEG,S> UndoManager<PlainTextChange> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area,
UndoManagerFactory factory)
Returns an UndoManager that can undo/redo
PlainTextChange s. |
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
PlainTextChange s. |
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
RichTextChange s. |
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
RichTextChange s. |
static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> |
richTextUndoManager(GenericStyledArea<PS,SEG,S> area,
UndoManagerFactory factory)
Returns an UndoManager that can undo/redo
RichTextChange s. |
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
RichTextChange s. |
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 RichTextChange
s; otherwise, it can undo/redo PlainTextChange
s.public static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area)
RichTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAY
public static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, java.time.Duration preventMergeDelay)
RichTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelay
public static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)
RichTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAY
public static <PS,SEG,S> UndoManager<RichTextChange<PS,SEG,S>> richTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, java.time.Duration preventMergeDelay)
RichTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelay
public static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area)
PlainTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAY
public static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, java.time.Duration preventMergeDelay)
PlainTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelay
public static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory)
PlainTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after DEFAULT_PREVENT_MERGE_DELAY
public static <PS,SEG,S> UndoManager<PlainTextChange> plainTextUndoManager(GenericStyledArea<PS,SEG,S> area, UndoManagerFactory factory, java.time.Duration preventMergeDelay)
PlainTextChange
s. New changes
emitted from the stream will not be merged with the previous change
after preventMergeDelay
public 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