public final class NewsListPanel extends Panel {

    @SpringBean
    NewsService service;
    private List<News> NewsList;
    private PageableListView PAListView;

    public PageableListView getPAListView() {
        return PAListView;
    }

    public NewsListPanel(String id, List<News> NewsList) {
        super(id);
        this.NewsList = NewsList;
        PAListView = new PageableListView("NewsList", NewsList, 5) {


            @Override
            protected void populateItem(ListItem item) {
                News news = (News) item.getModelObject();
                item.add(new ActionLink("Delete", news) {

                    @Override
                    public void onClick() {
                        service.deleteNews(news);
                        setResponsePage(new NewsPage());
                    }
                });
                item.add(new Label("Time",
DateUtils.timeFormatted(news.getTimestamp())));
                item.add(new Label("Title", news.getTitle()));
                item.add(new Label("Content",
news.getContent()).setEscapeModelStrings(false));
            }
        };

        add(PAListView);
    }

    private class ActionLink extends Link {

        News news;

        public ActionLink(String id, News news) {
            super(id);
            this.news = news;
        }

        @Override
        public void onClick() {
            throw new UnsupportedOperationException("Not supported yet.");
        }

    }
}

In this code, when there is an onClick processing, everything is going well.
But when NewsPage(this panel is here) is generated, suddenly Unscheduled
onClick has appeared with News object which never existed.
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Unscheduled-onClick-tp2538634p2538634.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to