Thanks Martin,
That really helped. Though I did something else and now I have a new
problem.
It's an Ajax problem now.

Here's what I did:
In the constructor:
                idsModel = new LoadableDetachableModel() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        protected Object load() {
                                List<String> ids = new ArrayList<String>();
                                List<Property> properties =
                                                sageDal.getPreference(userId, 
SETTINGS_GROUP,
                                                                
HomePageSectionPanel.this.sectionId);
                                for (Property property : properties) {
                                        ids.add(property.getValue());
                                }
                                return ids;
                        }

                };

                linksPanel = new LinksPanel("links", idsModel);

I am adding the ListView in LinksPanel:
        private void init(final List<LinkContainer> links) {
                add(new LinksListView("listview", new AbstractReadOnlyModel() {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public Object getObject() {
                                return links;
                        }

                }));
        }
(I have a method that changes the String ids to the LinkContainer).

My problem is when setting new list.
Here is my code:
        public void setLinksIds(List<String> linksIds) {
                sageDal.setPreference(userId, SETTINGS_GROUP, sectionId,
linksIds.toArray(new String[0]));
        }

It works and I actually see the change in the database. When refreshing (or
checking in the DB) I see changes.

BUT, it doesn't change automatically.
I use a ModalWindow and here's where I add my panel to the modal:
                setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
                        private static final long serialVersionUID = 1L;

                        public void onClose(AjaxRequestTarget target) {
                                target.addComponent(homePageSectionPanel);
                        }
                });

I'm sure I need to add something else somewhere.
But what? and where ?

Thanks,

Eyal

Martin Makundi wrote:
> 
> 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?
>  }
> } );
> 
> 


-----
Eyal Golan
[EMAIL PROTECTED]

Visit:  http://jvdrums.sourceforge.net/ http://jvdrums.sourceforge.net/ 
LinkedIn:  http://www.linkedin.com/in/egolan74
href=http://www.linkedin.com/in/egolan74 
-- 
View this message in context: 
http://www.nabble.com/Confused-tp18064846p18066913.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]

Reply via email to