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<java.util.List<PlainTextChange>> |
applyMultiPlainTextChange(GenericStyledArea<PS,SEG,S> area)
Applies a list of
PlainTextChange s to the given area when the UndoManager 's change stream emits
an event by area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted() . |
static <PS,SEG,S> java.util.function.Consumer<java.util.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() . |
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
RichTextChange 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 multiple RichTextChange s; otherwise, it can undo/redo multiple PlainTextChange s. |
static <PS,SEG,S> UndoManager<java.util.List<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<java.util.List<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<java.util.List<PlainTextChange>> |
plainTextUndoManager(GenericStyledArea<PS,SEG,S> area,
UndoManagerFactory factory)
Returns an UndoManager that can undo/redo
PlainTextChange s. |
static <PS,SEG,S> UndoManager<java.util.List<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<java.util.List<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<java.util.List<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<java.util.List<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<java.util.List<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. |
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 multiple RichTextChange
s; otherwise, it can undo/redo multiple PlainTextChange
s.public static <PS,SEG,S> UndoManager<java.util.List<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<java.util.List<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<java.util.List<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<java.util.List<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<java.util.List<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<java.util.List<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<java.util.List<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<java.util.List<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)
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> java.util.function.Consumer<java.util.List<PlainTextChange>> applyMultiPlainTextChange(GenericStyledArea<PS,SEG,S> area)
PlainTextChange
s 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> java.util.function.Consumer<java.util.List<RichTextChange<PS,SEG,S>>> applyMultiRichTextChange(GenericStyledArea<PS,SEG,S> area)
RichTextChange
to the given area when the UndoManager
's change stream emits
an event by area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted()
.