you don't have to really subclass that concrete class.
You can return any model you want that fits youre needs.

johan


Huy Do wrote:
Thank you for the explanation. I understand it now after reading your explanation and rereading the docs. I was confused with the "ListItemModel implementation" part because I was wasn't subclassing ListItemModel in my code.
Huy

Johan Compagner wrote:

that getListItemModel() method can return a model that is detachable where you only hold the id of the
PickDetail object as state.
Then on attach you use that id to read youre PickDetail object from somewhere (db) so that you can
return it on getModelObject()

by default we have a ListItemModel that doesn't use the id but the index to lookup things But this is not very good for database data where the index (let say 3) can suddenly point to another object.

see forexample the wicket-stuf and then wicket-contrib-data cvs project.

johan


Huy Do wrote:

Thanks for the information. However, I was looking for something along the lines of

                 protected void populateItem(final ListItem item) {
final PickDetail pickDet = (PickDetail)item.getModelObject();
                     *item.addAllBeanProperties(pickDet);*
                 }

I also looked up the javadocs on and theres some information there I don't know how to apply

protected IModel <cid:part1.00090808.01020703@gmail.com> *getListItemModel*(IModel <cid:part1.00090808.01020703@gmail.com> listViewModel, int index) "ListItemModel implementation should use an id (e.g. the database' record id) to identify and load the list item model object."

what id is it talking about ?

thanks

Huy

Martijn Dashorst wrote:

      add(new ListView("rows", Arrays.asList(pick.getPickDetails()))
              {
       protected IModel getListItemModel(IModel arg0, int arg1) {
return new CompoundPropertyModel(super.getListItemModel(arg0, arg1));
       }
                  protected void populateItem(final ListItem item) {
final PickDetail pickDet = (PickDetail)item.getModelObject();
                      item.add(new Label("numberOfItems"));
                      item.add(new Label("batchCode"));
                  }
              });

Rename the ID of the first label. See the documentation on CompoundPropertyModel for more information.

Martijn

Huy Do wrote:

Hi,

Please see code below in relation to my question

       add(new ListView("rows", Arrays.asList(pick.getPickDetails()))
               {
                   protected void populateItem(final ListItem item) {
final PickDetail pickDet = (PickDetail)item.getModelObject(); item.add(new Label("items", pickDet.getNumberOfItems().toString())); item.add(new Label("batchCode", pickDet.getBatchCode()));
                   }
               });

Is there some sort of shortcut for the list view to use java bean properties which can then be accessed in the html as <span wicket:id="bean.getProperty()">blah</span> this would simplify things alot without the verbose Label code.

Of course the existing method is still useful when you need more control but most of the time, it just adds additional code which I really don't want to write :-)

Regards,

Huy


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user






-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to