Author: ivaynberg Date: Sat Sep 27 00:43:23 2008 New Revision: 699592 URL: http://svn.apache.org/viewvc?rev=699592&view=rev Log: WICKET-1719
Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/model/StringResourceModel.java Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/model/StringResourceModel.java URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/model/StringResourceModel.java?rev=699592&r1=699591&r2=699592&view=diff ============================================================================== --- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/model/StringResourceModel.java (original) +++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/model/StringResourceModel.java Sat Sep 27 00:43:23 2008 @@ -51,10 +51,9 @@ * reusable components/containers that are packaged with their own string resource bundles it should * be the actual component/container rather than the page. For more information on this please see * [EMAIL PROTECTED] org.apache.wicket.resource.loader.ComponentStringResourceLoader}. The relative component - * may actually be <code>null</code> when all resource loading is to be done from a global - * resource loader. However, we recommend that a relative component is still supplied even in these - * cases in order to 'future proof' your application with regards to changing resource loading - * strategies. + * may actually be <code>null</code> when all resource loading is to be done from a global resource + * loader. However, we recommend that a relative component is still supplied even in these cases in + * order to 'future proof' your application with regards to changing resource loading strategies. * <li><b>model </b>- This parameter is mandatory if either the resourceKey, the found string * resource (see below) or any of the substitution parameters (see below) contain property * expressions. Where property expressions are present they will all be evaluated relative to this @@ -65,10 +64,10 @@ * <code>java.text.MessageFormat</code> object. Each parameter may be an ordinary Object, in which * case it will be processed by the standard formatting rules associated with * <code>java.text.MessageFormat</code>. Alternatively, the parameter may be an instance of - * <code>IModel</code> in which case the <code>getObject()</code> method will be applied prior - * to the parameter being passed to the <code>java.text.MessageFormat</code>. This allows such - * features dynamic parameters that are obtained using a <code>PropertyModel</code> object or even - * nested string resource models. + * <code>IModel</code> in which case the <code>getObject()</code> method will be applied prior to + * the parameter being passed to the <code>java.text.MessageFormat</code>. This allows such features + * dynamic parameters that are obtained using a <code>PropertyModel</code> object or even nested + * string resource models. * </ul> * As well as the supplied parameters, the found string resource can contain formatting information. * It may contain property expressions in which case these are evaluated using the model object @@ -226,11 +225,14 @@ public Object getObject() { - if (StringResourceModel.this.component != null) { + if (StringResourceModel.this.component != null) + { return StringResourceModel.this.getObject(); - } else { + } + else + { // TODO: Remove this as soon as we can break binary compatibility - StringResourceModel.this.component = this.component; + StringResourceModel.this.component = component; Object res = StringResourceModel.this.getObject(); StringResourceModel.this.component = null; return res; @@ -460,6 +462,12 @@ } } + // Make sure we have the locale + if (locale == null) + { + locale = Session.get().getLocale(); + } + String value = null; // Substitute any parameters if necessary Object[] parameters = getParameters();