((MapStack) context).push();
}
String name = this.getName(context);
String location = this.getLocation(context);
ModelTree modelTree = null;
try {
modelTree = TreeFactory.getTreeFromLocation(this.getLocation(context), this.getName(context), this.modelScreen.getDelegator(context), this.modelScreen.getDispatcher(context));
} catch (IOException e) {
String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();
Debug.logError(e, errMsg, module);
throw new RuntimeException(errMsg);
} catch (SAXException e) {
String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();
Debug.logError(e, errMsg, module);
throw new RuntimeException(errMsg);
} catch (ParserConfigurationException e) {
String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();
Debug.logError(e, errMsg, module);
throw new RuntimeException(errMsg);
}
// try finding the treeStringRenderer by name in the context in case one was prepared and put there
TreeStringRenderer treeStringRenderer = (TreeStringRenderer) context.get("treeStringRenderer");
// if there was no treeStringRenderer put in place, now try finding the request/response in the context and creating a new one
if (treeStringRenderer == null) {
treeStringRenderer = new HtmlTreeRenderer();
/*
String renderClassStyle = modelTree.getRenderStyle();
if (UtilValidate.isNotEmpty(renderClassStyle) && renderClassStyle.equals("simple"))
treeStringRenderer = new HtmlTreeRenderer();
else
treeStringRenderer = new HtmlTreeExpandCollapseRenderer();
*/
}
// still null, throw an error
if (treeStringRenderer == null) {
throw new IllegalArgumentException("Could not find a treeStringRenderer in the context, and could not find HTTP request/response objects need to create one.");
}
StringBuffer renderBuffer = new StringBuffer();
modelTree.renderTreeString(renderBuffer, context, treeStringRenderer);
try {
writer.append(renderBuffer.toString());
} catch (IOException e) {
String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();
Debug.logError(e, errMsg, module);