if ( r == null ) {
loadSingleTarget( pageDisplay );
return true;
}
XmlElement model = XmlSource.read( r );
Vector componentNodes = model.getChildren();
int numChildren = componentNodes.size();
if ( numChildren == 0 ) {
if ( !"NONE".equals( currentProject.getStartupParam( "DefaultTarget" )))
loadSingleTarget( pageDisplay );
return true;
}
Hashtable framesetParams = new Hashtable();
Enumeration framesetAttribNames = model.enumerateAttributeNames();
while ( framesetAttribNames.hasMoreElements()) {
String attribName = (String)framesetAttribNames.nextElement();
framesetParams.put( attribName, (String)model.getAttribute( attribName ));
}
pageDisplay.setupFrameset( framesetParams );
for ( int i = 0; i < numChildren; i++ ) {
XmlElement childNode = ( XmlElement )componentNodes.elementAt( i );
String typeStr = childNode.getName();
String targetName = childNode.getAttribute( "name" );
String pageName = childNode.getAttribute( "content" );
Hashtable params = new Hashtable();
Enumeration attribNames = childNode.enumerateAttributeNames();
while ( attribNames.hasMoreElements()) {
String attribName = (String)attribNames.nextElement();
params.put( attribName, (String)childNode.getAttribute( attribName ));
}
if ( typeStr.equals( "Frame" )) {
try {
Object constraint = layoutHelper.getConstraint( childNode.getAttribute( "constraint" ));
int preferredWidth = new Integer( childNode.getAttribute( "width" ) ).intValue();
int preferredHeight = new Integer( childNode.getAttribute( "height" ) ).intValue();
XContentHolder target;
if ( addFrames )
target = pageDisplay.addTarget( targetName, constraint,
preferredWidth,
preferredHeight,
params );
else {/** @todo set the target parameters for this new frame */
target = (XContentHolder)pageDisplay.findTarget( targetName );
target.setup( targetName, preferredWidth, preferredHeight, params );
}
if ( pageName != null ) {
target.setContent( pageName );
PageSupport targetPage = currentProject.getPageManager().loadPage( pageName );
pageDisplay.displayPage( targetPage, targetName );
}
}
catch ( NumberFormatException ex1 ) {
ex1.printStackTrace();
}
}
else if ( typeStr.equals( "Toolbar" )) {
String constraint = childNode.getAttribute( "constraint" );
PageSupport toolbar = currentProject.getPageManager().loadPage( pageName );
pageDisplay.displayDecoration( toolbar, constraint );
}
}
pageDisplay.doLayout();