<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>No One Is Perfect &#187; swing</title>
	<atom:link href="http://watchitlater.com/blog/tag/swing/feed/" rel="self" type="application/rss+xml" />
	<link>http://watchitlater.com/blog</link>
	<description>A reluctant foray into the world of blogging.</description>
	<lastBuildDate>Sun, 13 Jun 2010 03:35:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>From Java to Groovy</title>
		<link>http://watchitlater.com/blog/2009/12/from-java-to-groovy/</link>
		<comments>http://watchitlater.com/blog/2009/12/from-java-to-groovy/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 00:15:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[My Code]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Closure]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://watchitlater.com/blog/?p=125</guid>
		<description><![CDATA[Recently I&#8217;ve been playing with some old Java Swing applications and I found myself wishing that I could replace all the anonymous inner-classes with some clean Groovy closures. The job of converting a java source file to a groovy source file is pretty simple and eminently scriptable. Here&#8217;s my take on a python script to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been playing with some old Java Swing applications and I found myself wishing that I could replace all the anonymous inner-classes with some clean Groovy closures. The job of converting a java source file to a groovy source file is pretty simple and eminently scriptable. Here&#8217;s my take on a python script to do just that:</p>
<pre name="code" class="py:nogutter">
from optparse import OptionParser
from subprocess import Popen, PIPE
import os

def rename(src, dest, use_svn):
    if use_svn:
        output = Popen(['svn', 'rename', src, dest], stdout=PIPE).communicate()
        print output[0]
    else:
        print 'mv', src, dest
        os.rename(src, dest)

def process_file(src, use_svn):
    if src.endswith('.java'):
        print 'Processing', src
        fd = open(src, 'r')
        lines = fd.readlines()
        fd.close()
        fd = open(src, 'w')
        for line in lines:
            text = line.rstrip()
            if text.endswith(';'):
                text = text[:-1]
            fd.write(text)
            fd.write('\n')
        fd.close()
        root = os.path.dirname(src)
        filename = os.path.basename(src)
        dest = os.path.join(root, filename[:-5] + '.groovy')
        rename(src, dest, use_svn)

def process_dir(dir_path, use_svn):
    for root, dirs, files in os.walk(dir_path):
        for filename in files:
            src = os.path.join(root, filename)
            process_file(src, use_svn)

if __name__ == '__main__':
    parser = OptionParser()
    parser.add_option('-s', '--svn', action='store_true', dest='use_svn', help='use svn to rename files')
    (options, args) = parser.parse_args()
    if len(args) > 0:
        target = args[0]
        if os.path.isfile(target):
            process_file(target, options.use_svn)
        else:
            process_dir(target, options.use_svn)
    else:
        process_dir(os.getcwd(), options.use_svn)
</pre>
<p>This means that I can now replace this:</p>
<pre name="code" class="java:nogutter">
public void actionPerformed(ActionEvent e) {
    executor.execute(new Runnable() {
        public void run() {
            controller.showBuckets();
        }
    });
}
</pre>
<p>with this:</p>
<pre name="code" class="java:nogutter">
public void actionPerformed(ActionEvent e) {
    executor.execute { controller.showBuckets() }
}
</pre>
<p>Now that&#8217;s refactoring <img src='http://watchitlater.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://watchitlater.com/blog/2009/12/from-java-to-groovy/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>S3DropBox 1.2 is now released</title>
		<link>http://watchitlater.com/blog/2009/05/s3dropbox-12-is-now-released/</link>
		<comments>http://watchitlater.com/blog/2009/05/s3dropbox-12-is-now-released/#comments</comments>
		<pubDate>Sat, 16 May 2009 11:17:39 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[My Code]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[NTLM]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://watchitlater.com/blog/?p=38</guid>
		<description><![CDATA[I love feedback &#8230; including bugs (thanks Cam). The S3DropBox will now only permit the creation of a bucket when Amazon S3 returns a HTTP 404 status code in response to a HTTP HEAD request for the bucket prior to creation. The new version can now be downloaded from http://code.google.com/p/s3dropbox/.
]]></description>
			<content:encoded><![CDATA[<p>I love feedback &#8230; including bugs (thanks Cam). The S3DropBox will now only permit the creation of a bucket when Amazon S3 returns a HTTP 404 status code in response to a HTTP HEAD request for the bucket prior to creation. The new version can now be downloaded from <a href="http://code.google.com/p/s3dropbox/">http://code.google.com/p/s3dropbox/</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://watchitlater.com/blog/2009/05/s3dropbox-12-is-now-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>S3DropBox 1.1 has been released</title>
		<link>http://watchitlater.com/blog/2009/04/s3dropbox-11-has-been-released/</link>
		<comments>http://watchitlater.com/blog/2009/04/s3dropbox-11-has-been-released/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 13:43:03 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[My Code]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[NTLM]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[S3]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://watchitlater.com/blog/?p=31</guid>
		<description><![CDATA[This release now permits the S3DropBox to be used in corporate environments (ie. behind authenticated proxies), including being able to handle NTLM authentication with proxies. HTTPS support has been enabled, although HTTP is still used by default. Check out the new release here.
]]></description>
			<content:encoded><![CDATA[<p>This release now permits the S3DropBox to be used in corporate environments (ie. behind authenticated proxies), including being able to handle NTLM authentication with proxies. HTTPS support has been enabled, although HTTP is still used by default. Check out the new release <a  href="http://code.google.com/p/s3dropbox/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://watchitlater.com/blog/2009/04/s3dropbox-11-has-been-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
