@header@
Blog Entry Decorators |
Blog entry decorators are a type of Pebble plugin that allow you to extend the way that blog entries are displayed in the HTML pages of your blog and the XML newsfeeds that are generated. The following features have been externalized into decorators and are included in the distribution.
To write your own custom decorator, you need to write a Java class that implements the pebble.decorator.BlogEntryDecorator interface. A default implementation is also available to subclass from called pebble.decorator.BlogEntryDecoratorSupport. The code for the DisableResponseDecorator is shown here as an example. package pebble.decorator; import pebble.blog.BlogEntry; /** * Disables comments and TrackBacks for the blog entry. * * @author Simon Brown */ public class DisableResponseDecorator extends BlogEntryDecoratorSupport { /** * Executes the logic associated with this decorator. * * @param chain the chain of BlogEntryDecorators to apply * @param context the context in which the decoration is running * @throws BlogEntryDecoratorException * if something goes wrong when running the decorator */ public void decorate(BlogEntryDecoratorChain chain, BlogEntryDecoratorContext context) throws BlogEntryDecoratorException { BlogEntry blogEntry = context.getBlogEntry(); blogEntry.setCommentsEnabled(false); blogEntry.setTrackBacksEnabled(false); chain.decorate(context); } /** * Gets the name of this decorator. * * @return the name of this decorator as a String */ public String getName() { return "Disable response decorator"; } } |