I wouldn't look to replace NetNewsWire or FeedDemon (I'm one of those guys who wears out carpet and the swivel feature of his chair by working simultaneously on a Mac and a PC all day long) but what's encouraging to me about this example is just how much can be accomplished with a few declarations using MXML and the Flash components bundled in Flex. It reminds me a bit of how I sometimes feel using Ruby or Python for certain tasks in a Java-dominated server world, in that while not appropriate in every tier -- it seems to excel in the web presentation tier -- it's refreshingly simple without sacrificing power.
<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application width="900" height="600" xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Style src="main.css"/>
<mx:Script>
var selectedBlog;
var selectedEntry;
function treeItemSelected(evt) {
// When a new blog is selected in the tree, use the HTTPService to get the feed
var url=evt.target.selectedItem.attributes.url;
if (url!=null) {
selectedBlog=url;
feed.send();
}
}
</mx:Script>
<!-- an XML document containing the list of blogs I read -->
<mx:XML id="treeModel" src="tree.xml"/>
<!-- The HTTP Service used to get the feeds -->
<mx:HTTPService id="feed" url="{selectedBlog}"/>
<mx:HBox>
<!-- The tree displaying blogs organized by categories -->
<mx:Tree width="250" heightFlex="1" change="treeItemSelected(event);">
{treeModel}
</mx:Tree>
<mx:VBox>
<!-- The blog header -->
<mx:VBox verticalGap="0" backgroundColor="#EEF5EE" borderStyle="outset" widthFlex="1">
<mx:Label styleName="title">
{feed.result.rss==null?feed.result.RDF.channel.title:feed.result.rss.channel.title}
</mx:Label>
<mx:Label>
{feed.result.rss==null?feed.result.RDF.channel.date:feed.result.rss.channel.lastBuildDate}
</mx:Label>
<mx:Link click="getUrl('mailto:'+event.target.label)">
{feed.result.rss==null?feed.result.RDF.channel.link:feed.result.rss.channel.link}
</mx:Link>
</mx:VBox>
<!-- A datagrid displaying the post titles for the selected blog -->
<mx:DataGrid widthFlex="1" height="220" change="selectedEntry=event.target.selectedItem"
dataProvider="{feed.result.rss==null?feed.result.RDF.item:feed.result.rss.channel.item}"
columnNames="{feed.result.rss==null?['title','date']:['title','pubDate']}"/>
<!-- The post excerpt -->
<mx:TextArea id="description" widthFlex="1" heightFlex="1" html="true" wordWrap="true" editable="false">
{selectedEntry.description}
</mx:TextArea>
<!-- A link to the article in the original blog -->
<mx:Link id="itemLink" click="getUrl(event.target.label, '_blank')">
{selectedEntry.link}
</mx:Link>
</mx:VBox>
</mx:HBox>
</mx:Application>