You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2009/09/20 12:50:37 UTC

svn commit: r817006 [1/2] - in /wicket/trunk: wicket-examples/src/main/java/org/apache/wicket/examples/hangman/ wicket/src/main/java/org/apache/wicket/ wicket/src/main/java/org/apache/wicket/markup/ wicket/src/main/java/org/apache/wicket/markup/html/ w...

Author: jdonnerstag
Date: Sun Sep 20 10:50:34 2009
New Revision: 817006

URL: http://svn.apache.org/viewvc?rev=817006&view=rev
Log:
Component.getStyle() not longer return variation + style. Modified all related interfaces, especially resource related ones, to receive variation separated from style.

This is pre-requisite to fix 2298, but I've not yet checked against the 2298 use case.
Issue: WICKET-2298

Modified:
    wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/hangman/WordGenerator.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/IResourceFactory.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/ResourceReference.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/SharedResources.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ContainerInfo.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupResourceStreamProvider.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CSSPackageResource.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CompressedPackageResource.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/JavascriptPackageResource.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/MarkupComponentBorder.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/DefaultButtonImageResourceFactory.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/LocalizedImageResource.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/CompressedResourceReference.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/JavascriptResourceReference.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/PackagedResourceReference.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformer.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/resource/SharedResourceRequestTarget.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/BundleStringResourceLoader.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/IStringResourceLoader.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/PackageStringResourceLoader.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/PackageResourceStream.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ExtensionResourceNameIterator.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/IResourceStreamLocator.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/LocaleResourceNameIterator.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceNameIterator.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/StyleAndVariationResourceNameIterator.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/PackageResourceTest.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ApplicationStringResourceLoaderTest.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/BundleStringResourceLoaderTest.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ComponentStringResourceLoaderTest.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/StringResourceLoaderTestBase.java
    wicket/trunk/wicket/src/test/java/org/apache/wicket/util/resource/ResourceTest.java

Modified: wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/hangman/WordGenerator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/hangman/WordGenerator.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/hangman/WordGenerator.java (original)
+++ wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/hangman/WordGenerator.java Sun Sep 20 10:50:34 2009
@@ -53,7 +53,8 @@
 		try
 		{
 			final IResourceStream resource = new ResourceStreamLocator().locate(null,
-				"org/apache/wicket/examples/hangman/WordList", "", Locale.getDefault(), ".txt");
+				"org/apache/wicket/examples/hangman/WordList", null, null, Locale.getDefault(),
+				".txt");
 			final String wordlist = Streams.readString(resource.getInputStream());
 			words = Arrays.asList(wordlist.split("\\s+"));
 			shuffle();

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Sun Sep 20 10:50:34 2009
@@ -154,12 +154,13 @@
  * Application Localizer for easy access in Components.
  * 
  * <li><b>Style </b>- The style ("skin") for a component is available through
- * {@link Component#getStyle()}, which is equivalent to getSession().getStyle(). Styles are intended
- * to give a particular look to a Component or Resource that is independent of its Locale. For
- * example, a style might be a set of resources, including images and markup files, which gives the
- * design look of "ocean" to the user. If the Session's style is set to "ocean" and these resources
- * are given names suffixed with "_ocean", Wicket's resource management logic will prefer these
- * resources to other resources, such as default resources, which are not as good of a match.
+ * {@link Component#getStyleAndVariation()}, which is equivalent to getSession().getStyle(). Styles
+ * are intended to give a particular look to a Component or Resource that is independent of its
+ * Locale. For example, a style might be a set of resources, including images and markup files,
+ * which gives the design look of "ocean" to the user. If the Session's style is set to "ocean" and
+ * these resources are given names suffixed with "_ocean", Wicket's resource management logic will
+ * prefer these resources to other resources, such as default resources, which are not as good of a
+ * match.
  * 
  * <li><b>Variation </b>- Whereas Styles are Session (user) specific, variations are component
  * specific. E.g. if the Style is "ocean" and the Variation is "NorthSea", than the resources are
@@ -1901,29 +1902,20 @@
 	}
 
 	/**
-	 * Gets the style of this component (see {@link org.apache.wicket.Session}).
+	 * A convinient method. Same as Session.get().getStyle().
 	 * 
-	 * @return The style of this component.
+	 * @return The style of this component respectively the style of the Session.
 	 * 
-	 * @see org.apache.wicket.Session
 	 * @see org.apache.wicket.Session#getStyle()
 	 */
 	public final String getStyle()
 	{
-		String variation = getVariation();
-		String style = getSession().getStyle();
-		if (variation != null && !"".equals(variation))
+		Session session = getSession();
+		if (session == null)
 		{
-			if (style != null && !"".equals(style))
-			{
-				style = variation + "_" + style;
-			}
-			else
-			{
-				style = variation;
-			}
+			throw new WicketRuntimeException("Wicket Session object not avaiable");
 		}
-		return style;
+		return session.getStyle();
 	}
 
 	/**

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/IResourceFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/IResourceFactory.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/IResourceFactory.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/IResourceFactory.java Sun Sep 20 10:50:34 2009
@@ -36,7 +36,10 @@
 	 *            The locale for the resource
 	 * @param style
 	 *            The style of the resource (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component's variation
 	 * @return The resource
 	 */
-	Resource newResource(final String specification, final Locale locale, final String style);
+	Resource newResource(final String specification, final Locale locale, final String style,
+		final String variation);
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Localizer.java Sun Sep 20 10:50:34 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.wicket;
 
-import java.util.Iterator;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.MissingResourceException;
@@ -212,10 +212,8 @@
 
 			// Iterate over all registered string resource loaders until the
 			// property has been found
-			Iterator<IStringResourceLoader> iter = getStringResourceLoaders();
-			while (iter.hasNext())
+			for (IStringResourceLoader loader : getStringResourceLoaders())
 			{
-				IStringResourceLoader loader = iter.next();
 				value = loader.loadStringResource(component, key);
 				if (value != null)
 				{
@@ -254,15 +252,11 @@
 	/**
 	 * In case you want to provide your own list of string resource loaders
 	 * 
-	 * @return Iterator
+	 * @return List of string resource loaders
 	 */
-	protected Iterator<IStringResourceLoader> getStringResourceLoaders()
+	protected List<IStringResourceLoader> getStringResourceLoaders()
 	{
-		Iterator<IStringResourceLoader> iter = Application.get()
-			.getResourceSettings()
-			.getStringResourceLoaders()
-			.iterator();
-		return iter;
+		return Application.get().getResourceSettings().getStringResourceLoaders();
 	}
 
 	/**
@@ -415,9 +409,7 @@
 
 			buffer.append("-").append(component.getLocale());
 			buffer.append("-").append(component.getStyle());
-			// TODO 1.4 look if we want to properly separate getstyle/getvariation
-			// for now getvariation() is rolled up into getstyle()
-			// buffer.append("-").append(component.getVariation());
+			buffer.append("-").append(component.getVariation());
 			cacheKey = buffer.toString();
 		}
 		else

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/ResourceReference.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ResourceReference.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/ResourceReference.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ResourceReference.java Sun Sep 20 10:50:34 2009
@@ -71,6 +71,9 @@
 	/** The style of the resource */
 	private String style;
 
+	/** The component's variation (of the scope) */
+	private String variation;
+
 	/**
 	 * Constructs a ResourceReference with the given scope and name. The scope is used as a
 	 * namespace and the scope together with the name must uniquely identify the reference.
@@ -82,7 +85,7 @@
 	 */
 	public ResourceReference(final Class<?> scope, final String name)
 	{
-		this(scope, name, null, null);
+		this(scope, name, null, null, null);
 	}
 
 	/**
@@ -99,13 +102,17 @@
 	 *            The Locale from which the search for the PackageResource must start
 	 * @param style
 	 *            The Style of the PackageResource
+	 * @param variation
+	 *            The component's variation (of the style)
 	 */
-	public ResourceReference(final Class<?> scope, final String name, Locale locale, String style)
+	public ResourceReference(final Class<?> scope, final String name, Locale locale, String style,
+		String variation)
 	{
 		scopeName = scope.getName();
 		this.name = name;
 		this.locale = locale;
 		this.style = style;
+		this.variation = variation;
 	}
 
 	/**
@@ -134,7 +141,7 @@
 		{
 			SharedResources sharedResources = application.getSharedResources();
 			// Try to get resource from Application repository
-			resource = sharedResources.get(getScope(), name, locale, style, true);
+			resource = sharedResources.get(getScope(), name, locale, style, variation, true);
 
 			// Not available yet?
 			if (resource == null)
@@ -145,7 +152,8 @@
 				{
 					// If lazy-init did not create resource with correct locale
 					// and style then we should default the resource
-					resource = sharedResources.get(getScope(), name, locale, style, false);
+					resource = sharedResources.get(getScope(), name, locale, style, variation,
+						false);
 					if (resource == null)
 					{
 						// still null? try to see whether it is a package
@@ -159,7 +167,7 @@
 				}
 
 				// Share through application
-				sharedResources.add(getScope(), name, locale, style, resource);
+				sharedResources.add(getScope(), name, locale, style, variation, resource);
 			}
 		}
 	}
@@ -223,7 +231,8 @@
 	{
 		Application application = Application.get();
 		bind(application);
-		return application.getSharedResources().resourceKey(getScope(), name, locale, style);
+		return application.getSharedResources().resourceKey(getScope(), name, locale, style,
+			variation);
 	}
 
 	/**
@@ -235,6 +244,14 @@
 	}
 
 	/**
+	 * @return Returns the style. (see {@link org.apache.wicket.Session})
+	 */
+	public final String getVariation()
+	{
+		return variation;
+	}
+
+	/**
 	 * @see java.lang.Object#hashCode()
 	 */
 	@Override
@@ -277,6 +294,16 @@
 	}
 
 	/**
+	 * @param variation
+	 *            The style variation to set (see {@link org.apache.wicket.Component}).
+	 */
+	public final void setVariation(String variation)
+	{
+		this.variation = variation;
+		invalidate();
+	}
+
+	/**
 	 * @see java.lang.Object#toString()
 	 */
 	@Override
@@ -294,7 +321,7 @@
 	protected Resource newResource()
 	{
 		PackageResource packageResource = PackageResource.get(getScope(), getName(), getLocale(),
-			getStyle());
+			getStyle(), getVariation());
 		if (packageResource != null)
 		{
 			locale = packageResource.getLocale();

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/SharedResources.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/SharedResources.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/SharedResources.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/SharedResources.java Sun Sep 20 10:50:34 2009
@@ -62,9 +62,12 @@
 	 *            The locale
 	 * @param style
 	 *            The style (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component specific variation of the style
 	 * @return The localized path
 	 */
-	public static String resourceKey(final String path, final Locale locale, final String style)
+	public static String resourceKey(final String path, final Locale locale, final String style,
+		final String variation)
 	{
 		// escape sequence for '..' (prevents crippled urls in browser)
 		final CharSequence parentEscape = Application.get()
@@ -93,12 +96,17 @@
 		// First style because locale can append later on.
 		if (style != null)
 		{
-			buffer.append('_');
+			buffer.append("_");
 			buffer.append(style);
 		}
+		if (variation != null)
+		{
+			buffer.append("_");
+			buffer.append(variation);
+		}
 		if (locale != null)
 		{
-			buffer.append('_');
+			buffer.append("_");
 			boolean l = locale.getLanguage().length() != 0;
 			boolean c = locale.getCountry().length() != 0;
 			boolean v = locale.getVariant().length() != 0;
@@ -151,14 +159,16 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The resource style (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component specific variation of the style
 	 * @param resource
 	 *            Resource to store
 	 */
 	public final void add(final Class<?> scope, final String name, final Locale locale,
-		final String style, final Resource resource)
+		final String style, final String variation, final Resource resource)
 	{
 		// Store resource
-		final String key = resourceKey(scope, name, locale, style);
+		final String key = resourceKey(scope, name, locale, style, variation);
 		if (resourceMap.putIfAbsent(key, resource) == null)
 		{
 			if (log.isDebugEnabled())
@@ -180,7 +190,7 @@
 	 */
 	public final void add(final String name, final Locale locale, final Resource resource)
 	{
-		add(Application.class, name, locale, null, resource);
+		add(Application.class, name, locale, null, null, resource);
 	}
 
 	/**
@@ -193,7 +203,7 @@
 	 */
 	public final void add(final String name, final Resource resource)
 	{
-		add(Application.class, name, null, null, resource);
+		add(Application.class, name, null, null, null, resource);
 	}
 
 	/**
@@ -205,6 +215,8 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The resource style (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component specific variation of the style
 	 * @param exact
 	 *            If true then only return the resource that is registered for the given locale and
 	 *            style.
@@ -212,50 +224,30 @@
 	 * @return The logical resource
 	 */
 	public final Resource get(final Class<?> scope, final String name, final Locale locale,
-		final String style, boolean exact)
+		final String style, final String variation, boolean exact)
 	{
 		if (exact)
 		{
-			final String resourceKey = resourceKey(scope, name, locale, style);
+			final String resourceKey = resourceKey(scope, name, locale, style, variation);
 			return get(resourceKey);
 		}
 
-		// 1. Look for fully qualified entry with locale and style
-		if (locale != null && style != null)
-		{
-			final String resourceKey = resourceKey(scope, name, locale, style);
-			final Resource resource = get(resourceKey);
-			if (resource != null)
-			{
-				return resource;
-			}
-		}
-
-		// 2. Look for entry without style
-		if (locale != null)
-		{
-			final String key = resourceKey(scope, name, locale, null);
-			final Resource resource = get(key);
-			if (resource != null)
-			{
-				return resource;
-			}
-		}
-
-		// 3. Look for entry without locale
-		if (style != null)
+		for (int i = 7; i >= 0; i--)
 		{
-			final String key = resourceKey(scope, name, null, style);
-			final Resource resource = get(key);
+			boolean testLocale = (i & 4) != 0;
+			boolean testStyle = (i & 2) != 0;
+			boolean testVariation = (i & 1) != 0;
+
+			String resourceKey = resourceKey(scope, name, (testLocale ? locale : null), (testStyle
+				? style : null), (testVariation ? variation : null));
+			Resource resource = get(resourceKey);
 			if (resource != null)
 			{
 				return resource;
 			}
 		}
 
-		// 4. Look for base name with no locale or style
-		final String key = resourceKey(scope, name, null, null);
-		return get(key);
+		return null;
 	}
 
 	/**
@@ -324,16 +316,18 @@
 	 *            The locale
 	 * @param style
 	 *            The style (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component specific variation of style
 	 * @return The localized path
 	 */
 	public String resourceKey(final Class<?> scope, final String path, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		String alias = classAliasMap.get(scope);
 		if (alias == null)
 		{
 			alias = scope.getName();
 		}
-		return alias + '/' + resourceKey(path, locale, style);
+		return alias + '/' + resourceKey(path, locale, style, variation);
 	}
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ContainerInfo.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ContainerInfo.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ContainerInfo.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/ContainerInfo.java Sun Sep 20 10:50:34 2009
@@ -22,10 +22,9 @@
 import org.apache.wicket.MarkupContainer;
 
 /**
- * Because a Component has reference to its parents, which eventually is the Page, and because the
- * Page contains a reference to the Session, keeping a "copy" of a component is very expensive.
- * ContainerInfo shall be used instead of MarkupContainer whenever a small subset of the container's
- * information is required.
+ * Because Component has a reference to its parents, which eventually is the Page, keeping a "copy"
+ * of a component is very expensive. ContainerInfo shall be used instead of MarkupContainer whenever
+ * a small subset of the container's information is required.
  * 
  * @author Juergen Donnerstag
  */
@@ -45,8 +44,8 @@
 	 */
 	public ContainerInfo(final MarkupContainer container)
 	{
-		this(container.getClass(), container.getLocale(), container.getStyle(), null,
-			container.getMarkupType());
+		this(container.getClass(), container.getLocale(), container.getStyle(),
+			container.getVariation(), container.getMarkupType());
 	}
 
 	/**

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupCacheKeyProvider.java Sun Sep 20 10:50:34 2009
@@ -53,7 +53,7 @@
 		final String classname = clazz.getName();
 		final Locale locale = container.getLocale();
 		// TODO until now getStyle() == style + variation
-		final String style = container.getStyle();
+		final String style = container.getStyle() + "_" + container.getVariation();
 		final String markupType = container.getMarkupType();
 
 		final AppendingStringBuffer buffer = new AppendingStringBuffer(classname.length() + 64);

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupResourceStreamProvider.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupResourceStreamProvider.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupResourceStreamProvider.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/DefaultMarkupResourceStreamProvider.java Sun Sep 20 10:50:34 2009
@@ -70,6 +70,7 @@
 			.getResourceStreamLocator();
 
 		String style = container.getStyle();
+		String variation = container.getVariation();
 		Locale locale = container.getLocale();
 		String ext = container.getMarkupType();
 
@@ -80,7 +81,7 @@
 		{
 			String path = containerClass.getName().replace('.', '/');
 			IResourceStream resourceStream = locator.locate(container.getClass(), path, style,
-				locale, ext);
+				variation, locale, ext);
 
 			// Did we find it already?
 			if (resourceStream != null)

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CSSPackageResource.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CSSPackageResource.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CSSPackageResource.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CSSPackageResource.java Sun Sep 20 10:50:34 2009
@@ -216,9 +216,11 @@
 	 * @param path
 	 * @param locale
 	 * @param style
+	 * @param variation
 	 */
-	protected CSSPackageResource(Class<?> scope, String path, Locale locale, String style)
+	protected CSSPackageResource(Class<?> scope, String path, Locale locale, String style,
+		String variation)
 	{
-		super(scope, path, locale, style);
+		super(scope, path, locale, style, variation);
 	}
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CompressedPackageResource.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CompressedPackageResource.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CompressedPackageResource.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/CompressedPackageResource.java Sun Sep 20 10:50:34 2009
@@ -187,12 +187,14 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The style of the resource (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The compoent's variation (of the style)
 	 * @return The resource
 	 */
 	public static PackageResource newPackageResource(final Class<?> scope, final String path,
-		final Locale locale, final String style)
+		final Locale locale, final String style, final String variation)
 	{
-		return new CompressedPackageResource(scope, path, locale, style);
+		return new CompressedPackageResource(scope, path, locale, style, variation);
 	}
 
 	/**
@@ -207,10 +209,13 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The style of the resource
+	 * @param variation
+	 *            The compoent's variation (of the style)
 	 */
-	protected CompressedPackageResource(Class<?> scope, String path, Locale locale, String style)
+	protected CompressedPackageResource(Class<?> scope, String path, Locale locale, String style,
+		String variation)
 	{
-		super(scope, path, locale, style);
+		super(scope, path, locale, style, variation);
 		resourceStream = newResourceStream();
 	}
 

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/JavascriptPackageResource.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/JavascriptPackageResource.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/JavascriptPackageResource.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/JavascriptPackageResource.java Sun Sep 20 10:50:34 2009
@@ -271,9 +271,9 @@
 	 * @return The resource
 	 */
 	public static PackageResource newPackageResource(final Class<?> scope, final String path,
-		final Locale locale, final String style)
+		final Locale locale, final String style, final String variation)
 	{
-		return new JavascriptPackageResource(scope, path, locale, style);
+		return new JavascriptPackageResource(scope, path, locale, style, variation);
 	}
 
 	/**
@@ -283,10 +283,12 @@
 	 * @param path
 	 * @param locale
 	 * @param style
+	 * @param variation
 	 */
-	protected JavascriptPackageResource(Class<?> scope, String path, Locale locale, String style)
+	protected JavascriptPackageResource(Class<?> scope, String path, Locale locale, String style,
+		String variation)
 	{
-		super(scope, path, locale, style);
+		super(scope, path, locale, style, variation);
 	}
 
 	/**

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/PackageResource.java Sun Sep 20 10:50:34 2009
@@ -101,7 +101,7 @@
 	 */
 	public static void bind(Application application, Class<?> scope, String name)
 	{
-		bind(application, scope, name, null, null);
+		bind(application, scope, name, null, null, null);
 	}
 
 	/**
@@ -120,7 +120,7 @@
 	 */
 	public static void bind(Application application, Class<?> scope, String name, Locale locale)
 	{
-		bind(application, scope, name, locale, null);
+		bind(application, scope, name, locale, null, null);
 	}
 
 	/**
@@ -137,10 +137,12 @@
 	 *            The locale of the resource.
 	 * @param style
 	 *            The style of the resource.
+	 * @param variation
+	 *            The component's variation (of the style)
 	 * @throw IllegalArgumentException when the requested package resource was not found
 	 */
 	public static void bind(Application application, Class<?> scope, String name, Locale locale,
-		String style)
+		String style, final String variation)
 	{
 		if (name == null)
 		{
@@ -148,19 +150,20 @@
 		}
 
 		// first check on a direct hit for efficiency
-		if (exists(scope, name, locale, style))
+		if (exists(scope, name, locale, style, variation))
 		{
 			// we have got a hit, so we may safely assume the name
 			// argument is not a regular expression, and can thus
 			// just add the resource and return
-			PackageResource packageResource = get(scope, name, locale, style);
+			PackageResource packageResource = get(scope, name, locale, style, variation);
 			SharedResources sharedResources = Application.get().getSharedResources();
-			sharedResources.add(scope, name, locale, style, packageResource);
+			sharedResources.add(scope, name, locale, style, variation, packageResource);
 		}
 		else
 		{
 			throw new IllegalArgumentException("no package resource was found for scope " + scope +
-				", name " + name + ", locale " + locale + ", style " + style);
+				", name " + name + ", locale " + locale + ", style " + style + ", variation " +
+				variation);
 		}
 	}
 
@@ -177,14 +180,16 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The style of the resource (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component's variation (of the style)
 	 * @return true if a resource could be loaded, false otherwise
 	 */
 	public static boolean exists(final Class<?> scope, final String path, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		String absolutePath = Packages.absolutePath(scope, path);
 		return Application.get().getResourceSettings().getResourceStreamLocator().locate(scope,
-			absolutePath, style, locale, null) != null;
+			absolutePath, style, variation, locale, null) != null;
 	}
 
 	/**
@@ -201,7 +206,7 @@
 	 */
 	public static PackageResource get(final Class<?> scope, final String path)
 	{
-		return get(scope, path, null, null);
+		return get(scope, path, null, null, null);
 	}
 
 	/**
@@ -218,18 +223,21 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The style of the resource (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The compoent's variation (of the style)
 	 * @return The resource
 	 */
 	public static PackageResource get(final Class<?> scope, final String path, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		final SharedResources sharedResources = Application.get().getSharedResources();
 		PackageResource resource = (PackageResource)sharedResources.get(scope, path, locale, style,
-			true);
+			variation, true);
 		if (resource == null)
 		{
-			resource = newPackageResource(scope, path, locale, style);
-			Application.get().getSharedResources().add(scope, path, locale, style, resource);
+			resource = newPackageResource(scope, path, locale, style, variation);
+			Application.get().getSharedResources().add(scope, path, locale, style, variation,
+				resource);
 		}
 		return resource;
 	}
@@ -247,12 +255,14 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The style of the resource (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The compoent's variation (of the style)
 	 * @return The resource
 	 */
 	protected static PackageResource newPackageResource(final Class<?> scope, final String path,
-		final Locale locale, final String style)
+		final Locale locale, final String style, final String variation)
 	{
-		return new PackageResource(scope, path, locale, style);
+		return new PackageResource(scope, path, locale, style, variation);
 	}
 
 	/* removed in 2.0 */
@@ -270,7 +280,7 @@
 				if (pattern.matcher(name).matches() && (recurse || (name.indexOf('/') == -1)))
 				{
 					// we add the entry as a package resource
-					resources.add(get(scope, name, null, null));
+					resources.add(get(scope, name, null, null, null));
 				}
 			}
 		}
@@ -291,6 +301,9 @@
 	/** The resource's style */
 	private final String style;
 
+	/** The component's variation (of the style) */
+	private final String variation;
+
 	/**
 	 * Hidden constructor.
 	 * 
@@ -303,9 +316,11 @@
 	 *            The locale of the resource
 	 * @param style
 	 *            The style of the resource
+	 * @param variation
+	 *            The component's variation (of the style)
 	 */
 	protected PackageResource(final Class<?> scope, final String path, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		// Convert resource path to absolute path relative to base package
 		absolutePath = Packages.absolutePath(scope, path);
@@ -321,6 +336,7 @@
 		this.path = path;
 		this.locale = locale;
 		this.style = style;
+		this.variation = variation;
 
 		if (locale != null)
 		{
@@ -385,7 +401,7 @@
 		IResourceStream resourceStream = Application.get()
 			.getResourceSettings()
 			.getResourceStreamLocator()
-			.locate(getScope(), absolutePath, style, locale, null);
+			.locate(getScope(), absolutePath, style, variation, locale, null);
 
 		// Check that resource was found
 		if (resourceStream == null)
@@ -397,8 +413,9 @@
 			}
 
 			String msg = "Unable to find package resource [path = " + absolutePath + ", style = " +
-				style + ", locale = " + locale + "]";
+				style + ", variation = " + variation + ", locale = " + locale + "]";
 			log.warn(msg);
+
 			if (RequestCycle.get() instanceof WebRequestCycle)
 			{
 				throw new AbortWithWebErrorCodeException(HttpServletResponse.SC_NOT_FOUND, msg);

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/MarkupComponentBorder.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/MarkupComponentBorder.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/MarkupComponentBorder.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/border/MarkupComponentBorder.java Sun Sep 20 10:50:34 2009
@@ -23,7 +23,6 @@
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
 import org.apache.wicket.Response;
-import org.apache.wicket.Session;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.behavior.AbstractBehavior;
 import org.apache.wicket.markup.ContainerInfo;
@@ -184,9 +183,9 @@
 			.getResourceSettings()
 			.getResourceStreamLocator();
 
-		final Session session = Session.get();
-		final String style = session.getStyle();
-		final Locale locale = session.getLocale();
+		final String style = owner.getStyle();
+		final String variation = (owner == null ? null : owner.getVariation());
+		final Locale locale = owner.getLocale();
 
 		MarkupResourceStream markupResourceStream = null;
 		Class<?> containerClass = getClass();
@@ -194,13 +193,13 @@
 		while (!(containerClass.equals(MarkupComponentBorder.class)))
 		{
 			String path = containerClass.getName().replace('.', '/');
-			IResourceStream resourceStream = locator.locate(containerClass, path, style, locale,
-				markupType);
+			IResourceStream resourceStream = locator.locate(containerClass, path, style, variation,
+				locale, markupType);
 
 			// Did we find it already?
 			if (resourceStream != null)
 			{
-				ContainerInfo ci = new ContainerInfo(containerClass, locale, style, null,
+				ContainerInfo ci = new ContainerInfo(containerClass, locale, style, variation,
 					markupType);
 				markupResourceStream = new MarkupResourceStream(resourceStream, ci, containerClass);
 				break;

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/DefaultButtonImageResourceFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/DefaultButtonImageResourceFactory.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/DefaultButtonImageResourceFactory.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/DefaultButtonImageResourceFactory.java Sun Sep 20 10:50:34 2009
@@ -36,10 +36,12 @@
 public class DefaultButtonImageResourceFactory implements IResourceFactory
 {
 	/**
+	 * 
 	 * @see org.apache.wicket.IResourceFactory#newResource(java.lang.String, java.util.Locale,
-	 *      java.lang.String)
+	 *      java.lang.String, java.lang.String)
 	 */
-	public Resource newResource(final String specification, final Locale locale, final String style)
+	public Resource newResource(final String specification, final Locale locale,
+		final String style, final String variation)
 	{
 		final Parser parser = new Parser(specification);
 		if (parser.matches())

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/LocalizedImageResource.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/LocalizedImageResource.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/LocalizedImageResource.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/image/resource/LocalizedImageResource.java Sun Sep 20 10:50:34 2009
@@ -96,6 +96,9 @@
 	/** The style of the image resource */
 	private String style;
 
+	/** The component's variation (of the style) */
+	private String variation;
+
 	/**
 	 * Parses image value specifications of the form "[factoryName]:
 	 * [shared-image-name]?:[specification]"
@@ -166,6 +169,7 @@
 		this.component = component;
 		locale = component.getLocale();
 		style = component.getStyle();
+		variation = component.getVariation();
 	}
 
 	/**
@@ -258,11 +262,14 @@
 		// resource, then we need to reload the resource in the new locale
 		Locale l = component.getLocale();
 		String s = component.getStyle();
-		if (resourceKind == null && (!Objects.equal(locale, l) || !Objects.equal(style, s)))
+		String v = component.getVariation();
+		if (resourceKind == null &&
+			(!Objects.equal(locale, l) || !Objects.equal(style, s) || !Objects.equal(variation, v)))
 		{
 			// Get new component locale and style
 			locale = l;
 			style = s;
+			variation = v;
 
 			// Invalidate current resource so it will be reloaded/recomputed
 			resourceReference = null;
@@ -388,13 +395,14 @@
 			protected Resource newResource()
 			{
 				PackageResource pr = PackageResource.get(getScope(), getName(),
-					LocalizedImageResource.this.locale, style);
+					LocalizedImageResource.this.locale, style, variation);
 				locale = pr.getLocale();
 				return pr;
 			}
 		};
 		resourceReference.setLocale(locale);
 		resourceReference.setStyle(style);
+		resourceReference.setVariation(variation);
 		bind();
 	}
 
@@ -422,25 +430,26 @@
 			{
 				// Is resource already available via the application?
 				if (application.getSharedResources().get(Application.class, imageReferenceName,
-					locale, style, true) == null)
+					locale, style, variation, true) == null)
 				{
 					// Resource not available yet, so create it with factory and
 					// share via Application
 					final Resource imageResource = getResourceFactory(application, factoryName).newResource(
-						specification, locale, style);
+						specification, locale, style, variation);
 					application.getSharedResources().add(Application.class, imageReferenceName,
-						locale, style, imageResource);
+						locale, style, variation, imageResource);
 				}
 
 				// Create resource reference
 				resourceReference = new ResourceReference(Application.class, imageReferenceName);
 				resourceReference.setLocale(locale);
 				resourceReference.setStyle(style);
+				resourceReference.setVariation(variation);
 			}
 			else
 			{
 				resource = getResourceFactory(application, factoryName).newResource(specification,
-					locale, style);
+					locale, style, variation);
 			}
 		}
 		else

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/CompressedResourceReference.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/CompressedResourceReference.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/CompressedResourceReference.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/CompressedResourceReference.java Sun Sep 20 10:50:34 2009
@@ -46,11 +46,12 @@
 
 	/**
 	 * @see ResourceReference#ResourceReference(Class scope, String name, Locale locale, String
-	 *      style)
+	 *      style, String variation)
 	 */
-	public CompressedResourceReference(Class<?> scope, String name, Locale locale, String style)
+	public CompressedResourceReference(Class<?> scope, String name, Locale locale, String style,
+		String variation)
 	{
-		super(scope, name, locale, style);
+		super(scope, name, locale, style, variation);
 	}
 
 	/**
@@ -68,7 +69,7 @@
 	protected Resource newResource()
 	{
 		PackageResource packageResource = CompressedPackageResource.newPackageResource(getScope(),
-			getName(), getLocale(), getStyle());
+			getName(), getLocale(), getStyle(), getVariation());
 		if (packageResource != null)
 		{
 			locale = packageResource.getLocale();

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/JavascriptResourceReference.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/JavascriptResourceReference.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/JavascriptResourceReference.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/JavascriptResourceReference.java Sun Sep 20 10:50:34 2009
@@ -41,10 +41,12 @@
 	 * @param name
 	 * @param locale
 	 * @param style
+	 * @param variation
 	 */
-	public JavascriptResourceReference(Class<?> scope, String name, Locale locale, String style)
+	public JavascriptResourceReference(Class<?> scope, String name, Locale locale, String style,
+		String variation)
 	{
-		super(scope, name, locale, style);
+		super(scope, name, locale, style, variation);
 	}
 
 	/**
@@ -72,7 +74,7 @@
 	protected Resource newResource()
 	{
 		PackageResource packageResource = JavascriptPackageResource.newPackageResource(getScope(),
-			getName(), getLocale(), getStyle());
+			getName(), getLocale(), getStyle(), getVariation());
 		if (packageResource != null)
 		{
 			locale = packageResource.getLocale();

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/PackagedResourceReference.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/PackagedResourceReference.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/PackagedResourceReference.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/resources/PackagedResourceReference.java Sun Sep 20 10:50:34 2009
@@ -99,7 +99,8 @@
 					throw new IllegalArgumentException("The model must provide a string");
 				}
 				String f = getConverter(String.class).convertToString(str, getLocale());
-				ResourceReference ref = new ResourceReference(referer, f, getLocale(), getStyle());
+				ResourceReference ref = new ResourceReference(referer, f, getLocale(), getStyle(),
+					getVariation());
 				CharSequence url = urlFor(ref);
 				return url != null ? url.toString() : null;
 			}

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java Sun Sep 20 10:50:34 2009
@@ -554,10 +554,11 @@
 
 			this.attribute = attribute;
 			// Check whether it is a valid resource reference
-			if (PackageResource.exists(clazz, href, getLocale(), getStyle()))
+			if (PackageResource.exists(clazz, href, getLocale(), getStyle(), getVariation()))
 			{
 				// Create the component implementing the link
-				resourceReference = new ResourceReference(clazz, href, getLocale(), getStyle());
+				resourceReference = new ResourceReference(clazz, href, getLocale(), getStyle(),
+					getVariation());
 			}
 			else
 			{

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformer.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformer.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformer.java Sun Sep 20 10:50:34 2009
@@ -144,8 +144,8 @@
 		}
 
 		resourceStream = Application.get().getResourceSettings().getResourceStreamLocator().locate(
-			getClass(), filePath, component.getStyle(), component.getLocale(),
-			XsltTransformer.extension);
+			getClass(), filePath, component.getStyle(), component.getVariation(),
+			component.getLocale(), XsltTransformer.extension);
 
 		return resourceStream;
 	}

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/resource/SharedResourceRequestTarget.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/resource/SharedResourceRequestTarget.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/resource/SharedResourceRequestTarget.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/request/target/resource/SharedResourceRequestTarget.java Sun Sep 20 10:50:34 2009
@@ -160,7 +160,7 @@
 						path = path.replace(escapeString, "..");
 					}
 
-					if (PackageResource.exists(scope, path, null, null))
+					if (PackageResource.exists(scope, path, null, null, null))
 					{
 						resource = PackageResource.get(scope, path);
 					}

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/BundleStringResourceLoader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/BundleStringResourceLoader.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/BundleStringResourceLoader.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/BundleStringResourceLoader.java Sun Sep 20 10:50:34 2009
@@ -49,21 +49,12 @@
 	}
 
 	/**
-	 * Get the requested string resource from the underlying resource bundle. The bundle is selected
-	 * by locale and the string obtained from the best matching bundle.
 	 * 
-	 * @param clazz
-	 *            Not used for this implementation
-	 * @param key
-	 *            The key to obtain the string for
-	 * @param locale
-	 *            The locale identifying the resource set to select the strings from
-	 * @param style
-	 *            Not used for this implementation (see {@link org.apache.wicket.Session})
-	 * @return The string resource value or null if resource not found
+	 * @see org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(java.lang.Class,
+	 *      java.lang.String, java.util.Locale, java.lang.String, java.lang.String)
 	 */
 	public final String loadStringResource(final Class<?> clazz, final String key, Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		if (locale == null)
 		{
@@ -93,6 +84,6 @@
 	public final String loadStringResource(final Component component, final String key)
 	{
 		final Locale locale = (component != null) ? component.getLocale() : null;
-		return loadStringResource(null, key, locale, null);
+		return loadStringResource(null, key, locale, null, null);
 	}
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java Sun Sep 20 10:50:34 2009
@@ -55,14 +55,15 @@
 	}
 
 	/**
+	 * 
 	 * @see org.apache.wicket.resource.loader.ComponentStringResourceLoader#loadStringResource(java.lang.Class,
-	 *      java.lang.String, java.util.Locale, java.lang.String)
+	 *      java.lang.String, java.util.Locale, java.lang.String, java.lang.String)
 	 */
 	@Override
 	public String loadStringResource(final Class<?> clazz, final String key, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
-		return super.loadStringResource(clazzRef.get(), key, locale, style);
+		return super.loadStringResource(clazzRef.get(), key, locale, style, variation);
 	}
 
 	/**
@@ -75,7 +76,7 @@
 		if (component == null)
 		{
 			return loadStringResource(null, key, Session.get().getLocale(), Session.get()
-				.getStyle());
+				.getStyle(), null);
 		}
 		return super.loadStringResource(component, key);
 	}

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java Sun Sep 20 10:50:34 2009
@@ -108,10 +108,10 @@
 	/**
 	 * 
 	 * @see org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(java.lang.Class,
-	 *      java.lang.String, java.util.Locale, java.lang.String)
+	 *      java.lang.String, java.util.Locale, java.lang.String, java.lang.String)
 	 */
 	public String loadStringResource(Class<?> clazz, final String key, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		if (clazz == null)
 		{
@@ -121,7 +121,7 @@
 		if (log.isDebugEnabled())
 		{
 			log.debug("key: '" + key + "'; class: '" + clazz.getName() + "'; locale: '" + locale +
-				"'; Style: '" + style + "'");
+				"'; Style: '" + style + "'; Variation: '" + variation + "'");
 		}
 
 		// Load the properties associated with the path
@@ -132,7 +132,8 @@
 			String path = clazz.getName().replace('.', '/');
 
 			// Iterator over all the combinations
-			ResourceNameIterator iter = new ResourceNameIterator(path, style, locale, null);
+			ResourceNameIterator iter = new ResourceNameIterator(path, style, variation, locale,
+				null);
 			while (iter.hasNext())
 			{
 				String newPath = iter.next();
@@ -165,7 +166,7 @@
 				{
 					if (log.isDebugEnabled())
 					{
-						// log.debug("Properties file not found: '" + newPath + "'");
+						log.debug("Properties file not found: '" + newPath + "'");
 					}
 				}
 			}
@@ -222,6 +223,7 @@
 		String string = null;
 		Locale locale = component.getLocale();
 		String style = component.getStyle();
+		String variation = component.getVariation();
 
 		// The key prefix is equal to the component path relative to the
 		// current component on the top of the stack.
@@ -240,8 +242,7 @@
 			// component on the path from page down.
 			if ((prefix != null) && (prefix.length() > 0))
 			{
-				string = loadStringResource(clazz, prefix + '.' + key, locale, style);
-
+				string = loadStringResource(clazz, prefix + '.' + key, locale, style, variation);
 				if (string == null)
 				{
 					prefix = Strings.afterFirst(prefix, '.');
@@ -257,7 +258,7 @@
 			for (int i = searchStack.size() - 1; (i >= 0) && (string == null); i--)
 			{
 				Class<?> clazz = searchStack.get(i);
-				string = loadStringResource(clazz, key, locale, style);
+				string = loadStringResource(clazz, key, locale, style, variation);
 			}
 		}
 

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/IStringResourceLoader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/IStringResourceLoader.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/IStringResourceLoader.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/IStringResourceLoader.java Sun Sep 20 10:50:34 2009
@@ -61,9 +61,12 @@
 	 * @param style
 	 *            The style identifying the resource set to select the strings from (see
 	 *            {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The components variation (of the style)
 	 * @return The string resource value or null if the resource could not be loaded by this loader
 	 */
-	String loadStringResource(Class<?> clazz, String key, Locale locale, String style);
+	String loadStringResource(Class<?> clazz, String key, Locale locale, String style,
+		String variation);
 
 	/**
 	 * Get the string resource for the given combination of component and resource key. The

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/PackageStringResourceLoader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/PackageStringResourceLoader.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/PackageStringResourceLoader.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/PackageStringResourceLoader.java Sun Sep 20 10:50:34 2009
@@ -60,12 +60,12 @@
 
 	/**
 	 * 
-	 * @see org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(java.lang.Class,
-	 *      java.lang.String, java.util.Locale, java.lang.String)
+	 * @see org.apache.wicket.resource.loader.ComponentStringResourceLoader#loadStringResource(java.lang.Class,
+	 *      java.lang.String, java.util.Locale, java.lang.String, java.lang.String)
 	 */
 	@Override
 	public String loadStringResource(final Class<?> clazz, final String key, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		if (clazz == null)
 		{
@@ -86,7 +86,8 @@
 			String path = packageName + "/" + filename;
 
 			// Iterator over all the combinations
-			ResourceNameIterator iter = new ResourceNameIterator(path, style, locale, null);
+			ResourceNameIterator iter = new ResourceNameIterator(path, style, variation, locale,
+				null);
 			while (iter.hasNext())
 			{
 				String newPath = iter.next();

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/loader/ValidatorStringResourceLoader.java Sun Sep 20 10:50:34 2009
@@ -53,11 +53,12 @@
 	}
 
 	/**
+	 * 
 	 * @see org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(java.lang.Class,
-	 *      java.lang.String, java.util.Locale, java.lang.String)
+	 *      java.lang.String, java.util.Locale, java.lang.String, java.lang.String)
 	 */
 	public String loadStringResource(Class<?> clazz, final String key, final Locale locale,
-		final String style)
+		final String style, final String variation)
 	{
 		// only care about IValidator subclasses
 		if (clazz == null || !IValidator.class.isAssignableFrom(clazz))
@@ -75,7 +76,8 @@
 			String path = clazz.getName().replace('.', '/');
 
 			// iterate over all the combinations
-			ResourceNameIterator iter = new ResourceNameIterator(path, style, locale, null);
+			ResourceNameIterator iter = new ResourceNameIterator(path, style, variation, locale,
+				null);
 			while (iter.hasNext())
 			{
 				String newPath = iter.next();
@@ -127,10 +129,12 @@
 
 		Locale locale = component.getLocale();
 		String style = component.getStyle();
+		String variation = component.getVariation();
 
 		for (IValidator<?> validator : fc.getValidators())
 		{
-			String resource = loadStringResource(validator.getClass(), key, locale, style);
+			String resource = loadStringResource(validator.getClass(), key, locale, style,
+				variation);
 			if (resource != null)
 			{
 				return resource;

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/PackageResourceStream.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/PackageResourceStream.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/PackageResourceStream.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/PackageResourceStream.java Sun Sep 20 10:50:34 2009
@@ -55,7 +55,7 @@
 	{
 		String absolutePath = Packages.absolutePath(scope, path);
 		resourceStream = Application.get().getResourceSettings().getResourceStreamLocator().locate(
-			scope, absolutePath, null, null, null);
+			scope, absolutePath, null, null, null, null);
 
 		if (resourceStream == null)
 		{

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ExtensionResourceNameIterator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ExtensionResourceNameIterator.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ExtensionResourceNameIterator.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ExtensionResourceNameIterator.java Sun Sep 20 10:50:34 2009
@@ -22,8 +22,8 @@
 
 
 /**
- * Contains the logic to build the various combinations of file path, style and locale required
- * while searching for Wicket resources. The full filename will be built like:
+ * Contains the logic to build the various combinations of file path, style, variation and locale
+ * required while searching for Wicket resources. The full filename will be built like:
  * &lt;path&gt;_&lt;style&gt;_&lt;locale&gt;.&lt;extension&gt;.
  * <p>
  * Resource matches will be attempted in the following order:

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/IResourceStreamLocator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/IResourceStreamLocator.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/IResourceStreamLocator.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/IResourceStreamLocator.java Sun Sep 20 10:50:34 2009
@@ -46,7 +46,7 @@
 	public IResourceStream locate(Class<?> clazz, String path);
 
 	/**
-	 * Loads a resource, given a path, style, locale and extension.
+	 * Loads a resource, given a path, style, variation, locale and extension.
 	 * 
 	 * @param clazz
 	 *            The class loader for delegating the loading of the resource
@@ -54,6 +54,8 @@
 	 *            The path of the resource
 	 * @param style
 	 *            Any resource style, such as a skin style (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component's variation (of the style)
 	 * @param locale
 	 *            The locale of the resource to load
 	 * @param extension
@@ -61,6 +63,6 @@
 	 * 
 	 * @return The resource or null
 	 */
-	public IResourceStream locate(Class<?> clazz, String path, String style, Locale locale,
-		String extension);
+	public IResourceStream locate(Class<?> clazz, String path, String style, String variation,
+		Locale locale, String extension);
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/LocaleResourceNameIterator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/LocaleResourceNameIterator.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/LocaleResourceNameIterator.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/LocaleResourceNameIterator.java Sun Sep 20 10:50:34 2009
@@ -23,8 +23,8 @@
 
 
 /**
- * Contains the logic to build the various combinations of file path, style and locale required
- * while searching for Wicket resources. The full filename will be built like:
+ * Contains the logic to build the various combinations of file path, style, variation and locale
+ * required while searching for Wicket resources. The full filename will be built like:
  * &lt;path&gt;_&lt;style&gt;_&lt;locale&gt;.&lt;extension&gt;.
  * <p>
  * Resource matches will be attempted in the following order:

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceNameIterator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceNameIterator.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceNameIterator.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceNameIterator.java Sun Sep 20 10:50:34 2009
@@ -83,13 +83,15 @@
 	 *            The path of the resource without extension
 	 * @param style
 	 *            A theme or style (see {@link org.apache.wicket.Session})
+	 * @param variation
+	 *            The component's variation (of the style)
 	 * @param locale
 	 *            The Locale to apply
 	 * @param extensions
 	 *            the filname's extensions (comma separated)
 	 */
-	public ResourceNameIterator(String path, final String style, final Locale locale,
-		final String extensions)
+	public ResourceNameIterator(String path, final String style, final String variation,
+		final Locale locale, final String extensions)
 	{
 		this.locale = locale;
 		if ((extensions == null) && (path.indexOf('.') != -1))
@@ -102,7 +104,22 @@
 			this.extensions = extensions;
 		}
 
-		String filename = Strings.lastPathComponent(path, '/');
+		path = getLocaleFromFilename(path);
+
+		styleIterator = new StyleAndVariationResourceNameIterator(path, style, variation);
+	}
+
+	/**
+	 * Extract the locale from the filename in case where the user
+	 * 
+	 * @param path
+	 *            The file path
+	 * @return The updated path, without the locale
+	 * @TODO That should really be external to RNI in a helper kind of class
+	 */
+	protected String getLocaleFromFilename(String path)
+	{
+		final String filename = Strings.lastPathComponent(path, '/');
 		Matcher matcher = LOCALE_PATTERN.matcher(filename);
 		if (matcher.find())
 		{
@@ -139,7 +156,7 @@
 			}
 		} // else skip the whole thing... probably user specific underscores used
 
-		styleIterator = new StyleAndVariationResourceNameIterator(path, style, null);
+		return path;
 	}
 
 	/**

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/ResourceStreamLocator.java Sun Sep 20 10:50:34 2009
@@ -107,14 +107,16 @@
 	/**
 	 * 
 	 * @see org.apache.wicket.util.resource.locator.IResourceStreamLocator#locate(java.lang.Class,
-	 *      java.lang.String, java.lang.String, java.util.Locale, java.lang.String)
+	 *      java.lang.String, java.lang.String, java.lang.String, java.util.Locale,
+	 *      java.lang.String)
 	 */
 	public IResourceStream locate(final Class<?> clazz, String path, final String style,
-		final Locale locale, final String extension)
+		final String variation, final Locale locale, final String extension)
 	{
 		// Try the various combinations of style, locale and extension to find
 		// the resource.
-		ResourceNameIterator iter = new ResourceNameIterator(path, style, locale, extension);
+		ResourceNameIterator iter = new ResourceNameIterator(path, style, variation, locale,
+			extension);
 		while (iter.hasNext())
 		{
 			String newPath = iter.next();

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/StyleAndVariationResourceNameIterator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/StyleAndVariationResourceNameIterator.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/StyleAndVariationResourceNameIterator.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/resource/locator/StyleAndVariationResourceNameIterator.java Sun Sep 20 10:50:34 2009
@@ -77,7 +77,7 @@
 	 */
 	public boolean hasNext()
 	{
-		return (state < 3);
+		return (state < 4);
 	}
 
 	/**
@@ -91,7 +91,7 @@
 			state++;
 			if ((style != null) && (variation != null))
 			{
-				return path + '_' + style + '_' + variation;
+				return path + '_' + variation + '_' + style;
 			}
 		}
 
@@ -104,7 +104,16 @@
 			}
 		}
 
-		state = 3;
+		if (state == 2)
+		{
+			state++;
+			if (variation != null)
+			{
+				return path + '_' + variation;
+			}
+		}
+
+		state = 4;
 		return path;
 	}
 

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/MarkupParserTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/MarkupParserTest.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/MarkupParserTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/MarkupParserTest.java Sun Sep 20 10:50:34 2009
@@ -178,10 +178,11 @@
 	}
 
 	private MarkupResourceStream newMarkupResourceStream(final IResourceStreamLocator locator,
-		final Class c, final String style, final Locale locale, final String extension)
+		final Class c, final String style, final String variation, final Locale locale,
+		final String extension)
 	{
-		IResourceStream resource = locator.locate(c, c.getName().replace('.', '/'), style, locale,
-			extension);
+		IResourceStream resource = locator.locate(c, c.getName().replace('.', '/'), style,
+			variation, locale, extension);
 		MarkupResourceStream res = new MarkupResourceStream(resource, null, null);
 		return res;
 	}
@@ -197,7 +198,7 @@
 	{
 		IResourceStreamLocator locator = new ResourceStreamLocator();
 		MarkupResourceStream resource = newMarkupResourceStream(locator, getClass(), "1", null,
-			"html");
+			null, "html");
 
 		MarkupParser parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
@@ -206,21 +207,21 @@
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "2", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "2", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "3", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "3", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "4", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "4", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
@@ -228,42 +229,43 @@
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
 		// File from jar (URL resource)
-		resource = newMarkupResourceStream(locator, PageExpiredErrorPage.class, null, null, "html");
+		resource = newMarkupResourceStream(locator, PageExpiredErrorPage.class, null, null, null,
+			"html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "5", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "5", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "6", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "6", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "7", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "7", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "8", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "8", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();
 		log.info("tok(0)=" + tokens.get(0));
 		// Assert.assertEquals(docText, tokens.get(0).toString());
 
-		resource = newMarkupResourceStream(locator, getClass(), "9", null, "html");
+		resource = newMarkupResourceStream(locator, getClass(), "9", null, null, "html");
 		parser = new MarkupParser(resource);
 		parser.setWicketNamespace("wcn");
 		tokens = parser.parse();

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/PackageResourceTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/PackageResourceTest.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/PackageResourceTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/PackageResourceTest.java Sun Sep 20 10:50:34 2009
@@ -74,9 +74,9 @@
 		final SharedResources sharedResources = Application.get().getSharedResources();
 		PackageResource.bind(application, PackageResourceTest.class, "packaged1.txt");
 		assertNotNull("resource packaged1.txt should be available as a packaged resource",
-			sharedResources.get(PackageResourceTest.class, "packaged1.txt", null, null, true));
+			sharedResources.get(PackageResourceTest.class, "packaged1.txt", null, null, null, true));
 		assertNull("resource packaged2.txt should NOT be available as a packaged resource",
-			sharedResources.get(PackageResourceTest.class, "packaged2.txt", null, null, true));
+			sharedResources.get(PackageResourceTest.class, "packaged2.txt", null, null, null, true));
 	}
 
 	/**
@@ -109,34 +109,37 @@
 	{
 		Application.get().getSharedResources();
 		Resource invalidResource = new PackageResource(PackageResourceTest.class, "packaged3.txt",
-			Locale.ENGLISH, null);
+			Locale.ENGLISH, null, null);
 		assertNotNull(
 			"resource packaged3.txt SHOULD be available as a packaged resource even if it doesn't exist",
 			invalidResource);
 
-		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", null, null));
-		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", Locale.CHINA,
+		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", null, null,
 			null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", Locale.CHINA,
-			"foo"));
-		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", null, "foo"));
-		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en.txt", null, null));
-		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", null,
+			null, null));
+		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", Locale.CHINA,
+			"foo", null));
+		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1.txt", null, "foo",
 			null));
+		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en.txt", null,
+			null, null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", null,
-			"foo"));
+			null, null));
+		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt", null,
+			"foo", null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt",
-			Locale.US, null));
+			Locale.US, null, null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt",
-			Locale.CANADA, null));
+			Locale.CANADA, null, null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_en_US.txt",
-			Locale.CHINA, null));
+			Locale.CHINA, null, null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_foo_bar_en.txt",
-			null, null));
+			null, null, null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class, "packaged1_foo_bar_en_US.txt",
-			null, null));
+			null, null, null));
 		assertTrue(PackageResource.exists(PackageResourceTest.class,
-			"packaged1_foo_bar_en_US_MAC.txt", null, null));
+			"packaged1_foo_bar_en_US_MAC.txt", null, null, null));
 
 		try
 		{

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ApplicationStringResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ApplicationStringResourceLoaderTest.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ApplicationStringResourceLoaderTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ApplicationStringResourceLoaderTest.java Sun Sep 20 10:50:34 2009
@@ -65,7 +65,7 @@
 		WebApplication app = tester.getApplication();
 		IStringResourceLoader loader = new ClassStringResourceLoader(app.getClass());
 		Assert.assertNull("Unknown resource should return null", loader.loadStringResource(
-			component.getClass(), "test.string", Locale.getDefault(), null));
+			component.getClass(), "test.string", Locale.getDefault(), null, null));
 		tester.destroy();
 	}
 }

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/BundleStringResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/BundleStringResourceLoaderTest.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/BundleStringResourceLoaderTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/BundleStringResourceLoaderTest.java Sun Sep 20 10:50:34 2009
@@ -59,7 +59,7 @@
 	@Override
 	public void testLoaderValidKeyStyleNoLocale()
 	{
-		String s = loader.loadStringResource(component.getClass(), "test.string", null, "alt");
+		String s = loader.loadStringResource(component.getClass(), "test.string", null, "alt", null);
 		Assert.assertEquals("Resource should be loaded", "This is a test", s);
 	}
 
@@ -71,7 +71,7 @@
 	{
 		IStringResourceLoader loader = new BundleStringResourceLoader("unknown.resource");
 		Assert.assertNull("Unknown resource should return null", loader.loadStringResource(
-			component.getClass(), "test.string", Locale.getDefault(), null));
+			component.getClass(), "test.string", Locale.getDefault(), null, null));
 	}
 
 }

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ComponentStringResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ComponentStringResourceLoaderTest.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ComponentStringResourceLoaderTest.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/ComponentStringResourceLoaderTest.java Sun Sep 20 10:50:34 2009
@@ -68,7 +68,7 @@
 		page.add(c);
 		IStringResourceLoader loader = new ComponentStringResourceLoader();
 		Assert.assertNull("Missing resource should return null", loader.loadStringResource(
-			c.getClass(), "test.string.bad", Locale.getDefault(), null));
+			c.getClass(), "test.string.bad", Locale.getDefault(), null, null));
 	}
 
 	/**
@@ -77,7 +77,7 @@
 	public void testNullComponent()
 	{
 		Assert.assertNull("Null component should skip resource load", loader.loadStringResource(
-			null, "test.string", Locale.getDefault(), null));
+			null, "test.string", Locale.getDefault(), null, null));
 	}
 
 	/**
@@ -92,7 +92,8 @@
 		panel.add(c);
 		IStringResourceLoader loader = new ComponentStringResourceLoader();
 		Assert.assertEquals("Valid resourse string should be found", "Component string",
-			loader.loadStringResource(c.getClass(), "component.string", Locale.getDefault(), null));
+			loader.loadStringResource(c.getClass(), "component.string", Locale.getDefault(), null,
+				null));
 	}
 
 	/**
@@ -104,7 +105,7 @@
 		IStringResourceLoader loader = new ComponentStringResourceLoader();
 		Assert.assertEquals("Valid resourse string should be found", "Another string",
 			loader.loadStringResource(p.getClass(), "another.test.string", Locale.getDefault(),
-				null));
+				null, null));
 	}
 
 	/**
@@ -116,9 +117,9 @@
 		IStringResourceLoader loader = new ComponentStringResourceLoader();
 		Assert.assertEquals("Valid resource string should be found", "SubClass Test String",
 			loader.loadStringResource(p.getClass(), "subclass.test.string", Locale.getDefault(),
-				null));
+				null, null));
 		Assert.assertEquals("Valid resource string should be found", "Another string",
 			loader.loadStringResource(p.getClass(), "another.test.string", Locale.getDefault(),
-				null));
+				null, null));
 	}
 }

Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/StringResourceLoaderTestBase.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/StringResourceLoaderTestBase.java?rev=817006&r1=817005&r2=817006&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/StringResourceLoaderTestBase.java (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/StringResourceLoaderTestBase.java Sun Sep 20 10:50:34 2009
@@ -87,12 +87,12 @@
 	public void testLoaderValidKeyNoStyleDefaultLocale()
 	{
 		String s = loader.loadStringResource(component.getClass(), "test.string",
-			Locale.getDefault(), null);
+			Locale.getDefault(), null, null);
 		Assert.assertEquals("Resource should be loaded", "This is a test", s);
 
 		// And do it again to ensure caching path is exercised
 		s = loader.loadStringResource(component.getClass(), "test.string", Locale.getDefault(),
-			null);
+			null, null);
 		Assert.assertEquals("Resource should be loaded", "This is a test", s);
 	}
 
@@ -102,7 +102,7 @@
 	public void testLoaderInvalidKeyNoStyleDefaultLocale()
 	{
 		Assert.assertNull("Missing key should return null", loader.loadStringResource(
-			component.getClass(), "unknown.string", Locale.getDefault(), null));
+			component.getClass(), "unknown.string", Locale.getDefault(), null, null));
 	}
 
 	/**
@@ -111,7 +111,7 @@
 	public void testLoaderValidKeyNoStyleAlternativeLocale()
 	{
 		String s = loader.loadStringResource(component.getClass(), "test.string", new Locale("zz"),
-			null);
+			null, null);
 		Assert.assertEquals("Resource should be loaded", "Flib flob", s);
 	}
 
@@ -121,7 +121,7 @@
 	public void testLoaderInvalidKeyNoStyleAlternativeLocale()
 	{
 		Assert.assertNull("Missing key should return null", loader.loadStringResource(
-			component.getClass(), "unknown.string", new Locale("zz"), null));
+			component.getClass(), "unknown.string", new Locale("zz"), null, null));
 	}
 
 	/**
@@ -129,7 +129,7 @@
 	 */
 	public void testLoaderValidKeyStyleNoLocale()
 	{
-		String s = loader.loadStringResource(component.getClass(), "test.string", null, "alt");
+		String s = loader.loadStringResource(component.getClass(), "test.string", null, "alt", null);
 		Assert.assertEquals("Resource should be loaded", "Alt test string", s);
 	}
 
@@ -137,7 +137,4 @@
 	 * 
 	 */
 	public abstract void testLoaderUnknownResources();
-
 }
-
-//