* @return A ConcreteElement.
* @exception Exception, a generic exception.
*/
public ConcreteElement buildTemplate( RunData data ) throws Exception
{
WebContext context = getContext(data);
// This will already be properly set and will not be null
// because of WebMacroSitePage.
String templateName = data.getTemplateInfo().getScreenTemplate();
// Template service adds the leading slash, but make it sure.
if ((templateName.length() > 0) &&
(templateName.charAt(0) != '/'))
{
templateName = '/' + templateName;
}
StringElement output = new StringElement();
output.setFilterState(false);
String screenData = null;
try
{
screenData = buildWMTemplate(context, "screens" + templateName);
}
catch (Exception e)
{
// If there is an error, build a $processingException and
// attempt to call the error.wm template in the screens
// directory.
context.put( "processingException", e.toString() );
context.put( "stackTrace", StringUtils.stackTrace(e) );
templateName = TurbineResources.getString(
"template.error", "/error.wm");
if ((templateName.length() > 0) &&
(templateName.charAt(0) != '/'))
{