org.fxmisc.richtext.model.RichTextChange Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of richtextfx Show documentation
Show all versions of richtextfx Show documentation
FX-Text-Area for formatted text and other special effects.
package org.fxmisc.richtext.model;
/**
* An object that specifies where a change occurred in a {@link org.fxmisc.richtext.GenericStyledArea}.
*/
public class RichTextChange extends TextChange, RichTextChange> {
public RichTextChange(int position, StyledDocument removed, StyledDocument inserted) {
super(position, removed, inserted);
}
@Override
protected int removedLength() {
return removed.length();
}
@Override
protected int insertedLength() {
return inserted.length();
}
@Override
protected final StyledDocument concat(StyledDocument a, StyledDocument b) {
return a.concat(b);
}
@Override
protected final StyledDocument sub(StyledDocument doc, int from, int to) {
return doc.subSequence(from, to);
}
@Override
protected final RichTextChange create(int position, StyledDocument removed, StyledDocument inserted) {
return new RichTextChange<>(position, removed, inserted);
}
public final PlainTextChange toPlainTextChange() {
return new PlainTextChange(position, removed.getText(), inserted.getText());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy