org.fxmisc.richtext.model.NodeSegmentOpsBase 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
Rich-text area for JavaFX
The newest version!
package org.fxmisc.richtext.model;
import java.util.Optional;
/**
* Properly implements {@link SegmentOps} when implementing a non-text custom object, such as a shape or image,
* and reduces boilerplate. Developers may want to override {@link #joinSeg(Object, Object)} and
* {@link #joinStyle(Object, Object)}.
*
* @param type of segment
* @param type of style
*/
public abstract class NodeSegmentOpsBase extends SegmentOpsBase {
public NodeSegmentOpsBase(SEG empty) {
super(empty);
}
@Override
public char realCharAt(SEG seg, int index) {
return '\ufffc';
}
@Override
public String realGetText(SEG seg) {
return "\ufffc";
}
@Override
public SEG realSubSequence(SEG seg, int start, int end) {
return seg;
}
@Override
public SEG realSubSequence(SEG seg, int start) {
return seg;
}
@Override
public Optional joinSeg(SEG currentSeg, SEG nextSeg) {
return Optional.empty();
}
}