http://www.ergnosis.com/java-spec-report/java-language/jls-15.8.4.html

On 8/13/05, Gili <[EMAIL PROTECTED]> wrote:
> 
>         Ok, this works now but I need to be able to get at the current
> Hibernate session from within populateItem()... Would it be possible to
> add PageableDataView.getSession() or something or how else would I be
> able to make sure I get at the exact same session that was used to
> retrieve the item that was passed into populateItem()?
> 
> Thanks,
> Gili
> 
> Phil Kulak wrote:
> > Couple problems there. First of all, you need to add the nested
> > ListView to the DataItem, not the PageableDataView. And also, why are
> > you listing columns? List ONE and ListView will iterate over it.
> >
> > Could we please move all Wicket-related talk to the mailing list from now 
> > on?
> >
> > -Phil
> >
> > On 8/13/05, Gili <[EMAIL PROTECTED]> wrote:
> >
> >>        Ok, this still isn't working... My Java code reads:
> >>
> >>     final int NUM_COLUMNS = 4;
> >>     ColumnedDataProvider columns = new
> >>ColumnedDataProvider(NUM_COLUMNS, imageProvider);
> >>     PageableDataView images = new PageableDataView("images", columns,
> >>NUM_COLUMNS)
> >>     {
> >>       @Override
> >>         protected void populateItem(DataItem item)
> >>       {
> >>         List images = (List) item.getModelObject();
> >>         add(new ListView("columns", images)
> >>         {
> >>           @Override
> >>             protected void populateItem(ListItem item)
> >>           {
> >>             List images = (List) item.getModelObject();
> >>             int counter = 1;
> >>             for (Object nestedModel: images)
> >>             {
> >>               assert(counter < NUM_COLUMNS);
> >>               IModel typedModel = (IModel) nestedModel;
> >>               Image image = (Image) typedModel.getObject(null);
> >>               BufferedDynamicImageResource imageResource = new
> >>BufferedDynamicImageResource();
> >>               imageResource.setImage(image.toBufferedImage());
> >>               imageResource.setFormat("jpg");
> >>               item.add(new wicket.markup.html.image.Image("column" +
> >>counter, imageResource));
> >>               ++counter;
> >>             }
> >>           }
> >>         });
> >>       }
> >>     };
> >>
> >>        and the HTML reads:
> >>
> >>       <span wicket:id="images">
> >>         <span wicket:id="columns">
> >>           <span wicket:id="column1"></span>
> >>           <span wicket:id="column2"></span>
> >>           <span wicket:id="column3"></span>
> >>           <span wicket:id="column4"></span>
> >>         </span>
> >>       </span>
> >>
> >>        but Wicket complains at runtime:
> >>
> >>A child with id 'columns' already exists
> >>
> >>        What am I doing wrong?
> >>
> >>Gili
> >>
> >>Phil Kulak wrote:
> >>
> >>>Don't do the first one: IModel extends IDetachable.
> >>>
> >>>There's really no way to simplify more then that. They need to be
> >>>models so they can be detached. My feeling was that you would nest a
> >>>ListView in populateItem().
> >>>
> >>>On 8/13/05, Gili <[EMAIL PROTECTED]> wrote:
> >>>
> >>>
> >>>>FYI: Here is my populateItem...
> >>>>
> >>>>      @Override
> >>>>        protected void populateItem(DataItem item)
> >>>>      {
> >>>>        List images = (List) item.getModelObject();
> >>>>        for (Object nestedModel: images)
> >>>>        {
> >>>>                                       IModel typedModel = (IModel) 
> >>>> nestedModel;
> >>>>                                       Image image = (Image) 
> >>>> typedModel.getObject(null);
> >>>>        }
> >>>>      }
> >>>>
> >>>>       As you can see, the user gets a List<HibernateModel> so he needs to
> >>>>iterate over the elements *and* invoke IModel.getObject() to get the
> >>>>actual list item. Is there a way to simplify this further or is this the
> >>>>best it's going to get?
> >>>>
> >>>>Thanks,
> >>>>Gili
> >>>>
> >>>>Gili wrote:
> >>>>
> >>>>
> >>>>>   So my three changes are:
> >>>>>
> >>>>>1) HibernateModel now implements IDetachable
> >>>>>2) ColumnedDataProvider is not abstract
> >>>>>3) Wrap list item in ColumnedDataProvider:
> >>>>>row.add(dataProvider.model(i.next()));
> >>>>>
> >>>>>   Can you please confirm all these changes are valid?
> >>>>>
> >>>>>Thanks,
> >>>>>Gili
> >>>>
> >>>>--
> >>>>http://www.desktopbeautifier.com/
> >>>>
> >>>
> >>>
> >>--
> >>http://www.desktopbeautifier.com/
> >>
> >
> >
> 
> --
> http://www.desktopbeautifier.com/
> 
> 
> -------------------------------------------------------
> 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
> [email protected]
> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to