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

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


    /**
     * {@inheritDoc}
     */
    public ViewConfigDescriptor getErrorViewConfigDescriptor(Class<? extends ViewConfig> viewDefinitionClass)
    {
        ViewConfigDescriptor viewConfigDescriptor = getViewConfigDescriptor(viewDefinitionClass);

        Class<? extends ViewConfig> errorView = null;
        if(viewConfigDescriptor instanceof EditableViewConfigDescriptor)
        {
            errorView = ((EditableViewConfigDescriptor)viewConfigDescriptor).getErrorView();
View Full Code Here


            return;
        }

        String viewId = viewRoot.getViewId();

        ViewConfigDescriptor viewDefinitionEntry = ViewConfigCache.getViewConfigDescriptor(viewId);

        if(viewDefinitionEntry == null)
        {
            return;
        }

        List<PageBeanDescriptor> beanEntries = viewDefinitionEntry.getPageBeanDescriptors();

        for(PageBeanDescriptor beanEntry : beanEntries)
        {
            //resolve bean to trigger @PostConstruct if it isn't scoped
            CodiUtils.getContextualReferenceByName(beanManager, beanEntry.getBeanName(), Object.class);
View Full Code Here

                //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))
                    {
                        entry = ViewConfigCache.getDefaultErrorViewConfigDescriptor();
                    }
                }

                boolean allowCaching = true;
                if(entry == null)
                {
                    Class<?> loadedClass = tryToLoadClassForName(outcome);

                    if(loadedClass == null)
                    {
                        this.otherOutcomes.add(originalOutcome);
                    }
                    else if(ViewConfig.class.isAssignableFrom(loadedClass))
                    {
                        //a sub-classed page-config for annotating it with different view params
                        if(loadedClass.getAnnotation(Page.class) == null &&
                                loadedClass.getSuperclass().getAnnotation(Page.class) != null)
                        {
                            allowCaching = false;
                            addConfiguredViewParameters(loadedClass);

                            loadedClass = loadedClass.getSuperclass();
                        }
                        //noinspection unchecked
                        entry = ViewConfigCache.getViewConfigDescriptor((Class<? extends ViewConfig>) loadedClass);
                    }
                }

                if(entry != null)
                {
                    if(allowCaching)
                    {
                        this.viewConfigs.put(outcome, entry);
                        addConfiguredViewParameters(entry.getViewConfig()); //in case of false it has been added already
                    }

                    PreViewConfigNavigateEvent navigateEvent = firePreViewConfigNavigateEvent(oldViewId, entry);

                    entry = tryToUpdateEntry(entry, navigateEvent);
View Full Code Here

    }

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

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

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

            {
                String originalOutcome = outcome;

                outcome = outcome.substring(6);

                ViewConfigDescriptor entry = null;

                if(DefaultErrorView.class.getName().equals(originalOutcome))
                {
                    entry = ViewConfigCache.getDefaultErrorViewConfigDescriptor();
                }

                if(entry == null)
                {
                    Object loadedClass = tryToLoadClassForName(outcome);

                    if(loadedClass == null)
                    {
                        this.otherOutcomes.add(originalOutcome);
                    }
                    else if(ViewConfig.class.isAssignableFrom((Class)loadedClass))
                    {
                        //noinspection unchecked
                        entry = ViewConfigCache.getViewConfigDescriptor((Class<? extends ViewConfig>) loadedClass);
                    }
                }

                if(entry != null)
                {
                    return new NavigationCase("*",
                                              null,
                                              null,
                                              null,
                                              entry.getViewId(),
                                              null,
                                              Page.NavigationMode.REDIRECT.equals(entry.getNavigationMode()),
                                              false);
                }
            }
            return ((ConfigurableNavigationHandler) this.wrapped).getNavigationCase(context, action, outcome);
        }
View Full Code Here

        }

        //override the view-id if we have a new view
        this.windowContext.setAttribute(INITIALIZED_VIEW_ID_MARKER_KEY, viewId);

        ViewConfigDescriptor viewDefinitionEntry = ViewConfigCache.getViewConfigDescriptor(viewId);

        if (viewDefinitionEntry instanceof EditableViewConfigDescriptor)
        {
            ((EditableViewConfigDescriptor)viewDefinitionEntry).invokeInitViewMethods();
        }
View Full Code Here

        }
    }

    private void processPreRenderView(String viewId)
    {
        ViewConfigDescriptor viewDefinitionEntry = ViewConfigCache.getViewConfigDescriptor(viewId);

        if (viewDefinitionEntry instanceof EditableViewConfigDescriptor)
        {
            ((EditableViewConfigDescriptor)viewDefinitionEntry).invokePreRenderViewMethods();
        }
View Full Code Here

        }
    }

    private void processPostRenderView(String viewId)
    {
        ViewConfigDescriptor viewDefinitionEntry = ViewConfigCache.getViewConfigDescriptor(viewId);

        if (viewDefinitionEntry instanceof EditableViewConfigDescriptor)
        {
            ((EditableViewConfigDescriptor)viewDefinitionEntry).invokePostRenderViewMethods();
        }
View Full Code Here

            return;
        }

        String viewId = viewRoot.getViewId();

        ViewConfigDescriptor viewDefinitionEntry = ViewConfigCache.getViewConfigDescriptor(viewId);

        if(viewDefinitionEntry == null)
        {
            return;
        }

        List<PageBeanDescriptor> beanEntries = viewDefinitionEntry.getPageBeanDescriptors();

        Object bean;
        RequestLifecycleCallbackEntry phasesLifecycleCallbackEntry;
        List<Method> lifecycleCallbacks;
View Full Code Here

     * {@inheritDoc}
     */
    public EditableViewConfigDescriptor extractViewConfig(Class<? extends ViewConfig> viewDefinitionClass)
    {
        //use the interface to make clear which information we really need
        ViewConfigDescriptor viewConfigDescriptor = new ExtractedViewConfigDefinitionEntry(viewDefinitionClass);

        return extractViewConfigDescriptor(viewDefinitionClass, viewConfigDescriptor);
    }
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.