Package er.ajax.example2.components

Source Code of er.ajax.example2.components.ExpensiveUpdates

package er.ajax.example2.components;

import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOContext;
import com.webobjects.foundation.NSMutableArray;

import er.ajax.example2.model.Comment;
import er.extensions.components.ERXLoremIpsumGenerator;

public class ExpensiveUpdates extends AjaxWOWODCPage {
  private NSMutableArray<Comment> _comments;
  public Comment _repetitionComment;
  public String _newComment;

  public ExpensiveUpdates(WOContext context) {
    super(context);
    _comments = new NSMutableArray<Comment>();
    for (int i = 0; i < 5; i++) {
      Comment c = new Comment();
      c.setText(ERXLoremIpsumGenerator.sentences(1));
      _comments.addObject(c);
    }
  }

  @Override
  protected boolean useDefaultComponentCSS() {
    return true;
  }

  public NSMutableArray<Comment> comments() {
    return _comments;
  }

  public Object cacheKey() {
    return Integer.valueOf(_comments.count());
  }

  public WOActionResults addComment() {
    Comment comment = new Comment();
    comment.setText(_newComment);
    _newComment = null;
    _comments.addObject(comment);
    return null;
  }
}
TOP

Related Classes of er.ajax.example2.components.ExpensiveUpdates

TOP
Copyright © 2018 www.massapi.com. 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.