use of eu.transkribus.core.model.beans.pagecontent_trp.observable.TrpObserveEvent.TrpTextChangedEvent in project TranskribusCore by Transkribus.
the class TrpShapeTypeUtils method setUnicodeText.
public static void setUnicodeText(ITrpShapeType shape, String unicode, Object who) {
logger.trace("setting unicode text in " + shape.getName() + ", id: " + shape.getId() + ", text: " + unicode);
int lBefore = shape.getUnicodeText().length();
TextEquivType te = new TextEquivType();
te.setUnicode(unicode);
shape.setTextEquiv(te);
shape.getCustomTagList().onTextEdited(0, lBefore, unicode);
shape.getObservable().setChangedAndNotifyObservers(new TrpTextChangedEvent(who, 0, lBefore, unicode));
}
use of eu.transkribus.core.model.beans.pagecontent_trp.observable.TrpObserveEvent.TrpTextChangedEvent in project TranskribusCore by Transkribus.
the class TrpShapeTypeUtils method editUnicodeText.
public static void editUnicodeText(ITrpShapeType shape, int start, int end, String replacement, Object who) {
logger.trace("editing unicode text in " + shape.getName() + ", id: " + shape.getId() + ", start/end: " + start + "/" + end + ", text: " + replacement);
StringBuilder sb = new StringBuilder(shape.getUnicodeText());
sb.replace(start, end, replacement);
String unicode = sb.toString();
if (shape instanceof TrpWordType && unicode.equals(TrpWordType.EMPTY_WORD_FILL)) {
unicode = "";
replacement = "";
}
TextEquivType te = new TextEquivType();
te.setUnicode(unicode);
shape.setTextEquiv(te);
SebisStopWatch.SW.start();
shape.getCustomTagList().onTextEdited(start, end, replacement);
SebisStopWatch.SW.stop(true, "onTextEdited: ", logger);
shape.getObservable().setChangedAndNotifyObservers(new TrpTextChangedEvent(who, start, end, replacement));
}
Aggregations