Skip to content

Instantly share code, notes, and snippets.

@kiy0taka
Created October 10, 2010 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiy0taka/619381 to your computer and use it in GitHub Desktop.
Save kiy0taka/619381 to your computer and use it in GitHub Desktop.
// g100pon #94 RSS/Atom Reader
@Grab('rome:rome-fetcher:1.0')
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;
import groovy.swing.SwingBuilder
import static javax.swing.JFrame.EXIT_ON_CLOSE
import static javax.swing.JSplitPane.VERTICAL_SPLIT
if (!args) {
println 'groovy FeedReader.groovy <feed url>'
System.exit 0
}
def fetcher = new HttpURLFeedFetcher()
def feed = fetcher.retrieveFeed(new URL(args[0]))
def entries = feed.entries
new SwingBuilder().with { edt {
frame(show:true, pack:true, defaultCloseOperation:EXIT_ON_CLOSE) {
splitPane(orientation:VERTICAL_SPLIT) {
scrollPane {
table(id:'table', mouseClicked: {
editor.page = new URL(entries[table.selectedRow].link)
}) {
tableModel(list:entries) {
propertyColumn(header:'title', propertyName:'title', cellEditor:null)
propertyColumn(header:'publishedDate', propertyName:'publishedDate', cellEditor:null)
}
}
}
scrollPane { editorPane(id:'editor', editable:false, contentType:'text/html') }
}
}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment