private static WComponent loadUI ( final String key ) { String classname = key . trim ( ) ; try { Class < ? > clas = Class . forName ( classname ) ; if ( WComponent . class . isAssignableFrom ( clas ) ) { WComponent instance = ( WComponent ) clas . newInstance ( ) ; LOG . debug ( "WComponent successfully loaded with class name \"" + classname + "\"." ) ; return instance ; } else { throw new SystemException ( "The resource with the name \"" + classname + "\" is not a WComponent." ) ; } } catch ( Exception ex ) { LOG . error ( "Unable to load a WComponent using the resource name \"" + classname + "\"" , ex ) ; // Are we in developer friendly error mode? boolean friendly = ConfigurationProperties . getDeveloperErrorHandling ( ) ; FatalErrorPageFactory factory = Factory . newInstance ( FatalErrorPageFactory . class ) ; WComponent errorPage = factory . createErrorPage ( friendly , ex ) ; return errorPage ; } }
Attempts to load a UI using the key as a class name .