private Template getTemplate ( final WComponent component ) { String templateUrl = url ; if ( templateUrl == null && component instanceof AbstractWComponent ) { templateUrl = ( ( AbstractWComponent ) component ) . getTemplate ( ) ; } if ( templateUrl != null ) { try { return VelocityEngineFactory . getVelocityEngine ( ) . getTemplate ( templateUrl ) ; } catch ( Exception ex ) { // If the resource is not available (eg if the template does not // exist), paint using a default layout and inform the user // of what's going on in the html comments. LOG . warn ( "Could not open " + templateUrl , ex ) ; try { return VelocityEngineFactory . getVelocityEngine ( ) . getTemplate ( NO_TEMPLATE_LAYOUT ) ; } catch ( Exception e ) { LOG . error ( "Failed to read no template layout" , e ) ; } } } return null ; }
Retrieves the Velocity template for the given component .