/*Element chapter = */DomBoostUtils.appendElement(doc, parentElement, tag, null, chapterNode.getAttributes().getName());
}
int chapterCount = 0;
for (BoostedNode zoomInFocusPoint: chapterNode.getAllZoomInFocus()){
BoostedNode zoomInNode = chapterNode.getZoomIn(zoomInFocusPoint, null);
Object type = zoomInNode.getAttributes().getType();
if (DocumentationResourcesId.CHAPTER.equals(type)) {
BookContext newBookContext = (BookContext) bookContext.clone();
newBookContext.setChapterBreadcrumb(Arrays.copyOf(newBookContext.getChapterBreadcrumb(), newBookContext.getChapterBreadcrumb().length + 1) );
newBookContext.getChapterBreadcrumb()[bookContext.getChapterBreadcrumb().length] = chapterCount++;
fillBookChapter(zoomInNode, newBookContext, doc, parentElement, true);
}else if (HTML.Tag.DIV.equals(type)){
Element div = DomBoostUtils.appendElement(doc, parentElement, HTML.Tag.DIV);
fillBookChapter(zoomInNode, bookContext, doc, div, false);
} else if (TextBoostUtils.TEXT.equals(type)) {
DomBoostUtils.appendText(doc, parentElement, zoomInNode.getAttributes().getValue());
}else if (GeneralConstants.RAW.equals(type)){
DomBoostUtils.appendRaw(doc, parentElement, zoomInNode.getAttributes().getValue());
}else if (GuiBoostUtils.TYPE_IMAGE.equals(type)){
String filename = (String) zoomInNode.getAttributes()
.getFromAttributes(ScriptEngine.FILENAME);
if (filename == null) {
ThreadBoostUtils.sleep(2);// to get a new time
filename = "images/file"
+ System.currentTimeMillis()
+ "."
+ zoomInNode.getAttributes().getFromAttributes(
GeneralConstants.FORMAT);
zoomInNode.getAttributes().setAttribute(
ScriptEngine.FILENAME, filename);
}
Element img = DomBoostUtils.appendElement(doc, parentElement,
HTML.Tag.IMG, ContainerBoostUtils.createMap(
HTML.Attribute.SRC,
"../"
+ filename));// the
// ..
// because
// the
// book
// is
// in
// a
// separate
// subdirectory.
// Go
// up
// to
// the
// main
DocumentationContext documentationContext = getDocumentationContext(zoomInNode);
String documentationTargetDirname = (String) documentationContext
.getFromAttributesMap(DocumentationContext.DOCUMENTATION_TARGET_PARAMETER);
if (documentationTargetDirname == null)
throw new IllegalStateException(
"no documentationTargetDirname");
File documentationTargetDir = new File(
documentationTargetDirname);
if (filename == null)
throw new IllegalStateException("no filename");
FileUtils.writeByteArrayToFile(new File(documentationTargetDir,
filename), (byte[]) zoomInNode.getAttributes()
.getValue());
}else {
warningHandler.handleThrowable(new UnsupportedDataTypeException("type " + type ));
}