Author: ehillenius Date: Fri Aug 3 18:20:13 2007 New Revision: 562638 URL: http://svn.apache.org/viewvc?view=rev&rev=562638 Log: WICKET-816
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java?view=diff&rev=562638&r1=562637&r2=562638 ============================================================================== --- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java (original) +++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Component.java Fri Aug 3 18:20:13 2007 @@ -1144,14 +1144,21 @@ } /** - * Gets the locale for the session holding this component. + * Gets the locale for this component. By default, it searches it parent for + * a locale. If no parents (it's a recursive search) returns a locale, it + * gets one from the session. * - * @return The locale for the session holding this component - * @see Component#getSession() + * @return The locale to be used for this component + * @see Session#getLocale() */ public Locale getLocale() { - return getSession().getLocale(); + Locale locale = null; + if (parent != null) + { + locale = parent.getLocale(); + } + return (locale != null) ? locale : getSession().getLocale(); } /** @@ -1555,13 +1562,18 @@ * Gets the variation string of this component that will be used to look up * markup for this component. Subclasses can override this method to define * by an instance what markup variation should be picked up. By default it - * will return null. + * will return null or the value of a parent. * * @return The variation of this component. */ public String getVariation() { - return null; + String variation = null; + if (parent != null) + { + variation = parent.getVariation(); + } + return variation; } /**