Sure I can appreciate that :) However I define my panels to accept certain
objects to chuck into the model, so thats fine.
It means I can provide translations for pojos from non wicket jars using a
method similar to wickets nice 1 class, 1 property file approach.
Eg,
mypanel extends panel {
On Wed, Apr 30, 2008 at 2:55 AM, Ned Collyer [EMAIL PROTECTED] wrote:
Still - would be nice if the
MarkupInheritanceResolver$TransparentWebMarkupContainer somehow indicated it
was the the page (and returned the pages model).
Component c=...;
boolean page=(c==c.getPage());
-igor
I
yepp, then the TransparentWebMarkupContainer gets passed in. And you're
right, it's gonna be a filthy hack if you try to find out if its a Page.
Unfortunately I've got no further suggestions but it'd be interesting to
know why you want to distinguish between pages and other components anyway
...
Thanks for your reply,
Maybe it's because I am using a wicket:message key=foobar/ in the
markup?!
There isn't really any code to show. I put the wicket:message into the
page, then i check the params coming in to the method.
I'll have a bit more of a play I think, but I would be interested in
I basically want the components Model.
It's legitimate for it to be null. So, if I can see which component is a
page, then i can easily call the getPage().getModel()
Of course if it's TransparentWebMarkupContainer then getModel returns null
even if the page has a model set.
It appears to work
I did an elegantish... workaround. - the page instantiates a panel - the
panel has the model.
Basically my pages defer almost everything to panels - and I guess it also
aids in their reuse/embeddability.
I'm quite familiar with instanceof thanks ;)
Michael Sparer wrote:
well one (as said
Page page=component.getPage() ?
-igor
On Tue, Apr 29, 2008 at 3:53 AM, Michael Sparer [EMAIL PROTECTED] wrote:
well one (as said ugly ;-)) way that comes to my mind is to ask if
component.getParent().getParent() instanceof Page (that should also work if
you use nested subpages).
sorry, but i dont really get what the problem is or why it matters
what component stringresourceloader gets. it simply traverses up the
hieararchy looking for .properties files
-igor
On Tue, Apr 29, 2008 at 4:55 PM, Ned Collyer [EMAIL PROTECTED] wrote:
Do you know an elegant solution Igor?
I'm writing my own
It does this
@Override
public String loadStringResource(Component component, String key) {
if (component == null) {
return null;
}
String result = null;
Locale locale = component.getLocale();
String style =
hm. dont know if doing localization based on type of model object is a
great idea. there are many usecases where model type is quiet
aribitrary, and as you have found out yourself you dont know what
component you get passed in, so you just need to handle it in a way
that makes sense to you.
-igor
comp instanceof Page ?
or am I misunderstanding somethin?
Ned Collyer wrote:
Hi,
I've written my own class that extends ComponentStringResourceLoader (i
might change it to extend some other class)
At any rate, when loadStringResource(Component component, String key) is
called, and
11 matches
Mail list logo