Guten Tag Thorsten Schöning,
am Dienstag, 17. Februar 2015 um 17:58 schrieben Sie:
> I don't seem to understand how this is supposed to work as the
> TransparentMarkupContainer is automatically created by Wicket and it
> doesn't seem to me that it's parent component has any influence on the
> created object to provide it with a default model or whatever.
I've found the missing part myself: In case of no model for
TransparentMarkupContainer itself it calls through to it's parents
using Component.initModel to give those the chance to provide a model.
The nasty thing here is that a simple default model of a parent is not
enough, only models implementing the special interface
IComponentInheritedModel are accepted and this behavior doesn't seem
to be clearly enough documented to me. My default model was a simple
Map and obviously didn't implement it so it was not taken into
account.
And because the fun never stops, it seems that wicket:message as an
attribute is resolved using another class WicketMessageTagHandler
which implements a different behavior regarding variable substitution
which seems to result in a call to Component.getString without any
model at all:
> final String value;
> if (tag.getAttributes().containsKey(attr))
> {
> value = component.getString(key, null,
> tag.getAttributes().getString(attr));
> }
> else
> {
> value = component.getString(key);
> }
From my point of view both calls should provide the same model as
MessageContainer does, because in both cases the component is a
TransparentWebMarkupContainer with my custom panel as parent, which is
able to provide a default model. I don't see why there should be a
different approach than in MessageContainer.
Additionally it seems there's a misplaced comment in Localizer.getString:
> // If a property value has been found, or a default value was given,
> // than replace the placeholder and we are done
> if (value != null)
> {
> return value;
> }
There's no replacement done and the one mentioned seems to happen in
getStringIgnoreSettings already.
So half the way done and still no solution...
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail: [email protected]
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]