Author: mgrigorov
Date: Wed Oct 19 15:15:34 2011
New Revision: 1186265
URL: http://svn.apache.org/viewvc?rev=1186265&view=rev
Log:
WICKET-4141 Automatic Linking in base page broken
Try the parent container class if the needed package resource doesn't exist.
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java?rev=1186265&r1=1186264&r2=1186265&view=diff
==============================================================================
---
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
(original)
+++
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/resolver/AutoLinkResolver.java
Wed Oct 19 15:15:34 2011
@@ -573,19 +573,24 @@ public final class AutoLinkResolver impl
this.parent = parent;
this.attribute = attribute;
+ ResourceReference reference = null;
// Check whether it is a valid resource reference
- if (PackageResource.exists(clazz, href, getLocale(),
getStyle(), getVariation()))
+ Class<?> cursor = clazz;
+ // iterate all parents because the auto linked resource
may come from
+ // inherited markup
+ while (cursor != null || cursor != Object.class)
{
- // Create the component implementing the link
- resourceReference = new
PackageResourceReference(clazz, href, getLocale(),
- getStyle(), getVariation());
- }
- else
- {
- // The resource does not exist. Set to null and
ignore when
- // rendering.
- resourceReference = null;
+ if (PackageResource.exists(cursor, href,
getLocale(), getStyle(), getVariation()))
+ {
+ // Create the component implementing
the link
+ reference = new
PackageResourceReference(cursor, href, getLocale(), getStyle(),
+ getVariation());
+ break;
+ }
+ cursor = cursor.getSuperclass();
+
}
+ resourceReference = reference;
}
/**