Package swingtree
Class TextReplaceDelegate
java.lang.Object
swingtree.AbstractTextComponentDelegate
swingtree.TextReplaceDelegate
A delegate object for the
This delegate provides useful context information to the action listener, such as the text component itself, the
Action
lambda passed
to the UIForAnyTextComponent.onTextReplace(Action)
method,
which is used to register a listener for text replacement events.
This delegate provides useful context information to the action listener, such as the text component itself, the
DocumentFilter.FilterBypass
object that can be used to replace text in the document, the offset at which
the text is to be replaced and the length of the text to be replaced.-
Method Summary
Methods inherited from class swingtree.AbstractTextComponentDelegate
getComponent, getFilterBypass, getLength, getOffset
-
Method Details
-
getText
Exposes the text to insert where an empty string indicates no text is to be inserted.- Returns:
- The text to be inserted or an empty
String
indicating that no text is to be inserted. Null is never returned.
-
getReplacementText
Exposes the text to be replaced or an emptyString
indicating that no text is to be replaced. Null is never returned.- Returns:
- The text to be removed.
-
getAttributeSet
Exposes the attribute set of the text to be replaced. It is a collection of unique attributes in the form of a read-only, immutable interface. A single attribute is basically a key and a value assigned to the key. The collection may represent something like a style run, a logical style, etc. These are generally used to describe features that will contribute to some graphical representation such as a font.
See
DocumentFilter.replace(DocumentFilter.FilterBypass, int, int, String, AttributeSet)
for more information about the origin of this attribute.- Returns:
- The attribute set of the text to be inserted.
-