Package org.apache.wicket.examples.guestbook

Examples of org.apache.wicket.examples.guestbook.Comment


      new PropertyModel<List<Comment>>(this, "commentList"))
    {
      @Override
      public void populateItem(final ListItem<Comment> listItem)
      {
        final Comment comment = listItem.getModelObject();
        listItem.add(new Label("date", new Model<Date>(comment.getDate())));
        listItem.add(new MultiLineLabel("text", comment.getText()));
      }
    });

    // we need to cancel the standard submit of the form in the onsubmit
    // handler,
View Full Code Here


     *            The name of this component
     */
    public CommentForm(final String id)
    {
      // Construct form with no validation listener
      super(id, new CompoundPropertyModel<Comment>(new Comment()));

      // Add text entry widget
      text = new TextArea<String>("text").setOutputMarkupId(true);
      add(text);
    }
View Full Code Here

     */
    @Override
    public final void onSubmit()
    {
      // Construct a copy of the edited comment
      final Comment comment = getModelObject();
      final Comment newComment = new Comment(comment);

      // Set date of comment to add
      newComment.setDate(new Date());

      // Add the component we edited to the list of comments
      commentList.add(0, newComment);

      // Clear out the text component
View Full Code Here

    comments.add(commentListView = new ListView("comments", new PropertyModel(this,
        "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()));
      }
    });
   
    // we need to cancel the standard submit of the form in the onsubmit handler,
    // otherwise we'll get double submits. To do so, we return false after the
View Full Code Here

     *            The name of this component
     */
    public CommentForm(final String id)
    {
      // Construct form with no validation listener
      super(id, new CompoundPropertyModel(new Comment()));

      // Add text entry widget
      text = new TextArea("text").setOutputMarkupId(true);
      add(text);
    }
View Full Code Here

     * Show the resulting valid edit
     */
    public final void onSubmit()
    {
      // Construct a copy of the edited comment
      final Comment comment = (Comment)getModelObject();
      final Comment newComment = new Comment(comment);

      // Set date of comment to add
      newComment.setDate(new Date());

      // Add the component we edited to the list of comments
      commentList.add(0, newComment);

      // Clear out the text component
View Full Code Here

      new PropertyModel<List<Comment>>(this, "commentList"))
    {
      @Override
      public void populateItem(final ListItem<Comment> listItem)
      {
        final Comment comment = listItem.getModelObject();
        listItem.add(new Label("date", new Model<Date>(comment.getDate())));
        listItem.add(new MultiLineLabel("text", comment.getText()));
      }
    });

    // we need to cancel the standard submit of the form in the onsubmit
    // handler,
View Full Code Here

     *            The name of this component
     */
    public CommentForm(final String id)
    {
      // Construct form with no validation listener
      super(id, new CompoundPropertyModel<Comment>(new Comment()));

      // Add text entry widget
      text = new TextArea<String>("text").setOutputMarkupId(true);
      add(text);
    }
View Full Code Here

     */
    @Override
    public final void onSubmit()
    {
      // Construct a copy of the edited comment
      final Comment comment = getModelObject();
      final Comment newComment = new Comment(comment);

      // Set date of comment to add
      newComment.setDate(new Date());

      // Add the component we edited to the list of comments
      commentList.add(0, newComment);

      // Clear out the text component
View Full Code Here

    comments.add(commentListView = new ListView("comments", new PropertyModel(this,
        "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()));
      }
    });

    // we need to cancel the standard submit of the form in the onsubmit
    // handler,
View Full Code Here

TOP

Related Classes of org.apache.wicket.examples.guestbook.Comment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.