use of com.joliciel.jochre.web.ImageController.LetterLabelUpdater in project jochre by urieli.
the class FixTextWindowController method onClick$btnOK.
@Listen("onClick = #btnOK")
public void onClick$btnOK(Event event) {
// TODO: replacing all occurrences of the same word on the line instead
// of just the current one
LOG.debug("onClick$btnOK");
winFixText.setVisible(false);
String rowText = (String) winFixText.getAttribute(FixTextWindowController.ATTR_ROW_TEXT);
Textbox rowTextBox = (Textbox) winFixText.getAttribute(FixTextWindowController.ATTR_ROW_TEXTBOX);
LetterLabelUpdater updater = (LetterLabelUpdater) winFixText.getAttribute(FixTextWindowController.ATTR_LETTER_UPDATER);
GroupOfShapes group = (GroupOfShapes) winFixText.getAttribute(FixTextWindowController.ATTR_GROUP);
group.setSkip(chkSkip.isChecked());
group.setHardHyphen(chkHardHyphen.isChecked());
group.setBrokenWord(chkBrokenWord.isChecked());
group.setSegmentationProblem(chkSegmentProblem.isChecked());
group.save();
List<Textbox> letterBoxes = new ArrayList<Textbox>();
for (Object child : letterBoxRow.getChildren()) {
if (child instanceof Textbox) {
letterBoxes.add((Textbox) child);
}
}
StringBuilder sb = new StringBuilder();
// for (Textbox letterBox : letterBoxes) {
for (Shape shape : group.getShapes()) {
Textbox letterBox = (Textbox) letterBoxRow.getFellow("FixTextLetterBox_" + shape.getId());
String letter = letterBox.getText();
String newLetter = ImageController.getLetterForDisplay(letter);
LOG.debug("Letter: " + letter + ", newLetter: " + newLetter);
sb.append(newLetter);
}
LOG.debug(sb.toString());
String newText = rowText.replace(FixTextWindowController.ROW_TEXT_PLACE_HOLDER, sb.toString());
rowTextBox.setText(newText);
updater.updateLetterLabels();
}
Aggregations