de.enough.polish.browser.rss
Class RssTagHandler

java.lang.Object
  extended by de.enough.polish.browser.TagHandler
      extended by de.enough.polish.browser.rss.RssTagHandler

public class RssTagHandler
extends TagHandler


Field Summary
static String ATTR_RSS_ITEM
          Deprecated. use RssItem.ATTRIBUTE_KEY instead
static Command CMD_GO_TO_ARTICLE
          default go to article command
static Command CMD_RSS_ITEM_SELECT
          default select command
 
Constructor Summary
RssTagHandler(Command linkCommand, ItemCommandListener listener)
           
RssTagHandler(Command linkCommand, ItemCommandListener listener)
          Creates a new RSS tag handler
 
Method Summary
protected  void addRssItem(String rssTitle, String rssDescription, String rssUrl)
          Creates a new RSS item and it's link to the entry.
protected  void applyStylingForRssLink(Item item, int index, String rssUrl)
          Subclasses can override this method for adding complex styles to RSS links.
 boolean handleTag(Container parentItem, SimplePullParser parser, String tagName, boolean opening, HashMap attributeMap, Style style)
           
 boolean isIncludeDescriptions()
          Determines whether RSS descriptions should be included directly on the overview page
protected  void onViewUrl(String rssUrl, Item item)
          This method is called when an RSS item is actually being shown (visited).
 void register(Browser browser)
          Register a given browser object for this TagHandler.
 void setIncludeDescriptions(boolean includeDescriptions)
          Specifies whether RSS descriptions should be included directly on the overview page
 void setLinkCommand(Command link)
          Sets the command that is used for opening <a href...> links.
 void setRssLinkStyle()
          Sets a style different from .browserLink for items that point to RSS entries.
 void setRssLinkStyle(Style style)
          Sets a style different from .browserLink for items that point to RSS entries.
 
Methods inherited from class de.enough.polish.browser.TagHandler
addAttributeCommand, addCommands, addCommands, addTagCommand, getCommandsForTag, handleCommand, trim
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_RSS_ITEM

public static final String ATTR_RSS_ITEM
Deprecated. use RssItem.ATTRIBUTE_KEY instead
item attribute for storing the RSS item

See Also:
RssItem.ATTRIBUTE_KEY, Constant Field Values

CMD_RSS_ITEM_SELECT

public static Command CMD_RSS_ITEM_SELECT
default select command


CMD_GO_TO_ARTICLE

public static Command CMD_GO_TO_ARTICLE
default go to article command

Constructor Detail

RssTagHandler

public RssTagHandler(Command linkCommand,
                     ItemCommandListener listener)

RssTagHandler

public RssTagHandler(Command linkCommand,
                     ItemCommandListener listener)
Creates a new RSS tag handler

Parameters:
linkCommand - the command that should be used for links
listener - the corresponding command listener
Method Detail

setLinkCommand

public void setLinkCommand(Command link)
Sets the command that is used for opening <a href...> links.

Parameters:
link - the new command

register

public void register(Browser browser)
Description copied from class: TagHandler
Register a given browser object for this TagHandler. This method is used to make a handler object aware of a browser in case the handler needs to call methods of the browser during its work.

Specified by:
register in class TagHandler
Parameters:
browser - the browser to register.

handleTag

public boolean handleTag(Container parentItem,
                         SimplePullParser parser,
                         String tagName,
                         boolean opening,
                         HashMap attributeMap,
                         Style style)
Specified by:
handleTag in class TagHandler
Parameters:
parentItem - the container item the put the browser items into
parser - the parser
tagName - the name of the tag to handle
opening - true if this is an opening tag, false otherwise
attributeMap - all attributes for the tag
style - the style for the next item, can be null
Returns:
true if the tag was handled, false otherwise

addRssItem

protected void addRssItem(String rssTitle,
                          String rssDescription,
                          String rssUrl)
Creates a new RSS item and it's link to the entry.

Parameters:
rssTitle - the title of the RSS entry
rssDescription - the description
rssUrl - the URL for the complete article

applyStylingForRssLink

protected void applyStylingForRssLink(Item item,
                                      int index,
                                      String rssUrl)
Subclasses can override this method for adding complex styles to RSS links. If a style has been set using the setRssLinkStyle() method, that style is applied here by the default implementation. Otherwise the default implementation does not change anything.

Parameters:
item - the item that contains a link to the article
index - the index of the item
rssUrl - the URL of the RSS item

onViewUrl

protected void onViewUrl(String rssUrl,
                         Item item)
This method is called when an RSS item is actually being shown (visited). Subclasses may override this to react accordingly (e.g. by storing the URL for using visited styles within applyStylingForRssLink).

Parameters:
rssUrl - the URL of the RSS item that is to be shown
item - the UI item that is associated with the specified RSS URL
See Also:
applyStylingForRssLink(Item, int, String)

setRssLinkStyle

public void setRssLinkStyle()
Sets a style different from .browserLink for items that point to RSS entries. This method needs to be used with a #style preprocessing directive, e.g.
  //#style rssLink
  myRssTagHandler.setRssLinkStyle();
 


setRssLinkStyle

public void setRssLinkStyle(Style style)
Sets a style different from .browserLink for items that point to RSS entries.

Parameters:
style - the style

isIncludeDescriptions

public boolean isIncludeDescriptions()
Determines whether RSS descriptions should be included directly on the overview page

Returns:
true when descriptions should be included

setIncludeDescriptions

public void setIncludeDescriptions(boolean includeDescriptions)
Specifies whether RSS descriptions should be included directly on the overview page

Parameters:
includeDescriptions - true when descriptions should be included