Package org.apache.myfaces.extensions.cdi.jsf.api.config.view

Examples of org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigDescriptor


                //it isn't possible to support interfaces due to cdi restrictions
                if(outcome.startsWith("class "))
                {
                    outcome = outcome.substring(6);
                }
                ViewConfigDescriptor entry = this.viewConfigs.get(outcome);

                if(entry == null)
                {
                    if(DefaultErrorView.class.getName().equals(originalOutcome))
                    {
View Full Code Here


    }

    private PreViewConfigNavigateEvent firePreViewConfigNavigateEvent(
            String oldViewId, ViewConfigDescriptor newViewConfigDescriptor)
    {
        ViewConfigDescriptor oldViewConfigDescriptor = ViewConfigCache.getViewConfig(oldViewId);

        if(oldViewConfigDescriptor != null)
        {
            PreViewConfigNavigateEvent navigateEvent = new PreViewConfigNavigateEvent(
                    oldViewConfigDescriptor.getViewConfig(), newViewConfigDescriptor.getViewConfig());

            this.beanManager.fireEvent(navigateEvent);
            return navigateEvent;
        }
        return null;
View Full Code Here

        if(this.deactivated)
        {
            return;
        }
       
        ViewConfigDescriptor viewConfigDescriptor =
                ViewConfigCache.getViewConfig(FacesContext.getCurrentInstance().getViewRoot().getViewId());

        if(viewConfigDescriptor instanceof EditableViewConfigDescriptor)
        {
            ((EditableViewConfigDescriptor)viewConfigDescriptor).invokePrePageActionMethods();
View Full Code Here

        if (!(o instanceof ViewConfigDescriptor))
        {
            return false;
        }

        ViewConfigDescriptor that = (ViewConfigDescriptor) o;

        if (!viewId.equals(that.getViewId()))
        {
            return false;
        }

        return true;
View Full Code Here

        if(this.logger.isLoggable(Level.INFO))
        {
            this.logger.info(pageDefinitionClass.getName() + " will be used as page-definition.");
        }

        ViewConfigDescriptor newEntry = createViewConfigDescriptor(pageDefinitionClass);

        if(newEntry != null)
        {
            ViewConfigDescriptor existingDescriptor = ViewConfigCache.getViewConfig(newEntry.getViewConfig());

            //TODO introduce an SPI with a better name
            if(/*viewConfigDescriptor != null*/existingDescriptor instanceof DefaultViewConfigDescriptor
                    && ((DefaultViewConfigDescriptor)existingDescriptor).isSimpleEntryMode())
            {
                //in this case the alternative view-controller approach which just adds page-beans was invoked before
                //-> we just have to use the page bean of the existing entry

                //here we have a simple-entry!   (which just contains page-bean definitions)
                for(PageBeanDescriptor pageBeanDescriptor : existingDescriptor.getPageBeanDescriptors())
                {
                    //add page-beans to the real entry
                    if(newEntry instanceof EditableViewConfigDescriptor)
                    {
                        ((EditableViewConfigDescriptor)newEntry).addPageBean(pageBeanDescriptor.getBeanClass());
View Full Code Here

            this.logger.info(annotatedType.getJavaClass().getName() + " will be used as page-bean.");
        }

        for(Class<? extends ViewConfig> viewConfigClass : view.value())
        {
            ViewConfigDescriptor viewConfigDescriptor = ViewConfigCache.getViewConfig(viewConfigClass);

            if(viewConfigDescriptor == null)
            {
                ViewConfigDescriptor entry = createViewConfigDescriptor(viewConfigClass);

                if(entry != null)
                {
                    if(entry instanceof EditableViewConfigDescriptor)
                    {
                        ((EditableViewConfigDescriptor)entry).addPageBean(annotatedType.getJavaClass());
                    }

                    if(entry instanceof DefaultViewConfigDescriptor)
                    {
                        //TODO introduce an SPI with a better name
                        ((DefaultViewConfigDescriptor)entry).activateSimpleEntryMode();
                    }
                    ViewConfigCache.addViewConfigDescriptor(entry.getViewId(), entry);
                }
            }
            else
            {
                if(viewConfigDescriptor instanceof EditableViewConfigDescriptor)
View Full Code Here

        if(Modifier.isAbstract(viewDefinitionClass.getModifiers()))
        {
            return null;
        }

        ViewConfigDescriptor result = getViewConfigExtractor().extractViewConfig(viewDefinitionClass);
        return result;
    }
View Full Code Here

    public void testSimpleInterfaceBasedConfigs()
    {
        viewConfigExtension.addPageDefinition(SimpleInterfaceBasedConfigs.Wizards.Registration.Step1.class);
        viewConfigExtension.addPageDefinition(SimpleInterfaceBasedConfigs.Wizards.Order.Step1.class);

        ViewConfigDescriptor registrationConfigEntry = ViewConfigCache.getViewConfig(SimpleInterfaceBasedConfigs.Wizards.Registration.Step1.class);
        ViewConfigDescriptor orderConfigEntry = ViewConfigCache.getViewConfig(SimpleInterfaceBasedConfigs.Wizards.Order.Step1.class);

        assertEquals(registrationConfigEntry.getViewId(),
                "/pages/wizards/registration/step1.xhtml");
        assertEquals(orderConfigEntry.getViewId(),
                "/pages/wizards/order/step1.xhtml");

        assertEquals(registrationConfigEntry.getNavigationMode(), Page.NavigationMode.DEFAULT);
        assertEquals(orderConfigEntry.getNavigationMode(), Page.NavigationMode.REDIRECT);

        assertTrue(registrationConfigEntry.getAccessDecisionVoters().size() == 0);
        assertEquals(orderConfigEntry.getAccessDecisionVoters().size(), 1);
        assertEquals(orderConfigEntry.getAccessDecisionVoters().iterator().next(), TestAccessDecisionVoter1.class);
    }
View Full Code Here

        assertEquals(ViewConfigCache.getViewConfig(NavigationOverriding1.RedirectedPage1.class).getViewId(),
                                                       "/redirectedPage1.xhtml");
        assertEquals(ViewConfigCache.getViewConfig(NavigationOverriding1.ForwardedPage1.class).getViewId(),
                                                       "/forwardedPage1.xhtml");

        ViewConfigDescriptor viewConfig =ViewConfigCache.getViewConfig(NavigationOverriding1.RedirectedPage1.class);
        assertEquals(viewConfig.getNavigationMode(), NavigationMode.REDIRECT);

        viewConfig = ViewConfigCache.getViewConfig(NavigationOverriding1.ForwardedPage1.class);

        assertEquals(viewConfig.getNavigationMode(), NavigationMode.FORWARD);
    }
View Full Code Here

        assertEquals(ViewConfigCache.getViewConfig(NavigationOverriding2.RedirectedPage2.class).getViewId(),
                                                       "/redirectedPage2.xhtml");
        assertEquals(ViewConfigCache.getViewConfig(NavigationOverriding2.ForwardedPage2.class).getViewId(),
                                                       "/forwardedPage2.xhtml");

        ViewConfigDescriptor viewConfig =ViewConfigCache.getViewConfig(NavigationOverriding2.RedirectedPage2.class);
        assertEquals(viewConfig.getNavigationMode(), NavigationMode.REDIRECT);

        viewConfig = ViewConfigCache.getViewConfig(NavigationOverriding2.ForwardedPage2.class);

        assertEquals(viewConfig.getNavigationMode(), NavigationMode.FORWARD);
    }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigDescriptor

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.