private void addJavascript ( UIViewRoot root , FacesContext context ) { // The following code is needed to diagnose the warning "Unable to save dynamic // action with clientId 'j_id...'" // List<UIComponent> r = root.getComponentResources(context, "head"); // System.out.println("**************"); // for (UIComponent ava : r) { // String name = (String) ava.getAttributes().get("name"); // System.out.println(ava.getClientId(context) +":" + name + " " + // ava.getClass().getSimpleName()); // } // System.out.println("**************"); // end of the diagnostic code boolean loadJQuery = shouldLibraryBeLoaded ( P_GET_JQUERY_FROM_CDN , true ) ; boolean loadJQueryUI = shouldLibraryBeLoaded ( P_GET_JQUERYUI_FROM_CDN , true ) ; // Do we have to add jQuery, or are the resources already there? List < UIComponent > availableResources = root . getComponentResources ( context , "head" ) ; for ( UIComponent ava : availableResources ) { String name = ( String ) ava . getAttributes ( ) . get ( "name" ) ; if ( null != name ) { name = name . toLowerCase ( ) ; if ( ( name . contains ( "/jquery-ui" ) || name . startsWith ( "jquery-ui" ) ) && name . endsWith ( ".js" ) ) loadJQueryUI = false ; else if ( ( name . contains ( "/jquery" ) || name . startsWith ( "jquery" ) ) && name . endsWith ( ".js" ) ) loadJQuery = false ; } } addMandatoryLibraries ( root , context , loadJQuery , loadJQueryUI ) ; String blockUI = BsfUtils . getInitParam ( P_BLOCK_UI , context ) ; if ( null != blockUI ) blockUI = ELTools . evalAsString ( blockUI ) ; if ( null != blockUI && isTrueOrYes ( blockUI ) ) { createAndAddComponent ( root , context , SCRIPT_RENDERER , "js/jquery.blockUI.js" , C . BSF_LIBRARY ) ; } removeDuplicateResources ( root , context ) ; addResourceIfNecessary ( root , context , new InternalIE8CompatiblityLinks ( ) ) ; enforceCorrectLoadOrder ( root , context ) ; }
Add the required Javascript files and the FontAwesome CDN link .