📄 applicationimpl.java
字号:
/** * Validator synchronisation. */ private void initValidators() { for (Iterator i = this.delegate.getValidatorIds(); i.hasNext();) { String validatorId = (String) i.next(); addValidator(validatorId, this.delegate .createValidator(validatorId).getClass().getName()); } } /** * Creates an application with the given original application * <code>delegate</code>. * * @param delegate * The original application of the underlying JSF implementation */ public ApplicationImpl(final Application delegate) { this(delegate, new DefaultComponentFactory(), new DefaultConverterFactory(), new DefaultValidatorFactory(), new DefaultMethodBindingFactory()); } /** * Creates an application with the given original application * <code>delegate</code>. * * @param delegate * The original application of the underlying JSF implementation * @param beanFactory * the Beanfactory */ public ApplicationImpl(final Application delegate, final BeanFactory beanFactory) { this(delegate, (ComponentFactory) getFactory(beanFactory, COMPONENT_FACTORY_BEAN_NAME, ComponentFactory.class, new DefaultComponentFactory()), (ConverterFactory) getFactory( beanFactory, CONVERTER_FACTORY_BEAN_NAME, ConverterFactory.class, new DefaultConverterFactory()), (ValidatorFactory) getFactory(beanFactory, VALIDATOR_FACTORY_BEAN_NAME, ValidatorFactory.class, new DefaultValidatorFactory()), (MethodBindingFactory) getFactory(beanFactory, METHOD_BINDING_FACTORY_BEAN_NAME, MethodBindingFactory.class, new DefaultMethodBindingFactory())); } /** * Search for a factory in the given BeanFactory. * * @param beanFactory * the BeanFactory * @param factoryName * the name of the factory to find * @param factoryType * the type of the factory to find * @param defaultFactory * the default factory * @return the factory or <code>defaultFactory</code> if not found */ private static Object getFactory(final BeanFactory beanFactory, final String factoryName, final Class factoryType, final Object defaultFactory) { Object factory = defaultFactory; if (beanFactory.containsBean(factoryName) && factoryType.isAssignableFrom(beanFactory .getType(factoryName))) { factory = beanFactory.getBean(factoryName, factoryType); } return factory; } /** * {@inheritDoc} */ public ActionListener getActionListener() { return delegate.getActionListener(); } /** * {@inheritDoc} */ public Locale getDefaultLocale() { return delegate.getDefaultLocale(); } /** * {@inheritDoc} */ public String getDefaultRenderKitId() { return delegate.getDefaultRenderKitId(); } /** * {@inheritDoc} */ public String getMessageBundle() { return delegate.getMessageBundle(); } /** * {@inheritDoc} */ public NavigationHandler getNavigationHandler() { return delegate.getNavigationHandler(); } /** * {@inheritDoc} */ public PropertyResolver getPropertyResolver() { return delegate.getPropertyResolver(); } /** * {@inheritDoc} */ public StateManager getStateManager() { return delegate.getStateManager(); } /** * {@inheritDoc} */ public Iterator getSupportedLocales() { return delegate.getSupportedLocales(); } /** * {@inheritDoc} */ public VariableResolver getVariableResolver() { return delegate.getVariableResolver(); } /** * {@inheritDoc} */ public ViewHandler getViewHandler() { return delegate.getViewHandler(); } /** * {@inheritDoc} */ public void setActionListener(final ActionListener listener) { delegate.setActionListener(listener); } /** * {@inheritDoc} */ public void setDefaultLocale(final Locale locale) { delegate.setDefaultLocale(locale); } /** * {@inheritDoc} */ public void setDefaultRenderKitId(final String renderKitId) { delegate.setDefaultRenderKitId(renderKitId); } /** * {@inheritDoc} */ public void setMessageBundle(final String bundle) { delegate.setMessageBundle(bundle); } /** * {@inheritDoc} */ public void setNavigationHandler(final NavigationHandler handler) { delegate.setNavigationHandler(handler); } /** * {@inheritDoc} */ public void setPropertyResolver(final PropertyResolver resolver) { delegate.setPropertyResolver(resolver); } /** * {@inheritDoc} */ public void setStateManager(final StateManager manager) { delegate.setStateManager(manager); } /** * {@inheritDoc} */ public void setSupportedLocales(final Collection locales) { delegate.setSupportedLocales(locales); } /** * {@inheritDoc} */ public void setVariableResolver(final VariableResolver resolver) { delegate.setVariableResolver(resolver); } /** * {@inheritDoc} */ public void setViewHandler(final ViewHandler handler) { delegate.setViewHandler(handler); } /** * {@inheritDoc} */ public void addComponent(final String componentType, final String componentClass) { componentFactory.addComponent(this.delegate, componentType, componentClass); } /** * {@inheritDoc} */ public UIComponent createComponent(final String componentType) { return componentFactory.createComponent(this.delegate, componentType); } /** * {@inheritDoc} */ public UIComponent createComponent(final ValueBinding componentBinding, final FacesContext context, final String componentType) { UIComponent component = null; if (context.getApplication().getViewHandler() instanceof ViewBuilder) { component = this.componentFactory.createComponent(this.delegate, componentType); componentBinding.setValue(context, component); } else { component = this.componentFactory.createComponent(this.delegate, componentBinding, context, componentType); } return component; } /** * {@inheritDoc} */ public Iterator getComponentTypes() { return componentFactory.getComponentTypes(this.delegate); } /** * {@inheritDoc} */ public void addConverter(final Class targetClass, final String converterClass) { converterFactory.addConverter(this.delegate, targetClass, converterClass); } /** * {@inheritDoc} */ public void addConverter(final String converterId, final String converterClass) { converterFactory.addConverter(this.delegate, converterId, converterClass); } /** * {@inheritDoc} */ public Converter createConverter(final Class targetClass) { return converterFactory.createConverter(this.delegate, targetClass); } /** * {@inheritDoc} */ public Converter createConverter(final String converterId) { return converterFactory.createConverter(this.delegate, converterId); } /** * {@inheritDoc} */ public Iterator getConverterIds() { return converterFactory.getConverterIds(this.delegate); } /** * {@inheritDoc} */ public Iterator getConverterTypes() { return converterFactory.getConverterTypes(this.delegate); } /** * {@inheritDoc} */ public MethodBinding createMethodBinding(final String ref, final Class[] params) { return methodBindingFactory.createMethodBinding(this.delegate, ref, params); } /** * {@inheritDoc} */ public ValueBinding createValueBinding(final String ref) { return methodBindingFactory.createValueBinding(this.delegate, ref); } /** * {@inheritDoc} */ public void addValidator(final String validatorId, final String validatorClass) { validatorFactory.addValidator(this.delegate, validatorId, validatorClass); } /** * {@inheritDoc} */ public Validator createValidator(final String validatorId) { return validatorFactory.createValidator(this.delegate, validatorId); } /** * {@inheritDoc} */ public Iterator getValidatorIds() { return validatorFactory.getValidatorIds(this.delegate); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -