<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2695198575290428800</id><updated>2012-01-13T07:29:25.117-08:00</updated><category term='griffon groovy swing java'/><category term='griffon'/><category term='java'/><category term='groovy'/><category term='swing'/><title type='text'>Dabble -&gt; Scribble</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dabblescribble.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dabblescribble.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Amir Laher</name><uri>http://www.blogger.com/profile/01613935936528870475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2695198575290428800.post-3584875411984353419</id><published>2009-12-12T13:51:00.000-08:00</published><updated>2009-12-12T14:57:04.693-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='swing'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='griffon'/><title type='text'>Griffon Bytes: Application Version at runtime</title><content type='html'>&lt;div&gt;Griffon is a Grails like application framework for developing desktop applications in Groovy. See my &lt;a href="http://dabblescribble.blogspot.com/2009_10_01_archive.html"&gt;earlier post&lt;/a&gt; for links.&lt;/div&gt;&lt;div&gt;'Griffon bytes' are/will be quick tips and notes about Griffon development. I'm just a dabbler, so these tips are definitely not authoritative ...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Application Version at runtime&lt;/b&gt;&lt;/div&gt;&lt;div&gt;It's useful to know an app's version number during runtime, for example, in an 'About' message box. The version number is stored in a file called application.properties, and sure enough all the entries in application.properties are available within every MVC component.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's the short version:&lt;/div&gt;&lt;div&gt;&lt;pre name="code" class="java"&gt;def versionString = 'version '+app.applicationProperties.'app.version'&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here's an example of using app.version in a View script.&lt;/div&gt;&lt;div&gt;See also app.name, using the same technique.&lt;/div&gt;&lt;div&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;application(title: app.applicationProperties.'app.name',&lt;br /&gt;size:[320,480],&lt;br /&gt;pack:false,&lt;br /&gt;//location:[50,50],&lt;br /&gt;locationByPlatform:true,&lt;br /&gt;) {&lt;br /&gt;menuBar()&lt;br /&gt; {&lt;br /&gt;menu(text:'Help')&lt;br /&gt;{&lt;br /&gt; menuItem (text:'About '+app.applicationProperties.'app.name', actionPerformed: {&lt;br /&gt;      optionPane(message: app.applicationProperties.'app.name' + ', version '+app.applicationProperties.'app.version'+"\n\nCopywrong 2009.\n")&lt;br /&gt;       .createDialog('About '+app.applicationProperties.'app.name')&lt;br /&gt;       .show()&lt;br /&gt;    })&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt;label('content  ...')&lt;br /&gt;} &lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;Note: I found this out by looking at Griffon 0.2 source code (see griffon.application.SwingApplication.groovy).&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2695198575290428800-3584875411984353419?l=dabblescribble.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dabblescribble.blogspot.com/feeds/3584875411984353419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2695198575290428800&amp;postID=3584875411984353419' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/3584875411984353419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/3584875411984353419'/><link rel='alternate' type='text/html' href='http://dabblescribble.blogspot.com/2009/12/griffon-bytes-application-version-at.html' title='Griffon Bytes: Application Version at runtime'/><author><name>Amir Laher</name><uri>http://www.blogger.com/profile/01613935936528870475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2695198575290428800.post-6454324340688487686</id><published>2009-11-07T14:11:00.001-08:00</published><updated>2009-11-07T16:59:26.789-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='swing'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='griffon'/><title type='text'>Starting out in Griffon: 3. Logging</title><content type='html'>&lt;div&gt;I soon wanted to do 3 things with logging in my Griffon app:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;Inject a logger (e.g. log4j) into all my MVC components.&lt;/li&gt;&lt;li&gt;Filter out the cruft from Groovy's massive stacktraces.&lt;/li&gt;&lt;li&gt;Log unhandled exceptions in the same way as everything else.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Here's how ...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;* Injecting log4j loggers in MVC components&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;I want to be able to write a log entry from anywhere in my MVC code, without needing to explicitly define the logger in each component. Griffon makes this easy ...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1. Grab a copy of log4j-1.x.xx.jar (there's one in GRIFFON_HOME/lib), and copy it into &lt;i&gt;[projectname]/lib&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;2. Initialise logging at application startup:&lt;/div&gt;&lt;div&gt;Edit the file &lt;i&gt;[projectname]/griffon-app/lifecycle/Initialize.groovy&lt;/i&gt;&lt;/div&gt;&lt;div&gt;To simply send logs to the console, just use BasicConfigurator. Add this line:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold; white-space: pre; font-family:monospace;font-size:medium;"&gt;org.apache.log4j.BasicConfigurator.configure()&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;... Normally, you would use a PropertyConfigurator, or maybe even call System.setProperty to tell log4j about your log4j configuration file.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;3. Inject a logger into each MVC component. &lt;/div&gt;&lt;div&gt;* Create or edit the file &lt;i&gt;[projectname]/griffon-app/conf/Events.groovy&lt;/i&gt;&lt;/div&gt;&lt;div&gt;* Add the following (I added 'mvc.' to the logger name because my MVC components are all in the 'default' package):&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;pre name="code" class="java"&gt;import org.apache.log4j.Logger&lt;br /&gt;onNewInstance = { klass, type, instance -&gt;&lt;br /&gt; instance.metaClass.logger = Logger.getLogger("mvc.${klass.name}")&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;Now, you can call &lt;i&gt;logger.debug("variable x is ${x}")&lt;/i&gt; from anywhere in your Model, View and Controller classes. &lt;/div&gt;&lt;div&gt;Sweet.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;* Filtering Groovy Stacktraces&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Groovy generates extremely long, unwieldy stacktraces. &lt;/div&gt;&lt;div&gt;Groovy itself provides support for filtering a lot of the 'noise', in &lt;a href="http://groovy.codehaus.org/api/org/codehaus/groovy/runtime/StackTraceUtils.html"&gt;org.codehaus.groovy.runtime.StackTraceUtils&lt;/a&gt;, so let's filter and forget.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Just wrap this call around any Throwable, whenever you log it: &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="  white-space: pre; font-family:monospace;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;StackTraceUtils.deepSanitize(t)&lt;/div&gt;&lt;div&gt;e.g. &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;logger.error("Uncaught exception: ${e.message}", StackTraceUtils.deepSanitize(e))&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; ... You could take this further and override 'logger.warn()' and 'logger.error()'&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;* Logging unhandled exceptions&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;I want to log unhandled exceptions in the same way I log everything else. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Simply configure an UncaughtExceptionHandler.&lt;/div&gt;&lt;div&gt;Again, I configure this in Initialize.groovy&lt;/div&gt;&lt;div&gt;1. Create an exception handler, something like this (I've put in the deepSanitize)&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;pre name="code" class="java"&gt;import org.apache.log4j.Logger&lt;br /&gt;import org.codehaus.groovy.runtime.StackTraceUtils&lt;br /&gt;import java.lang.Thread.UncaughtExceptionHandler&lt;br /&gt;&lt;br /&gt;class LoggingExceptionHandler implements UncaughtExceptionHandler {&lt;br /&gt; private static Logger logger = Logger.getLogger(LoggingExceptionHandler.class)&lt;br /&gt;&lt;br /&gt; public void uncaughtException(Thread t, Throwable e)&lt;br /&gt; {&lt;br /&gt;   logger.error("Uncaught exception ${e.message}", StackTraceUtils.deepSanitize(e) )&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;2. Configure the app to use the ExceptionHandler&lt;/div&gt;&lt;div&gt;Edit the file &lt;i&gt;[projectname]/griffon-app/lifecycle/Initialize.groovy&lt;/i&gt;&lt;/div&gt;&lt;div&gt;Add the following lines, *after* the log4j configuration lines:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;pre name="code" class="java"&gt;Thread.setDefaultUncaughtExceptionHandler(new LoggingExceptionHandler());&lt;br /&gt;System.setProperty("sun.awt.exception.handler",LoggingExceptionHandler.class.getName())&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;Note that this replaces the functionality of &lt;span class="Apple-style-span"  style="  white-space: pre-wrap; font-family:monospace;"&gt;griffon.util.GriffonExceptionHandler. &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;If you prefer, you could extend this instead&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;HTH.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Amir&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2695198575290428800-6454324340688487686?l=dabblescribble.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dabblescribble.blogspot.com/feeds/6454324340688487686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2695198575290428800&amp;postID=6454324340688487686' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/6454324340688487686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/6454324340688487686'/><link rel='alternate' type='text/html' href='http://dabblescribble.blogspot.com/2009/11/starting-out-in-griffon-3-logging.html' title='Starting out in Griffon: 3. Logging'/><author><name>Amir Laher</name><uri>http://www.blogger.com/profile/01613935936528870475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2695198575290428800.post-6076459117176600108</id><published>2009-11-07T12:45:00.000-08:00</published><updated>2009-11-07T14:08:30.405-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='swing'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='griffon'/><title type='text'>Starting out in Griffon: 2. Debugging</title><content type='html'>Having played a bit with some MVC code and got comfortable with 'griffon run-app', I wanted to take control of the development environment. Resorting to 'println' statements is just pants, so I got together some debugging and logging ..&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'll start with debugging. I'm assuming that you've done a command-line 'griffon create-app' by this point.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;Debugging&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Essentially, I'm running the app in debug mode and then attaching a 'remote debugger' from my IDE. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is kind-of a 2-step approach. Let me know if you have a one-step approach.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Note: I had trouble getting NetBeans to debug groovy code properly. It just couldn't seem to find the Groovy line numbers. I'm normally an Eclipse user, so that might have something to do with it.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;In this case, I'm using Eclipse. I have been using SSTS (SpringSource Tool Suite) distribution of Eclipse, (SSTS v2.1.0.SR01), and I downloaded the version with Groovy support included. I highly recommend this approach&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Create an Eclipse project (File &gt; New &gt; Groovy Project; "Create from existing source", i.e. your [projectname] &lt;projectname&gt;folder, as created by the command line 'griffon create-app')&lt;/projectname&gt;&lt;/div&gt;&lt;div&gt;You'll need to set the GRIFFON_HOME variable:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1. menu: Window &gt; Preferences&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;2. drill into Java &gt; Build Path &gt; 'Classpath Variables', and add a GRIFFON_HOME&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;1. Start app in 'debug' mode&lt;/b&gt;&lt;/div&gt;&lt;div&gt;You can start the app from the command-line ('griffon debug-app'), but I'd rather not.&lt;/div&gt;&lt;div&gt;I'm running the debug-app task from the eclipse 'Ant' view.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1. If you cant see an Ant view, choose menu: Window &gt; Show View &gt; Ant&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;2. Drag [projectname]&lt;project&gt;/build.xml from the Package Explorer view into the Ant view&lt;/project&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;3. Expand the project item and double-click debug-app.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;(this has the same effect as running 'griffon debug-app')&lt;/div&gt;&lt;div&gt;Then, I'm noting the port number from the console output:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;     [exec] Listening for transport dt_socket at address: &lt;b&gt;18290&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;2. Start a Remote Debugger&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Create and save a 'Debug Configuration':&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1. menu: Run &gt; Debug Configurations ...&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;2. Right-click "Remote Java Application" and select 'New'.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;3. In Connection Properties, put Host: localhost, Port: &lt;b&gt;18290&lt;/b&gt;, then click 'Debug'.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hey presto. Breakpoints work and stepping-through works great.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, on subsequent starts, you can just double-click the 'debug-app' ant task and then pick the Debug Configuration from the toolbar (see the bug icon in your toolbar). I tend to start the remote debugger as soon as I see that port reference in the console.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Simple really. Next up, logging ...&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2695198575290428800-6076459117176600108?l=dabblescribble.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dabblescribble.blogspot.com/feeds/6076459117176600108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2695198575290428800&amp;postID=6076459117176600108' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/6076459117176600108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/6076459117176600108'/><link rel='alternate' type='text/html' href='http://dabblescribble.blogspot.com/2009/11/starting-out-in-griffon-2-debugging.html' title='Starting out in Griffon: 2. Debugging'/><author><name>Amir Laher</name><uri>http://www.blogger.com/profile/01613935936528870475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2695198575290428800.post-3842986067780189030</id><published>2009-10-31T13:17:00.001-07:00</published><updated>2009-11-01T13:59:35.468-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='griffon groovy swing java'/><title type='text'>Starting out in Griffon: 1. Some links</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Griffon&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Griffon is a young Java desktop development framework, using Groovy as the main development language, and Model-View-Controller as the key development paradigm.&lt;/div&gt;&lt;div&gt;Griffon is a very young project, which has recently celebrated its first birthday. The documentation is still quite sparse.&lt;/div&gt;&lt;/div&gt;I recently started using Griffon in earnest, and I'm really loving it. I'd like to share some experiences about this very young project.&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;Why me likey?&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;In the past, Swing development has made me want to pull my own teeth out and stab my eyes with them. Too much GUI code, ugly L&amp;amp;F, awkward APIs, etc etc.&lt;/div&gt;&lt;div&gt;Groovy itself helps matters in several ways, improving APIs and reducing boilerplate code.&lt;/div&gt;&lt;div&gt;Griffon builds on these features, and adds in MVC structure, sensible defaults (convention over configuration), a 'plugin' ecosystem, and command-line tooling for build, deployment, code generation, and plugin management.&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:large;"&gt;FP, First Post&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;First up, I'm just going to list the main resources I've utilised to get going. &lt;/div&gt;&lt;div&gt;There's plenty of more experienced hands to offer introductions to the framework than me. They're just a bit spread out.&lt;/div&gt;&lt;div&gt;I'll describe my own experiences in later posts.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Griffon's own docs:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;As I say, it's a bit sparse. I've been limited to the bundled sample apps, &lt;a href="http://griffon.codehaus.org/Quick+Start"&gt;Griffon QuickStart&lt;/a&gt;, Griffon source code, and not least the user@ mailing list. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;SwingBuilder documentation:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;SwingBuilder is Groovy's main built-in helper for swing apps, and forms the basis for Griffon View objects.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;View development in Griffon begins here, and returns here regularly:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;  &lt;/span&gt;&lt;a href="http://groovy.codehaus.org/Alphabetical+Widgets+List"&gt;http://groovy.codehaus.org/Alphabetical+Widgets+List&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt; &lt;/span&gt;(still a bit sparse)&lt;/div&gt;&lt;div&gt; This page is also worth some study:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://groovy.codehaus.org/Multithreading+with+SwingBuilder"&gt;http://groovy.codehaus.org/Multithreading+with+SwingBuilder&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;(Remember, Swing doesn't manage threading for you, but SwingBuilder.doOutside and SwingBuilder.doLater make this task less of a chore)&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;The 'GriffonCast'&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt; &lt;/span&gt;There's just one screencast so far, but well worth watching, particularly for the demonstration of how easy it is to enable/disable buttons by binding them to a model property. Downloadable source available.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;  &lt;/span&gt;&lt;a href="http://www.griffoncast.com/episode-1/"&gt;http://www.griffoncast.com/episode-1/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Blogs&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Andres Almiray is one of the Griffon developers and certainly its most vocal contributor:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://www.jroller.com/aalmiray/"&gt;http://www.jroller.com/aalmiray/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Josh has written one great post in particular about Multiple Document Interfaces in Griffon:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://josh-in-antarctica.blogspot.com/"&gt;http://josh-in-antarctica.blogspot.com/&lt;/a&gt; (maybe check out his Griffon app PSICAT)&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;James has some handy tips:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://jameswilliams.be/blog/entry/tags/Griffon"&gt;http://jameswilliams.be/blog/entry/tags/Griffon&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Andres' E-Book (Early Access edition):&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Andres Almiray is writing 'Griffon In Action'. There's only 4 chapters of 15 so far, one's free anyway and one needs updating, but he's a good writer so why not buy it now.&lt;/div&gt;&lt;div&gt;Edit: the multithreading chapter is really worth reading, especially for desktop noobs like me&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://www.manning.com/almiray/"&gt;http://www.manning.com/almiray/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Also the book's example code is here:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;a href="http://code.google.com/p/griffoninaction/"&gt;http://code.google.com/p/griffoninaction/&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;General Groovy resources:&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Some Groovy docs I keep coming back to:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://groovy.codehaus.org/JN1015-Collections"&gt;http://groovy.codehaus.org/JN1015-Collections&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://docs.codehaus.org/display/GROOVY/JN2015-Files"&gt;http://docs.codehaus.org/display/GROOVY/JN2015-Files&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Mr Haki (very nice, concise &amp;amp; frequent posts for someone learning Groovy in their spare time)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://mrhaki.blogspot.com/"&gt;http://mrhaki.blogspot.com/&lt;/a&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;General Swing resources (other than the Swing API Docs!!):&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Java Desktop Links of the week (often contains Griffon snippets)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://jonathangiles.net/blog/"&gt;http://jonathangiles.net/blog/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;IDE stuff:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;NetBeans Griffon plugin (worked ok for me but still very alpha)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://blogs.sun.com/geertjan/entry/griffon_pre_alpha_netbeans_plugin"&gt;http://blogs.sun.com/geertjan/entry/griffon_pre_alpha_netbeans_plugin&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Eclipse Groovy plugins work well for me (in conjunction with the ant plugin)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;I am currently using SpringSource Tool Suite (a free but Spring-branded eclipse distribution):&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://www.springsource.com/products/sts"&gt;http://www.springsource.com/products/sts&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;JetBrains now have a free version of their IntelliJ IDEA, including Groovy support.&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Apparently it's as good as sliced bread&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;&lt;a href="http://www.jetbrains.com/idea/nextversion/free_java_ide.html"&gt;http://www.jetbrains.com/idea/nextversion/free_java_ide.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Please throw back more Griffon links&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Ta&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Amir&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2695198575290428800-3842986067780189030?l=dabblescribble.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dabblescribble.blogspot.com/feeds/3842986067780189030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2695198575290428800&amp;postID=3842986067780189030' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/3842986067780189030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2695198575290428800/posts/default/3842986067780189030'/><link rel='alternate' type='text/html' href='http://dabblescribble.blogspot.com/2009/10/starting-out-in-griffon-1-some-links.html' title='Starting out in Griffon: 1. Some links'/><author><name>Amir Laher</name><uri>http://www.blogger.com/profile/01613935936528870475</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
