Package net.sourceforge.pebble.api.decorator

Examples of net.sourceforge.pebble.api.decorator.ContentDecoratorContext


  /**
   * Prepares the view for presentation.
   */
  public void prepare() {
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.SUMMARY_VIEW);
    context.setMedia(ContentDecoratorContext.NEWS_FEED);

    List blogEntries = (List)getModel().get(Constants.BLOG_ENTRIES);
    ContentDecoratorChain.decorate(context, blogEntries);
    getModel().put(Constants.BLOG_ENTRIES, blogEntries);
  }
View Full Code Here


   */
  public void prepare() {
    BlogEntry blogEntry = (BlogEntry)getModel().get(Constants.BLOG_ENTRY_KEY);
    BlogEntry previewBlogEntry = (BlogEntry)blogEntry.clone();

    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.PREVIEW);
    context.setMedia(ContentDecoratorContext.HTML_PAGE);
    blogEntry.getBlog().getContentDecoratorChain().decorate(context, previewBlogEntry);
    getModel().put("previewBlogEntry", previewBlogEntry);

    List timeZones = Arrays.asList(java.util.TimeZone.getAvailableIDs());
    Collections.sort(timeZones);
View Full Code Here

  private static final Log log = LogFactory.getLog(Comments.class);

  public Comment previewComment(String blogId, Comment comment) {
    Blog blog = BlogManager.getInstance().getBlog(blogId);

    ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
    decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
    decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);

    blog.getContentDecoratorChain().decorate(decoratorContext, comment);

    return comment;
  }
View Full Code Here

  }

  public Comment saveComment(String blogId, Comment comment) {
    Blog blog = BlogManager.getInstance().getBlog(blogId);

    ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
    decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
    decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);

    blog.getContentDecoratorChain().decorate(decoratorContext, comment);

    return comment;
  }
View Full Code Here

      Cookie rememberMe = CookieUtils.getCookie(request.getCookies(), "rememberMe");
      if (rememberMe != null) {
        getModel().put("rememberMe", "true");
      }

      ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
      decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
      decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);
      Comment comment = createBlankComment(blog, blogEntry, request);
      Comment decoratedComment = (Comment)comment.clone();
      blog.getContentDecoratorChain().decorate(decoratorContext, decoratedComment);
      getModel().put("decoratedComment", decoratedComment);
      getModel().put("undecoratedComment", comment);
View Full Code Here

      return new NotFoundView();
    } else if (!blogEntry.isCommentsEnabled()) {
      return new CommentConfirmationView();
    }

    ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
    decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
    decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);

    Comment decoratedComment = (Comment)comment.clone();
    blog.getContentDecoratorChain().decorate(decoratorContext, decoratedComment);
    getModel().put("decoratedComment", decoratedComment);
    getModel().put("undecoratedComment", comment);
View Full Code Here

      Cookie rememberMe = CookieUtils.getCookie(request.getCookies(), "rememberMe");
      if (rememberMe != null) {
        getModel().put("rememberMe", "true");
      }

      ContentDecoratorContext decoratorContext = new ContentDecoratorContext();
      decoratorContext.setView(ContentDecoratorContext.DETAIL_VIEW);
      decoratorContext.setMedia(ContentDecoratorContext.HTML_PAGE);
      Comment comment = createBlankComment(blog, blogEntry, request);
      Comment decoratedComment = (Comment)comment.clone();
      blog.getContentDecoratorChain().decorate(decoratorContext, decoratedComment);
      getModel().put("decoratedComment", decoratedComment);
      getModel().put("undecoratedComment", comment);
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.api.decorator.ContentDecoratorContext

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.