My Wicket version is 1.1 -- the latest production version. I was looking on the Constructor Summary, which says:
"PropertyModel(java.lang.Object modelObject, java.lang.String expression) Construct with an IModel object and a Ognl expression that works on the given model." The Constructor Detail repeats: "public PropertyModel(java.lang.Object modelObject, java.lang.String expression) Construct with an IModel object and a Ognl expression that works on the given model. ...." However, down below in the parameter description, I now see that it does indeed add: "modelObject - The model object, which may or may not implement IModel" But that sounds contradictory after the parameter was more prominently described as an IModel. Igor is correct in that the example does use a non-IModel object. I didn't look at the example (having already seen examples which do use IModel), and looked only at the constructor summary. When new users read about models, I think it is a challenge to keep straight whether a wrapped or pre-wrapped model is being spoken about -- the last thing we need is ambiguity! Perhaps it would be helpful if the constructor summary were changed to read: "Construct with a wrapped (IModel) or unwrapped (non-IModel) model object, and a Ognl expression that works on the given model." (And dropping the reference to Ognl for version 1.2, I guess). -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Juergen Donnerstag Sent: Tuesday, January 24, 2006 5:21 PM To: [email protected] Subject: Re: [Wicket-user] Creating a PropertyModel using a non-IModel POJO What is your Wicket version? This is from CVS HEAD * @param modelObject * The model object, which may or may not implement IModel and the whole file does not contain the word OGNL. Actually there is only one file NumericTypes.java which contains the word OGNL. Which makes sense as we don't use OGNL any more. The performance of OGNL was quite poor and because usually you'll need only a very limited subset of OGNL we decided to reimplement this piece of code. If you really require full OGNL support, you could create your own OgnlPropertyModel which uses the OGNL jar. Juergen On 1/25/06, Frank Silbermann <[EMAIL PROTECTED]> wrote: > > > > The JavaDoc for the PropertyModel constructor says that its parameters are > an IModel and an OGNL string, but I noticed that the code accepts any > java.lang.Object as the first parameter. I discovered this when trying to > sort out my confusion when the linkomatic example created a PropertyModel > using "this" (the page itself) instead of an IModel. > > > > At first I thought this looked like a hack, and asked myself: "If you > wanted to be able to accept either kind of object, why not use two > constructors?" Then I realized that java.lang.Object is the supertype of > everything, and maybe Java doesn't let you create overloaded constructors > where the only difference in parameter is type versus subtype. But if the > convenience of passing a non-IModel POJO is so important, then why not > mention it in the JavaDoc? > > > > Or is the capability of passing a non-IModel POJO to the constructor a > "deprecated" capability, perhaps included to ease the conversion of programs > from earlier versions of Wicket? (If that is the case, perhaps the > linkomatic example should be updated. The Page object could easily have > been wrapped before passing it to the PropertyModel constructor.) > > > > ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642 _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642 _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
