Resource lookups are now in HEAD. -Igor > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Eelco Hillenius > Sent: Monday, October 17, 2005 6:59 PM > To: [email protected] > Subject: Re: [Wicket-develop] FormComponent label values are > not getting picked up... > > I did't follow that discussion. But I have two remarks: > > looking at: resourceModel.put("label", > formComponent.getLabel().getObject(null)); > > I think we should do: resourceModel.put("label", > formComponent.getLabel().getObject(formComponent)); > in case the model does want to use the component. > > And what if the model is not null, but the model object is? I > think in that case it would be cleaner not to add it. > > Regarding the "[...warning resource not found...]" string: I > don't think we should even try to recover. I'm in favor of > failing fast. > When the throwing of exceptions is off, that could mean a > rather ugly message, but as a model was provided we can be > sure it was not meant like that - it's a bug. And that bug is > easier to track down with an ugly message than the id that > magically keeps appearing. > > Eelco > > > On 10/17/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > Seems Juergen did not implement this yet. I mentioned this in our > > discussion and he did not object so assumed this was implemented. > > The code at fault is here: > > AbstractValidator: > > > > protected Map messageModel(final FormComponent > formComponent) > > { > > final Map resourceModel = new HashMap(4); > > resourceModel.put("input", > formComponent.getInput()); > > resourceModel.put("name", formComponent.getId()); > > > > if (formComponent.getLabel() != null) > > { > > resourceModel.put("label", > > formComponent.getLabel().getObject(null)); > > } > > else > > { > > resourceModel.put("label", > formComponent.getId()); > > } > > return resourceModel; > > } > > > > It should be: > > > > protected Map messageModel(final FormComponent > formComponent) > > { > > final Map resourceModel = new HashMap(4); > > resourceModel.put("input", > formComponent.getInput()); > > resourceModel.put("name", formComponent.getId()); > > > > if (formComponent.getLabel() != null) > > { > > resourceModel.put("label", > > formComponent.getLabel().getObject(null)); > > } > > else { > > final String > > labelKey=formComponent.getForm().getId()+"."+formComponent.getId(); > > try { > > String > > label=formComponent.getLocalizer().getString(labelKey, > formComponent); > > resourceModel.put("label", label); > > } catch (MissingResourceException e) { > > resourceModel.put("label", > > formComponent.getId()); > > } > > } > > return resourceModel; > > } > > > > Not sure what the best way to create the labelkey is, but > the above is > > consistent with how it was created before the change. > > One little caveat of the above is that if wicket is > configured not to > > throw an exception on a missing resource the label variable will be > > populated with a "[...warning resource not found...]" string since > > that's what the localizer will return. Not sure how to > recover from it > > since it would be nice to have the formcomponent.getid() be the > > default label if all else fails like its doing right now. > > > > Thoughts? > > > > -Igor > > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of > > > Phil Kulak > > > Sent: Monday, October 17, 2005 2:02 PM > > > To: wicket-develop > > > Subject: [Wicket-develop] FormComponent label values are > not getting > > > picked up... > > > > > > ... from the property file. No matter what I do, $label is always > > > the id of the component. Anyone else notice this? > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: > > > Power Architecture Resource Center: Free content, downloads, > > > discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl > > > _______________________________________________ > > > Wicket-develop mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: > > Power Architecture Resource Center: Free content, downloads, > > discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl > > _______________________________________________ > > Wicket-develop mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, > discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Wicket-develop mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-develop > > >
------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
