Layout parseLayout (Element layout_element) {
String className = layout_element.getAttribute(CLASS_ATTR);
LogLog.debug("Parsing layout of class: \""+className+"\"");
try {
Object instance = Class.forName(className).newInstance();
Layout layout = (Layout)instance;
NodeList params = layout_element.getChildNodes();
final int length = params.getLength();
for (int loop = 0; loop < length; loop++) {
Node currentNode = (Node)params.item(loop);
if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
Element currentElement = (Element) currentNode;
String tagName = currentElement.getTagName();
if(tagName.equals(PARAM_TAG)) {
parseParameters(currentElement, layout);
}
}
}
/* Now make those options take effect */
layout.activateOptions();
return layout;
}
catch (Exception oops) {
LogLog.error("Could not create the Layout. Reported error follows.",
oops);