SAN Adventures

pageicon Monday Jun 22, 2009

Simple JavaFX Delicious RSS Feed Reader

I had long wished to create a RSS Feed parser which would parse the Delicious bookmarks feed. This time I sat down to code one! But ended up with a simple application. Nevertheless it was a great learning experience for me. The source code can be downloaded from here.

I would like to explaing the approach i adopted. There are only two views in this sample. One is the login view which is used to take the input of the username. Then the other is BookMarksView which shows the 10 latest added bookmarks. I have made use of the RSS API of the JavaFX SDK.

feedTask = RssTask{
        location:"http://feeds.delicious.com/v2/rss/{userName}"
        interval:60s;
        onChannel:function(channel:Channel):Void {
            delete myList;
        }

       onItem: function(item:Item):Void{
           var title= "{item.title}";
           var url="{item.link}";
           insert BookmarkItem{
               text: title;
               url: url;

           }into myList;
       }

       onDone: function():Void{
           updateBookmarks(myList, userName);
       }
 }
feedTask.start();

The above code is in Main.fx which gets the RSS feed from the specified URL and then fetches the title and the URL from the feed. I have made use of a CustomNode which is nothing but a Hyperlink control but with a few changes to suite ny needs. The title and the URL are used create a Hyperlink control and added to the Sequence. On completing the parsing the sequence in the BookmarksView is updated to the newly created sequence.

I have made use of the RSS API, Hyperlink, TextBox and Button controls. 

Login UI:

Bookmakrs UI:


For the standalone mode:

Click here for the Applet Mode.

The bookmark links work fine in the Applet mode. They can be made to work in the Stand alone mode as well but Netbeans is showing error for the usage:

java.awt.Desktop.getDesktop().browse("www.google.com" )  ;

So pretty much not done for Stand alone mode.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed