Add the required Javascript files and the FontAwesome CDN link.

@param root    The UIViewRoot of the JSF tree.
@param context The current FacesContext
180031
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);
	}
1351090
private void initContextMenu() {

        m_contextMenu.removeItems();
        MenuItem main = m_contextMenu.addItem("", null);
        main.setIcon(FontOpenCms.CONTEXT_MENU);
        main.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_MENU_TITLE_0));
        CmsContextMenuTreeBuilder treeBuilder = new CmsContextMenuTreeBuilder(getDialogContext());
        CmsTreeNode<I_CmsContextMenuItem> tree = treeBuilder.buildAll(
            OpenCms.getWorkplaceAppManager().getMenuItemProvider().getMenuItems());
        for (CmsTreeNode<I_CmsContextMenuItem> node : tree.getChildren()) {
            createMenuEntry(main, node, treeBuilder);
        }
    }
975786
public void initFaces(ServletContext servletContext)
    {
        try
        {
            if (log.isLoggable(Level.FINEST))
            {
                log.finest("Initializing MyFaces");
            }

            // Some parts of the following configuration tasks have been implemented 
            // by using an ExternalContext. However, that's no problem as long as no 
            // one tries to call methods depending on either the ServletRequest or 
            // the ServletResponse.
            // JSF 2.0: FacesInitializer now has some new methods to
            // use proper startup FacesContext and ExternalContext instances.
            FacesContext facesContext = FacesContext.getCurrentInstance();
            ExternalContext externalContext = facesContext.getExternalContext();

            // Setup ServiceProviderFinder
            ServiceProviderFinder spf = ServiceProviderFinderFactory.getServiceProviderFinder(
                externalContext);
            Map<String, List<String>> spfConfig = spf.calculateKnownServiceProviderMapInfo(
                externalContext, ServiceProviderFinder.KNOWN_SERVICES);
            if (spfConfig != null)
            {
                spf.initKnownServiceProviderMapInfo(externalContext, spfConfig);
            }
                        
            // Parse and validate the web.xml configuration file
            
            if (!WebConfigParamUtils.getBooleanInitParameter(externalContext, INITIALIZE_ALWAYS_STANDALONE, false))
            {
                WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebConfigProviderFactory(
                        facesContext.getExternalContext()).getWebConfigProvider(facesContext.getExternalContext());

                if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty())
                {
                    // check to see if the FacesServlet was found by MyFacesContainerInitializer
                    Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_FOUND);

                    if (mappingAdded == null || !mappingAdded)
                    {
                        // check if the FacesServlet has been added dynamically
                        // in a Servlet 3.0 environment by MyFacesContainerInitializer
                        mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);

                        if (mappingAdded == null || !mappingAdded)
                        {
                            if (log.isLoggable(Level.WARNING))
                            {
                                log.warning("No mappings of FacesServlet found. Abort initializing MyFaces.");
                            }
                            return;
                        }
                    }
                }
            }

            initCDIIntegration(servletContext, externalContext);
            
            initContainerIntegration(servletContext, externalContext);
            
            ViewScopeProviderFactory factory = ViewScopeProviderFactory.getViewScopeHandlerFactory(
                externalContext);
            
            ViewScopeProvider viewScopeHandler = factory.getViewScopeHandler(
                externalContext);
            
            ManagedBeanDestroyerListener listener = (ManagedBeanDestroyerListener)
                externalContext.getApplicationMap().get(
                    ManagedBeanDestroyerListener.APPLICATION_MAP_KEY);
            
            listener.setViewScopeHandler(viewScopeHandler);

            String useEncryption = servletContext.getInitParameter(StateUtils.USE_ENCRYPTION);
            if (!"false".equals(useEncryption)) // the default value is true
            {
                StateUtils.initSecret(servletContext);
            }

            // initialize eager managed beans
            _createEagerBeans(facesContext);

            _dispatchApplicationEvent(servletContext, PostConstructApplicationEvent.class);

            if ( (facesContext.isProjectStage(ProjectStage.Development) || 
                  facesContext.isProjectStage(ProjectStage.Production)) &&
                 log.isLoggable(Level.INFO))
            {
                log.info("ServletContext initialized.");
            }

            WebConfigParamsLogger.logWebContextParams(facesContext);
            
            //Force output EL message
            ExternalSpecifications.isUnifiedELAvailable();
            ExternalSpecifications.isBeanValidationAvailable();
            
            //Start ViewPoolProcessor if necessary
            ViewPoolProcessor.initialize(facesContext);

            // print out a very prominent log message if the project stage is != Production
            if (!facesContext.isProjectStage(ProjectStage.Production) &&
                !facesContext.isProjectStage(ProjectStage.UnitTest))
            {
                ProjectStage projectStage = facesContext.getApplication().getProjectStage();
                StringBuilder message = new StringBuilder("\n\n");
                message.append("*******************************************************************\n");
                message.append("*** WARNING: Apache MyFaces-2 is running in ");
                message.append(projectStage.name().toUpperCase());        
                message.append(" mode.");
                int length = projectStage.name().length();
                for (int i = 0; i < 11 - length; i++)
                {
                    message.append(" ");
                }
                message.append("   ***\n");
                message.append("***                                         ");
                for (int i = 0; i < length; i++)
                {
                    message.append("^");
                }
                for (int i = 0; i < 20 - length; i++)
                {
                    message.append(" ");
                }
                message.append("***\n");
                message.append("*** Do NOT deploy to your live server(s) without changing this. ***\n");
                message.append("*** See Application#getProjectStage() for more information.     ***\n");
                message.append("*******************************************************************\n");
                log.log(Level.WARNING, message.toString());
            }

        }
        catch (Exception ex)
        {
            log.log(Level.SEVERE, "An error occured while initializing MyFaces: "
                      + ex.getMessage(), ex);
        }
    }
1215583
public void addContextMenuTreeListener(
        CmsContextMenu.ContextMenuOpenedListener.TreeListener contextMenuTreeListener) {

        addListener(
            ContextMenuOpenedOnTreeItemEvent.class,
            contextMenuTreeListener,
            ContextMenuOpenedListener.TreeListener.MENU_OPENED_FROM_TREE_ITEM_METHOD);
    }
353520
public void setRoot(int context, Object environment)
  {
    super.setRoot(context, environment);
    m_traverser = m_cdtm.getAxisTraverser(m_axis);
    
  }
173484
public static void addListener(Document doc, Element root) {
    Element listener = doc.createElement("listener");
    Element listenerClass = doc.createElement("listener-class");
    listener.appendChild(listenerClass);
    listenerClass.appendChild(doc
        .createTextNode("org.apache.shiro.web.env.EnvironmentLoaderListener"));

    addRelativeTo(root, listener, "listener", true);
  }
647308
public static void initialize(FacesContext context)
    {
        if (context.isProjectStage(ProjectStage.Production))
        {
            boolean initialize = true;
            String elMode = WebConfigParamUtils.getStringInitParameter(
                        context.getExternalContext(),
                        FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS, 
                            ELExpressionCacheMode.noCache.name());
            if (!elMode.equals(ELExpressionCacheMode.alwaysRecompile.name()))
            {
                Logger.getLogger(ViewPoolProcessor.class.getName()).log(
                    Level.INFO, FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS +
                    " web config parameter is set to \"" + ( (elMode == null) ? "none" : elMode) +
                    "\". To enable view pooling this param"+
                    " must be set to \"alwaysRecompile\". View Pooling disabled.");
                initialize = false;
            }
            
            long refreshPeriod = WebConfigParamUtils.getLongInitParameter(context.getExternalContext(),
                    FaceletViewDeclarationLanguage.PARAMS_REFRESH_PERIOD,
                    FaceletViewDeclarationLanguage.DEFAULT_REFRESH_PERIOD_PRODUCTION);

            if (refreshPeriod != -1)
            {
                Logger.getLogger(ViewPoolProcessor.class.getName()).log(
                    Level.INFO, ViewHandler.FACELETS_REFRESH_PERIOD_PARAM_NAME +
                    " web config parameter is set to \"" + Long.toString(refreshPeriod) +
                    "\". To enable view pooling this param"+
                    " must be set to \"-1\". View Pooling disabled.");
                initialize = false;
            }
            
            if (MyfacesConfig.getCurrentInstance(context.getExternalContext()).isStrictJsf2FaceletsCompatibility())
            {
                Logger.getLogger(ViewPoolProcessor.class.getName()).log(
                    Level.INFO, MyfacesConfig.INIT_PARAM_STRICT_JSF_2_FACELETS_COMPATIBILITY +
                    " web config parameter is set to \"" + "true" +
                    "\". To enable view pooling this param "+
                    " must be set to \"false\". View Pooling disabled.");
                initialize = false;
            }
            
            if (initialize)
            {
                ViewPoolProcessor processor = new ViewPoolProcessor(context);
                context.getExternalContext().
                    getApplicationMap().put(INSTANCE, processor);
            }
        }
    }
864082
def add(element, element_id=nil, options={}, &block)
      # make sure we have a target - raises NoContextError if none exists
      self.target

      unless @context
        create_default_root_context
      end

      # We want to be sure that the element has a supeview or superlayer before
      # the style method is called.
      element = initialize_element(element, element_id)
      self.apply(:add_child, element, options)
      style_and_context(element, element_id, &block)

      element
    end
907212
public void setContext(DisplayContext context) {
        if (context.type() == DisplayContext.Type.CAPITALIZATION) {
            capitalizationSetting = context;
        }
    }
228551
def add(self, root):
        
        node = Element('import', ns=self.xsdns)
        node.set('namespace', self.ns)
        if self.location is not None:
            node.set('schemaLocation', self.location)
        log.debug('%s inserted', node)
        root.insert(node)
685733
protected void addLinkedResources(String path, GeneratorContext context) {
		List<Locale> locales = new ArrayList<>();
		Locale currentLocale = context.getLocale();
		if (currentLocale != null) {
			locales.add(currentLocale);
			if (StringUtils.isNotEmpty(currentLocale.getVariant())) {
				locales.add(new Locale(currentLocale.getCountry(), currentLocale.getLanguage()));
			}
			if (StringUtils.isNotEmpty(currentLocale.getLanguage())) {
				locales.add(new Locale(currentLocale.getCountry()));
			}
		}

		// Adds fallback locale
		locales.add(control.getFallbackLocale());
		Locale baseLocale = new Locale("", "");
		if (!locales.contains(baseLocale)) {
			locales.add(baseLocale);
		}

		List<FilePathMapping> fMappings = getFileMappings(path, context, locales);
		addLinkedResources(path, context, fMappings);

	}
1200440
function Context(view, parentContext) {
    this.view = view == null ? {} : view;
    this.cache = { '.': this.view };
    this.parent = parentContext;
  }
1070032
protected void setViewBuilt(FacesContext facesContext, UIViewRoot view)
  {
      facesContext.getAttributes().put(view, Boolean.TRUE);
  }
33246
public function setupContext($context = null) {
        $this->fragment = true;
        if ($context) {
            $context = $this->dom->createElementNS(self::NS_HTML, $context);
            /* 4.1. Set the HTML parser's tokenization  stage's content model
             * flag according to the context element, as follows: */
            switch ($context->tagName) {
                case 'title': case 'textarea':
                    $this->content_model = HTML5_Tokenizer::RCDATA;
                    break;
                case 'style': case 'script': case 'xmp': case 'iframe':
                case 'noembed': case 'noframes':
                    $this->content_model = HTML5_Tokenizer::CDATA;
                    break;
                case 'noscript':
                    // XSCRIPT: assuming scripting is enabled
                    $this->content_model = HTML5_Tokenizer::CDATA;
                    break;
                case 'plaintext':
                    $this->content_model = HTML5_Tokenizer::PLAINTEXT;
                    break;
            }
            /* 4.2. Let root be a new html element with no attributes. */
            $root = $this->dom->createElementNS(self::NS_HTML, 'html');
            $this->root = $root;
            /* 4.3 Append the element root to the Document node created above. */
            $this->dom->appendChild($root);
            /* 4.4 Set up the parser's stack of open elements so that it
             * contains just the single element root. */
            $this->stack = array($root);
            /* 4.5 Reset the parser's insertion mode appropriately. */
            $this->resetInsertionMode($context);
            /* 4.6 Set the parser's form element pointer  to the nearest node
             * to the context element that is a form element (going straight up
             * the ancestor chain, and including the element itself, if it is a
             * form element), or, if there is no such form element, to null. */
            $node = $context;
            do {
                if ($node->tagName === 'form') {
                    $this->form_pointer = $node;
                    break;
                }
            } while ($node = $node->parentNode);
        }
    }
52479
function (root) {
        var current = root.prototype ? root.prototype.addEventListener : root.addEventListener;

        var customAddEventListener = function (name, func, capture) {
            // Branch when a PointerXXX is used
            if (supportedEventsNames.indexOf(name) !== -1) {
                setTouchAware(this, name, true);
            }

            if (current === undefined) {
                this.attachEvent('on' + getMouseEquivalentEventName(name), func);
            } else {
                current.call(this, name, func, capture);
            }
        };

        if (root.prototype) {
            root.prototype.addEventListener = customAddEventListener;
        } else {
            root.addEventListener = customAddEventListener;
        }
    }
201315
public void setRoot(int context, Object environment)
  {

    super.setRoot(context, environment);
    
    if(null != m_firstWalker)
    {
      m_firstWalker.setRoot(context);
      m_lastUsedWalker = m_firstWalker;
    }
  }
831617
private synchronized void addContext(final EvaluatorContext context) {
    this.contextStack.add(context);
    this.contextIds.add(context.getId());
  }