Created
October 10, 2010 17:13
-
-
Save kiy0taka/619381 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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