Package javax.faces.application

Examples of javax.faces.application.ProjectStage


            DefaultLifecycleProviderFactory.getLifecycleProviderFactory().getLifecycleProvider(externalContext);
           
            // print out a very prominent log message if the project stage is != Production
            if (!FacesContext.getCurrentInstance().isProjectStage(ProjectStage.Production))
            {
                ProjectStage projectStage = FacesContext.getCurrentInstance().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");
 
View Full Code Here


         * Warn the user if the ALT attribute is missing.
         */               
        if (uiComponent.getAttributes().get(HTML.ALT_ATTR) == null)
        {
            //we don't want to flood logs with warnings in production and system test environments
            ProjectStage projectStage = facesContext.getApplication().getProjectStage();
            if(projectStage.equals(ProjectStage.Development) || projectStage.equals(ProjectStage.UnitTest))
                log.warning("ALT attribute is missing for : " + uiComponent.getId());
        }

        Map<String, List<ClientBehavior>> behaviors = null;
        if (uiComponent instanceof ClientBehaviorHolder && JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext()))
View Full Code Here

            // 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");
 
View Full Code Here

        if (localePrefix != null) {
            uri += ((queryStarted) ? "&loc=" : "?loc=") + localePrefix;
            queryStarted = true;
        }
        if ("jsf.js".equals(getResourceName()) && "javax.faces".equals(getLibraryName())) {
            ProjectStage stage = context.getApplication().getProjectStage();
            switch (stage) {
                case Development:
                    uri += ((queryStarted) ? "&stage=Development" : "?stage=Development" );
                    break;
                case SystemTest:
                    uri += ((queryStarted) ? "&stage=SystemTest" : "?stage=SystemTest" );
                    break;
                case UnitTest:
                    uri += ((queryStarted) ? "&stage=UnitTest" : "?stage=UnitTest" );
                    break;
                default:
                    assert(stage.equals(ProjectStage.Production));
            }
        }

        uri = context.getApplication().getViewHandler()
              .getResourceURL(context,
View Full Code Here

            uri += ((queryStarted) ? "&con=" : "?con=") + contract;
            queryStarted = true;
        }
       
        if ("jsf.js".equals(getResourceName()) && "javax.faces".equals(getLibraryName())) {
            ProjectStage stage = context.getApplication().getProjectStage();
            switch (stage) {
                case Development:
                    uri += ((queryStarted) ? "&stage=Development" : "?stage=Development" );
                    break;
                case SystemTest:
                    uri += ((queryStarted) ? "&stage=SystemTest" : "?stage=SystemTest" );
                    break;
                case UnitTest:
                    uri += ((queryStarted) ? "&stage=UnitTest" : "?stage=UnitTest" );
                    break;
                default:
                    assert(stage.equals(ProjectStage.Production));
            }
        }

        uri = context.getApplication().getViewHandler()
              .getResourceURL(context,
View Full Code Here

            _dispatchApplicationEvent(servletContext, PostConstructApplicationEvent.class);
           
            // print out a very prominent log message if the project stage is != Production
            if (!facesContext.isProjectStage(ProjectStage.Production))
            {
                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");
 
View Full Code Here

            _dispatchApplicationEvent(servletContext, PostConstructApplicationEvent.class);
           
            // print out a very prominent log message if the project stage is != Production
            if (!facesContext.isProjectStage(ProjectStage.Production))
            {
                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");
 
View Full Code Here

    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        ConfigContainer cc = RequestContext.getCurrentInstance().getApplicationContext().getConfig();
        ProjectStage projectStage = context.getApplication().getProjectStage();
       
        if (cc.isClientSideValidationEnabled()) {
            ResourceUtils.addComponentResource(context, "validation/validation.js");
            if (cc.isBeanValidationAvailable()) {
                ResourceUtils.addComponentResource(context, "validation/beanvalidation.js");
            }
        }
       
        writer.startElement("head", component);
       
        //First facet
        UIComponent first = component.getFacet("first");
        if (first != null) {
            first.encodeAll(context);
        }
       
        //Theme
        String theme;
        String themeParamValue = RequestContext.getCurrentInstance().getApplicationContext().getConfig().getTheme();

        if (themeParamValue != null) {
            ELContext elContext = context.getELContext();
            ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
            ValueExpression ve = expressionFactory.createValueExpression(elContext, themeParamValue, String.class);

            theme = (String) ve.getValue(elContext);
        }
        else {
            theme = "aristo";   //default
        }

        if (theme != null && !theme.equals("none")) {
            encodeCSS(context, "primefaces-" + theme, "theme.css");
        }
       
        if (cc.isFontAwesomeEnabled()) {
            encodeCSS(context, "primefaces", "fa/font-awesome.css");
        }
       
        //Middle facet
        UIComponent middle = component.getFacet("middle");
        if (middle != null) {
            middle.encodeAll(context);
        }
               
        //Registered Resources
        UIViewRoot viewRoot = context.getViewRoot();
        for (UIComponent resource : viewRoot.getComponentResources(context, "head")) {
            resource.encodeAll(context);
        }

        writer.startElement("script", null);
        writer.writeAttribute("type", "text/javascript", null);
        writer.write("if(window.PrimeFaces){");

        if (cc.isClientSideValidationEnabled()) {
            writer.write("PrimeFaces.settings.locale='" + context.getViewRoot().getLocale() + "';");
            writer.write("PrimeFaces.settings.validateEmptyFields=" + cc.isValidateEmptyFields() + ";");
            writer.write("PrimeFaces.settings.considerEmptyStringNull=" + cc.isInterpretEmptyStringAsNull() + ";");
        }
       
        if (cc.isLegacyWidgetNamespace()) {
            writer.write("PrimeFaces.settings.legacyWidgetNamespace=true;");
        }
       
        if (cc.isParameterNamespacingEnabled()) {
            writer.write("PrimeFaces.settings.namespaceParameters=true;");
        }
       
        if (!projectStage.equals(ProjectStage.Production)) {
            writer.write("PrimeFaces.settings.projectStage='" + projectStage.toString() + "';");
        }

        writer.write("}");
        writer.endElement("script");
    }
View Full Code Here

   
    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        ConfigContainer cc = RequestContext.getCurrentInstance().getApplicationContext().getConfig();
        ProjectStage projectStage = context.getApplication().getProjectStage();
        writer.startElement("head", component);
       
        //First facet
        UIComponent first = component.getFacet("first");
        if(first != null) {
            first.encodeAll(context);
        }
               
        writer.write("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>");
       
        String theme = resolveTheme(context);
        if(theme == null) {
            renderCSS(context, "mobile/jquery-mobile.css", "primefaces");
        }
        else {           
            renderCSS(context, "theme.css", "primefaces-" + theme);
            renderCSS(context, "mobile/jquery-mobile-icons.css", "primefaces");
            renderCSS(context, "mobile/jquery-mobile-structure.css", "primefaces");
        }
       
        renderCSS(context, "mobile/primefaces-mobile.css", "primefaces");
       
        if(cc.isFontAwesomeEnabled()) {
            renderCSS(context, "fa/font-awesome.css", "primefaces");
        }
       
        renderJS(context, "jquery/jquery.js", "primefaces");
       
        writer.startElement("script", null);
        writer.writeAttribute("type", "text/javascript", null);
        writer.write("$(document).on('mobileinit', function(){");
        writer.write("$.mobile.ajaxEnabled = false;");              
        writer.write("$.mobile.pushStateEnabled = false;");       
        writer.write("$.mobile.page.prototype.options.domCache = true;");
       
        UIComponent init = component.getFacet("init");
        if(init != null) {
            init.encodeAll(context);
        }
       
        writer.write("});");       
        writer.endElement("script");
       
        renderJS(context, "mobile/jquery-mobile.js", "primefaces");
        renderJS(context, "primefaces-mobile.js", "primefaces");
       
        //Registered Resources
        UIViewRoot viewRoot = context.getViewRoot();
        for(UIComponent resource : viewRoot.getComponentResources(context, "head")) {
            boolean shouldRender = true;
            Map<String,Object> attrs = resource.getAttributes();
            String library = (String) attrs.get("library");
           
            if(library != null && library.equals("primefaces")) {
                String resourceName = (String) attrs.get("name");
                if(resourceName.startsWith("jquery")||resourceName.startsWith("primefaces")) {
                    shouldRender = false;
                }
            }
           
            if(shouldRender) {
                resource.encodeAll(context);
            }
        }
       
        if(cc.isLegacyWidgetNamespace()) {
            writer.startElement("script", null);
            writer.writeAttribute("type", "text/javascript", null);
            writer.write("PrimeFaces.settings.legacyWidgetNamespace = true;");
            writer.endElement("script");
        }
       
        if (!projectStage.equals(ProjectStage.Production)) {
            writer.write("PrimeFaces.settings.projectStage='" + projectStage.toString() + "';");
        }
    }
View Full Code Here

            // 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");
 
View Full Code Here

TOP

Related Classes of javax.faces.application.ProjectStage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.