use of com.joliciel.jochre.output.TextGetter in project jochre by urieli.
the class TextController method onTimer$startRenderTimer.
@Listen("onTimer = #startRenderTimer")
public void onTimer$startRenderTimer(Event event) {
try {
progressBox.setVisible(true);
if (currentImage != null) {
Html html = new Html();
StringWriter out = new StringWriter();
DocumentObserver textGetter = new TextGetter(out, TextFormat.XHTML);
textGetter.onImageComplete(currentImage);
html.setContent(out.toString());
htmlContent.appendChild(html);
progressMeter1.setValue(100);
// progressBox.setVisible(false);
} else {
if (currentPageIndex < currentDoc.getPages().size()) {
JochrePage page = currentDoc.getPages().get(currentPageIndex);
for (JochreImage image : page.getImages()) {
Html html = new Html();
StringWriter out = new StringWriter();
DocumentObserver textGetter = new TextGetter(out, TextFormat.XHTML);
textGetter.onImageComplete(image);
out.append("<HR/>");
html.setContent(out.toString());
htmlContent.appendChild(html);
}
page.clearMemory();
currentPageIndex++;
double percentComplete = ((double) currentPageIndex / (double) currentDoc.getPages().size()) * 100;
progressMeter1.setValue(new Double(percentComplete).intValue());
startRenderTimer.setRunning(true);
} else {
progressMeter1.setValue(100);
// progressBox.setVisible(false);
}
}
} catch (Exception e) {
LOG.error("Failure in onTimer$startRenderTimer", e);
throw new RuntimeException(e);
}
}
Aggregations