Page 1 of 1

error in menu

Posted: 11 Aug 2016, 17:13
by queirozg96
I made the purchase layout + theme, includes all files as documentation... However, the time to access the "empty-page.xhtml" the following error appears

"org.primefaces.context.ApplicationContext.getConfig()Lorg/primefaces/config/PrimeConfiguration;"

Does anyone know how to solve it? :mrgreen: :mrgreen:

Re: error in menu

Posted: 16 Aug 2016, 11:53
by mert.sincan
I think it has been fixed for next release. https://github.com/primefaces/layouts/issues/106

For now, please change processEvent method with the following processEvent method in RioMenu.java

Code: Select all

....
@Override
    public void processEvent(ComponentSystemEvent event) throws AbortProcessingException {
        if(event instanceof PostAddToViewEvent) {
            FacesContext context = getFacesContext();
            UIViewRoot root = context.getViewRoot();
            
            boolean isPrimeConfig;
            try {
                isPrimeConfig = Class.forName("org.primefaces.config.PrimeConfiguration") != null;
            } catch (ClassNotFoundException e) {
                isPrimeConfig = false;
            }

            String[] resources = (isPrimeConfig) ? MODERN_RESOURCES : LEGACY_RESOURCES;

            for(String res : resources) {
                UIComponent component = context.getApplication().createComponent(UIOutput.COMPONENT_TYPE);
                if(res.endsWith("css"))
                    component.setRendererType("javax.faces.resource.Stylesheet");
                else if(res.endsWith("js"))
                    component.setRendererType("javax.faces.resource.Script");

                component.getAttributes().put("library", "primefaces");
                component.getAttributes().put("name", res);

                root.addComponentResource(context, component);
            }
        }
    }
....