Author: ehillenius Date: Tue Jul 24 10:24:56 2007 New Revision: 559120 URL: http://svn.apache.org/viewvc?view=rev&rev=559120 Log: updated guestbook to reflect a more typical way of using the list view
Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.html incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.java Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.html URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.html?view=diff&rev=559120&r1=559119&r2=559120 ============================================================================== --- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.html (original) +++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.html Tue Jul 24 10:24:56 2007 @@ -16,8 +16,8 @@ <p/> <span wicket:id = "comments" id="comments"> <p> - <span wicket:id = "date">1/1/2004</span><br> - <span wicket:id = "text">Comment text goes here.</span> + <span wicket:id="date">1/1/2004</span><br> + <span wicket:id="text">Comment text goes here.</span> </p> </span> <wicket:remove> Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.java URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.java?view=diff&rev=559120&r1=559119&r2=559120 ============================================================================== --- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.java (original) +++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/guestbook/GuestBook.java Tue Jul 24 10:24:56 2007 @@ -26,9 +26,8 @@ import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.TextArea; import org.apache.wicket.markup.html.list.ListItem; -import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.markup.html.list.PropertyListView; import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.Model; /** @@ -45,9 +44,6 @@ /** A global list of all comments from all users across all sessions */ private static final List commentList = new ArrayList(); - /** The list view that shows comments */ - private final ListView commentListView; - /** * Constructor that is invoked when page is invoked without a session. */ @@ -57,13 +53,12 @@ add(new CommentForm("commentForm")); // Add commentListView of existing comments - add(commentListView = new ListView("comments", commentList) + add(new PropertyListView("comments", commentList) { public void populateItem(final ListItem listItem) { - final Comment comment = (Comment)listItem.getModelObject(); - listItem.add(new Label("date", new Model(comment.getDate()))); - listItem.add(new MultiLineLabel("text", comment.getText())); + listItem.add(new Label("date")); + listItem.add(new MultiLineLabel("text")); } }).setVersioned(false); } @@ -101,11 +96,7 @@ // Set date of comment to add newComment.setDate(new Date()); - - // Add the component we edited to the list of comments - commentListView.modelChanging(); commentList.add(0, newComment); - commentListView.modelChanged(); // Clear out the text component comment.setText("");