org.apache.tiles.definition.DefinitionsFactory Java Examples

The following examples show how to use org.apache.tiles.definition.DefinitionsFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TilesConfigurer.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
protected DefinitionsFactory createDefinitionsFactory(ApplicationContext applicationContext,
		LocaleResolver resolver) {

	if (definitionsFactoryClass != null) {
		DefinitionsFactory factory = BeanUtils.instantiateClass(definitionsFactoryClass);
		if (factory instanceof ApplicationContextAware) {
			((ApplicationContextAware) factory).setApplicationContext(applicationContext);
		}
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(factory);
		if (bw.isWritableProperty("localeResolver")) {
			bw.setPropertyValue("localeResolver", resolver);
		}
		if (bw.isWritableProperty("definitionDAO")) {
			bw.setPropertyValue("definitionDAO", createLocaleDefinitionDao(applicationContext, resolver));
		}
		return factory;
	}
	else {
		return super.createDefinitionsFactory(applicationContext, resolver);
	}
}
 
Example #2
Source File: TilesConfigurer.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
protected DefinitionsFactory createDefinitionsFactory(ApplicationContext applicationContext,
		LocaleResolver resolver) {

	if (definitionsFactoryClass != null) {
		DefinitionsFactory factory = BeanUtils.instantiateClass(definitionsFactoryClass);
		if (factory instanceof ApplicationContextAware) {
			((ApplicationContextAware) factory).setApplicationContext(applicationContext);
		}
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(factory);
		if (bw.isWritableProperty("localeResolver")) {
			bw.setPropertyValue("localeResolver", resolver);
		}
		if (bw.isWritableProperty("definitionDAO")) {
			bw.setPropertyValue("definitionDAO", createLocaleDefinitionDao(applicationContext, resolver));
		}
		return factory;
	}
	else {
		return super.createDefinitionsFactory(applicationContext, resolver);
	}
}
 
Example #3
Source File: TilesConfigurer.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected DefinitionsFactory createDefinitionsFactory(ApplicationContext applicationContext,
		LocaleResolver resolver) {

	if (definitionsFactoryClass != null) {
		DefinitionsFactory factory = BeanUtils.instantiate(definitionsFactoryClass);
		if (factory instanceof ApplicationContextAware) {
			((ApplicationContextAware) factory).setApplicationContext(applicationContext);
		}
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(factory);
		if (bw.isWritableProperty("localeResolver")) {
			bw.setPropertyValue("localeResolver", resolver);
		}
		if (bw.isWritableProperty("definitionDAO")) {
			bw.setPropertyValue("definitionDAO", createLocaleDefinitionDao(applicationContext, resolver));
		}
		return factory;
	}
	else {
		return super.createDefinitionsFactory(applicationContext, resolver);
	}
}
 
Example #4
Source File: TilesConfigurer.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected DefinitionsFactory createDefinitionsFactory(TilesApplicationContext applicationContext,
		TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
	if (definitionsFactoryClass != null) {
		DefinitionsFactory factory = BeanUtils.instantiate(definitionsFactoryClass);
		if (factory instanceof TilesApplicationContextAware) {
			((TilesApplicationContextAware) factory).setApplicationContext(applicationContext);
		}
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(factory);
		if (bw.isWritableProperty("localeResolver")) {
			bw.setPropertyValue("localeResolver", resolver);
		}
		if (bw.isWritableProperty("definitionDAO")) {
			bw.setPropertyValue("definitionDAO",
					createLocaleDefinitionDao(applicationContext, contextFactory, resolver));
		}
		if (factory instanceof Refreshable) {
			((Refreshable) factory).refresh();
		}
		return factory;
	}
	else {
		return super.createDefinitionsFactory(applicationContext, contextFactory, resolver);
	}
}
 
Example #5
Source File: TilesConfigurer.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
protected DefinitionsFactory createDefinitionsFactory(ApplicationContext applicationContext,
		LocaleResolver resolver) {

	if (definitionsFactoryClass != null) {
		DefinitionsFactory factory = BeanUtils.instantiate(definitionsFactoryClass);
		if (factory instanceof ApplicationContextAware) {
			((ApplicationContextAware) factory).setApplicationContext(applicationContext);
		}
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(factory);
		if (bw.isWritableProperty("localeResolver")) {
			bw.setPropertyValue("localeResolver", resolver);
		}
		if (bw.isWritableProperty("definitionDAO")) {
			bw.setPropertyValue("definitionDAO", createLocaleDefinitionDao(applicationContext, resolver));
		}
		return factory;
	}
	else {
		return super.createDefinitionsFactory(applicationContext, resolver);
	}
}
 
Example #6
Source File: TilesConfigurer.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@Override
protected DefinitionsFactory createDefinitionsFactory(TilesApplicationContext applicationContext,
		TilesRequestContextFactory contextFactory, LocaleResolver resolver) {
	if (definitionsFactoryClass != null) {
		DefinitionsFactory factory = BeanUtils.instantiate(definitionsFactoryClass);
		if (factory instanceof TilesApplicationContextAware) {
			((TilesApplicationContextAware) factory).setApplicationContext(applicationContext);
		}
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(factory);
		if (bw.isWritableProperty("localeResolver")) {
			bw.setPropertyValue("localeResolver", resolver);
		}
		if (bw.isWritableProperty("definitionDAO")) {
			bw.setPropertyValue("definitionDAO",
					createLocaleDefinitionDao(applicationContext, contextFactory, resolver));
		}
		if (factory instanceof Refreshable) {
			((Refreshable) factory).refresh();
		}
		return factory;
	}
	else {
		return super.createDefinitionsFactory(applicationContext, contextFactory, resolver);
	}
}
 
Example #7
Source File: EntandoStrutsTilesContainerFactory.java    From entando-core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected Set<String> getTilesDefinitions(Map<String, String> params) {
       if (params.containsKey(DefinitionsFactory.DEFINITIONS_CONFIG)) {
           return this.getResourceNames(params.get(DefinitionsFactory.DEFINITIONS_CONFIG));
       }
       return this.getResourceNames(TILES_DEFAULT_PATTERN);
   }
 
Example #8
Source File: TilesConfigurer.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Set the {@link org.apache.tiles.definition.DefinitionsFactory} implementation to use.
 * Default is {@link org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory},
 * operating on definition resource URLs.
 * <p>Specify a custom DefinitionsFactory, e.g. a UrlDefinitionsFactory subclass,
 * to customize the creation of Tiles Definition objects. Note that such a
 * DefinitionsFactory has to be able to handle {@link java.net.URL} source objects,
 * unless you configure a different TilesContainerFactory.
 */
public void setDefinitionsFactoryClass(Class<? extends DefinitionsFactory> definitionsFactoryClass) {
	this.definitionsFactoryClass = definitionsFactoryClass;
}
 
Example #9
Source File: TilesConfigurer.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Set the {@link org.apache.tiles.definition.DefinitionsFactory} implementation to use.
 * Default is {@link org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory},
 * operating on definition resource URLs.
 * <p>Specify a custom DefinitionsFactory, e.g. a UrlDefinitionsFactory subclass,
 * to customize the creation of Tiles Definition objects. Note that such a
 * DefinitionsFactory has to be able to handle {@link java.net.URL} source objects,
 * unless you configure a different TilesContainerFactory.
 */
public void setDefinitionsFactoryClass(Class<? extends DefinitionsFactory> definitionsFactoryClass) {
	this.definitionsFactoryClass = definitionsFactoryClass;
}
 
Example #10
Source File: TilesConfigurer.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Set the {@link org.apache.tiles.definition.DefinitionsFactory} implementation to use.
 * Default is {@link org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory},
 * operating on definition resource URLs.
 * <p>Specify a custom DefinitionsFactory, e.g. a UrlDefinitionsFactory subclass,
 * to customize the creation of Tiles Definition objects. Note that such a
 * DefinitionsFactory has to be able to handle {@link java.net.URL} source objects,
 * unless you configure a different TilesContainerFactory.
 */
public void setDefinitionsFactoryClass(Class<? extends DefinitionsFactory> definitionsFactoryClass) {
	this.definitionsFactoryClass = definitionsFactoryClass;
}
 
Example #11
Source File: TilesConfigurer.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Set the {@link org.apache.tiles.definition.DefinitionsFactory} implementation to use.
 * Default is {@link org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory},
 * operating on definition resource URLs.
 * <p>Specify a custom DefinitionsFactory, e.g. a UrlDefinitionsFactory subclass,
 * to customize the creation of Tiles Definition objects. Note that such a
 * DefinitionsFactory has to be able to handle {@link java.net.URL} source objects,
 * unless you configure a different TilesContainerFactory.
 */
public void setDefinitionsFactoryClass(Class<? extends DefinitionsFactory> definitionsFactoryClass) {
	this.definitionsFactoryClass = definitionsFactoryClass;
}
 
Example #12
Source File: TilesConfigurer.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Set the {@link org.apache.tiles.definition.DefinitionsFactory} implementation to use.
 * Default is {@link org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory},
 * operating on definition resource URLs.
 * <p>Specify a custom DefinitionsFactory, e.g. a UrlDefinitionsFactory subclass,
 * to customize the creation of Tiles Definition objects. Note that such a
 * DefinitionsFactory has to be able to handle {@link java.net.URL} source objects,
 * unless you configure a different TilesContainerFactory.
 */
public void setDefinitionsFactoryClass(Class<? extends DefinitionsFactory> definitionsFactoryClass) {
	this.definitionsFactoryClass = definitionsFactoryClass;
}
 
Example #13
Source File: TilesConfigurer.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Set the {@link org.apache.tiles.definition.DefinitionsFactory} implementation to use.
 * Default is {@link org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory},
 * operating on definition resource URLs.
 * <p>Specify a custom DefinitionsFactory, e.g. a UrlDefinitionsFactory subclass,
 * to customize the creation of Tiles Definition objects. Note that such a
 * DefinitionsFactory has to be able to handle {@link java.net.URL} source objects,
 * unless you configure a different TilesContainerFactory.
 */
public void setDefinitionsFactoryClass(Class<? extends DefinitionsFactory> definitionsFactoryClass) {
	this.definitionsFactoryClass = definitionsFactoryClass;
}