Package net.sourceforge.pebble.api.decorator

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


        // do nothing
    } else {
      AbstractBlog blog = (AbstractBlog)request.getAttribute(Constants.BLOG_KEY);
      if (blog instanceof Blog) {
        Blog b = (Blog)blog;
        ContentDecoratorContext context = new ContentDecoratorContext();
        context.setView(ContentDecoratorContext.SUMMARY_VIEW);
        context.setMedia(ContentDecoratorContext.HTML_PAGE);

        List blogEntries = b.getRecentPublishedBlogEntries();
        ContentDecoratorChain.decorate(context, blogEntries);
        Collections.sort(blogEntries, new BlogEntryComparator());
        httpRequest.setAttribute(Constants.RECENT_BLOG_ENTRIES, blogEntries);
View Full Code Here


   * Tests that comments and TrackBacks are disabled.
   */
  public void testImageUriInBody() throws Exception {
    blogEntry.setCommentsEnabled(true);
    blogEntry.setTrackBacksEnabled(true);
    ContentDecoratorContext context = new ContentDecoratorContext();
    decorator.decorate(context, blogEntry);
    assertTrue(blogEntry.isCommentsEnabled());
    assertFalse(blogEntry.isTrackBacksEnabled());
  }
View Full Code Here

    super.setUp();

    decorator = new EscapeMarkupDecorator();
    blogEntry = new BlogEntry(blog);
    staticPage = new StaticPage(blog);
    context = new ContentDecoratorContext();
  }
View Full Code Here

    blogEntryEight = new BlogEntry(blog);

    service = new BlogService();

    decorator = new RelatedPostsDecorator();
    context = new ContentDecoratorContext();
  }
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();

    blogEntry = new BlogEntry(blog);
    decorator = new BlogTagsDecorator();
    context = new ContentDecoratorContext();
  }
View Full Code Here

    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    blogEntry.setDate(cal.getTime());
    decorator = new TrackBackAutoDiscoveryDecorator();
    context = new ContentDecoratorContext();
  }
View Full Code Here

    super.setUp();

    decorator = new PhotoDecorator();
    blogEntry = new BlogEntry(blog);
    staticPage = new StaticPage(blog);
    context = new ContentDecoratorContext();
  }
View Full Code Here

   * Tests that comments and TrackBacks are disabled.
   */
  public void testImageUriInBody() throws Exception {
    blogEntry.setCommentsEnabled(true);
    blogEntry.setTrackBacksEnabled(true);
    ContentDecoratorContext context = new ContentDecoratorContext();
    decorator.decorate(context, blogEntry);
    assertFalse(blogEntry.isCommentsEnabled());
    assertFalse(blogEntry.isTrackBacksEnabled());
  }
View Full Code Here

  /**
   * Tests that the rel="nofollow" link is added to comments.
   */
  public void testNoFollowAddedToComments() throws Exception {
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);

    Comment comment1 = blogEntry.createComment("title1", "body1", "author", "email", "website", "avatar", "127.0.0.1");
    blogEntry.addComment(comment1);
    Comment comment2 = blogEntry.createComment("title2", "body2", "author", "email", "website", "avatar", "127.0.0.1");
    blogEntry.addComment(comment2);
View Full Code Here

  /**
   * Tests that the rel="nofollow" link is added to TrackBacks.
   */
  public void testNoFollowAddedToTrackBacks() throws Exception {
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);

    TrackBack trackBack1 = blogEntry.createTrackBack("title", "excerpt", "url", "blogName", "127.0.0.1");
    blogEntry.addTrackBack(trackBack1);
    TrackBack trackBack2 = blogEntry.createTrackBack("title", "excerpt", "url", "blogName", "127.0.0.1");
    blogEntry.addTrackBack(trackBack2);
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.