All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.got5.tapestry5.jquery.services.impl.JavaScriptFilesConfigurationImpl Maven / Gradle / Ivy

There is a newer version: 4.1.1
Show newest version
package org.got5.tapestry5.jquery.services.impl;

import java.util.Map;

import org.apache.tapestry5.Asset;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.services.AssetSource;
import org.got5.tapestry5.jquery.services.JavaScriptFilesConfiguration;

public class JavaScriptFilesConfigurationImpl implements
		JavaScriptFilesConfiguration {

	private Map javaScriptFilesConfiguration;
	private AssetSource as;
	
	public JavaScriptFilesConfigurationImpl(Map javaScriptFilesConfiguration, AssetSource as) {
		super();
		this.javaScriptFilesConfiguration = javaScriptFilesConfiguration;
		this.as = as;
	}

	public Asset getAsset(Asset original) {
		if(javaScriptFilesConfiguration.containsKey(original.getResource().getFile())) {
			String assetPath = javaScriptFilesConfiguration.get(original.getResource().getFile());
			return InternalUtils.isBlank(assetPath) ? null : this.as.getExpandedAsset(assetPath);
		}
		return original;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy