Package net.sourceforge.pebble.api.decorator

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


   */
  public void prepare() {
    StaticPage staticPage = (StaticPage)getModel().get(Constants.STATIC_PAGE_KEY);
    StaticPage previewStaticPage = (StaticPage)staticPage.clone();

    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.PREVIEW);
    context.setMedia(ContentDecoratorContext.HTML_PAGE);
    staticPage.getBlog().getContentDecoratorChain().decorate(context, previewStaticPage);
    getModel().put("previewStaticPage", previewStaticPage);
  }
View Full Code Here


   * @param entry   the BlogEntry to adapt
   * @return  a Hashtable representing the major properties of the entry
   */
  private Hashtable adaptBlogEntry(BlogEntry entry) {
    // first apply decorators - we don't want to go out naked :-)
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);
    context.setMedia(ContentDecoratorContext.XML_RPC);
    entry.getBlog().getContentDecoratorChain().decorate(context, entry);

    Hashtable post = new Hashtable();
    post.put(TITLE, entry.getTitle());
    post.put(SUBTITLE, entry.getSubtitle());
View Full Code Here

  }

  private void sendNotification(Comment comment) {
    Blog blog = comment.getBlogEntry().getBlog();

    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);
    context.setMedia(ContentDecoratorContext.EMAIL);

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

    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
    sdf.setTimeZone(blog.getTimeZone());
View Full Code Here

* @author    Simon Brown
*/
public class StaticPageView extends HtmlView {

  public void prepare() {
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);
    context.setMedia(ContentDecoratorContext.HTML_PAGE);

    StaticPage staticPage = (StaticPage)getModel().get(Constants.STATIC_PAGE_KEY);
    staticPage.getBlog().getContentDecoratorChain().decorate(context, staticPage);
  }
View Full Code Here

* @author    Simon Brown
*/
public class BlogEntriesView extends HtmlView {

  public void prepare() {
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.SUMMARY_VIEW);
    context.setMedia(ContentDecoratorContext.HTML_PAGE);

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

  private void sendNotification(BlogEntry blogEntry) {
    Blog blog = blogEntry.getBlog();

    // first of all decorate the blog entry, as if it was being rendered
    // via a HTML page or XML feed
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.SUMMARY_VIEW);
    context.setMedia(ContentDecoratorContext.EMAIL);
    blog.getContentDecoratorChain().decorate(context, blogEntry);

    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
    sdf.setTimeZone(blog.getTimeZone());
View Full Code Here

  private void sendNotification(BlogEntry blogEntry) {
    Blog blog = blogEntry.getBlog();

    // first of all decorate the blog entry, as if it was being rendered
    // via a HTML page or XML feed
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);
    context.setMedia(ContentDecoratorContext.EMAIL);
    blog.getContentDecoratorChain().decorate(context, blogEntry);

    SimpleDateFormat sdf = new SimpleDateFormat("dd MMM yyyy HH:mm:ss z");
    sdf.setTimeZone(blog.getTimeZone());
View Full Code Here

* @author    Simon Brown
*/
public class BlogEntryView extends HtmlView {

  public void prepare() {
    ContentDecoratorContext context = new ContentDecoratorContext();
    context.setView(ContentDecoratorContext.DETAIL_VIEW);
    context.setMedia(ContentDecoratorContext.HTML_PAGE);

    BlogEntry blogEntry = (BlogEntry)getModel().get(Constants.BLOG_ENTRY_KEY);
    blogEntry.getBlog().getContentDecoratorChain().decorate(context, blogEntry);
  }
View Full Code Here

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

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

        // 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<BlogEntry> blogEntries = b.getRecentPublishedBlogEntries();
        ContentDecoratorChain.decorate(context, blogEntries);
        Collections.sort(blogEntries, new BlogEntryComparator());
        httpRequest.setAttribute(Constants.RECENT_BLOG_ENTRIES, blogEntries);
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.