Hi!

Here is a good example of a list model:

public abstract class AbstractListChoiceModel<S> extends
AbstractReadOnlyModel<List<? extends S>> {
  @Override
  public final List<S> getObject() {
    return getChoices();
  }

  public abstract List<S> getChoices();
}

Now change your code as follows:

linksPanel = new LinksPanel("links", new AbstractListChoiceModel<String>() {
 @Override
 public List<String> getChoices() {
   // Where did you get your choices in the first place?
 }
} );




2008/6/23 egolan74 <[EMAIL PROTECTED]>:
>
> Hi,
> I have a page that holds a list (of Strings).
> In the constructor, I initialize the list.
>
> Then I call a Panel with this list to create a ListView of something.
> In a Modal window I set the list to have data in.
>
> The problem is that the list is initialized whenever I refresh the page (F5)
> (the Page's constructor is called).
> How can I pass this problem.
> Where should I keep a model that holds the list data?
>
> Some code:
> ... Class members:
> private List<String> linksIds;
> private final LinksPanel linksPanel;
>
> ... In the constructor:
> super(id);
>                setOutputMarkupId(true);
>                linksIds = new LinkedList<String>();
> ...
>                linksPanel = new LinksPanel("links", getLinksIds());
> ...
>
> The getters and setters:
>        public List<String> getLinksIds() {
>                return linksIds;
>        }
>
>        public void setLinksIds(List<String> linksIds) {
>                this.linksIds = linksIds;
>                linksPanel.setLinksByIds(linksIds);
>        }
>
> The setter is called when the user press OK in a Modal window.
> The list is changed and the UI changes Ajax-ly. So this is OK.
> The only problem is refreshing the Page.
>
> Thanks for any help,
>
>
>
>
> -----
> Eyal Golan
> [EMAIL PROTECTED]
>
> Visit:  http://jvdrums.sourceforge.net/ http://jvdrums.sourceforge.net/
> LinkedIn:  http://www.linkedin.com/in/egolan74
> http://www.linkedin.com/in/egolan74
> --
> View this message in context: 
> http://www.nabble.com/Confused-tp18064846p18064846.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to