Anything would have worked as long as the list that you return is
fresh by either using a detachable model, or one of the models that
re-evaluate on every call, like PropertyModels or e.g. a model like:

IModel listViewModel = new Model() {
  Object getObject(Component c) {
    return tmpInstrument.getCorrelations();
  }
}

There is no specific advantage of Loops over ListViews in this case.
Loops are simply designed to be a simpler but more limited version. of
ListView.

Eelco


On 4/4/06, Anders Peterson <[EMAIL PROTECTED]> wrote:
> That worked!
>
> I also had to move the declaration of tmpInstrument to inside the
> populateItem method (otherwise all rows were the same).
>
> Thanks!
>
> (I feel this was a bit more complicated than it should be.)
>
> Could this have been done with a CompoundPropertyModel and Loop:s
> instead of ListView:s - using ognl like instrument[i].correlation[j] ?
>
> /Anders
>
> Igor Vaynberg wrote:
> > actually, the string in the label is fine because the listview rebuilds its
> > items on every request so new labels will be created.
> >
> > the problem is here:
> > ListView tmpCorrList = new ListView(ID_CORRELATIONS,
> > tmpInstrument.getCorrelations())
> >
> > this is making listview use the same list w/out updating it on every
> > request, this should be a detachable model so that a fresh list is used on
> > every request:
> >
> > IModel listViewModel=new LoadableDetachableModel() { Object load() { return
> > tmpInstrument.getCorrelations(); }}
> > ListView tmpCorrList = new ListView(ID_CORRELATIONS, listViewModel) {
> > ...
> > };
> >
> > hope this helps,
> > -Igor
> >
> > On 4/4/06, Maurice Marrink <[EMAIL PROTECTED]> wrote:
> >> Hi,
> >>
> >> I am also wrestling with the matrix beast and am still exploring my
> >> options.
> >> However i might be able to help you out.
> >> In your code the label is given a string as diplay value. This string
> >> is not updated when the item model is. So you should give the label
> >> the model of the item.
> >> If you want some fancy numberformatting to take place you can always
> >> overwrite the getConverter() method of your label to convert the
> >> bigdecimal to a string there.
> >>
> >> Hope this helps.
> >>
> >> Maurice
> >>
> >> On 4/4/06, Anders Peterson wrote:
> >>> Hi All,
> >>>
> >>> With one page I'm displaying a matrix of numbers and I have a problem
> >>> updating/refreshing it. I roughly understand why it doesn't work, but I
> >>> don't know what the best/correct way to make it work is.
> >>>
> >>> Basically I have a ListView of rows and the last column in each row is
> >>> in turn a ListView creating more columns to the right. That final
> >>> ListView is implemented with the code you can see below.
> >>>
> >>> How was I supposed to have done this to have updating/refreshing happen
> >>> as automagically as possible?
> >>>
> >>> (I'm using Wicket 1.1.1)
> >>>
> >>> /Anders
> >>>
> >>> ListView tmpCorrList = new ListView(ID_CORRELATIONS,
> >>> tmpInstrument.getCorrelations()) {
> >>>
> >>>        BigDecimal tmpCoefficient;
> >>>
> >>>        public void populateItem(final ListItem anItem) {
> >>>
> >>>        tmpCoefficient = (BigDecimal) anItem.getModelObject();
> >>>
> >>>        anItem.add(new Label(ID_COEFFICIENT, tmpCoefficient.toString()));
> >>>
> >>> }
> >>>
> >>>
> >>> -------------------------------------------------------
> >>> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> >> language
> >>> that extends applications into web and mobile media. Attend the live
> >> webcast
> >>> and join the prime developer group breaking into this new coding
> >> territory!
> >>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> >>> _______________________________________________
> >>> Wicket-user mailing list
> >>> Wicket-user@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>>
> >>
> >> -------------------------------------------------------
> >> This SF.Net email is sponsored by xPML, a groundbreaking scripting
> >> language
> >> that extends applications into web and mobile media. Attend the live
> >> webcast
> >> and join the prime developer group breaking into this new coding
> >> territory!
> >> http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
> >> _______________________________________________
> >> Wicket-user mailing list
> >> Wicket-user@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >
>
>
> --
> http://ojalgo.org/
>
> Mathematics, Linear Algebra and Optimisation with Java
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to