Episode 2

Posted on 16. Nov, 2009 by todd in Screen Cast

Show notes for Episode 2

You can watch it here or if you prefer, you can download a higher resolution version (quicktime).

Convention Over Configuration

http://en.wikipedia.org/wiki/Convention_over_configuration
Code Conventions for the Java Programming Language http://java.sun.com/docs/codeconv/

Installing Griffon

http://griffon.codehaus.org/Download
Java SE Installers (Windows/Linux) http://java.sun.com/javase/downloads/index.jsp

Threading

Event Dispatch Thread (EDT) http://en.wikipedia.org/wiki/Event_dispatching_thread
Swing Utilities http://java.sun.com/javase/6/docs/api/javax/swing/SwingUtilities.html
JBusy Component – http://code.google.com/p/jbusycomponent/

Episode2View.groovy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.awt.BorderLayout
 
actions {
  action(id: "executeAction",
          name: "Execute",
          mnemonic: "E", accelerator: shortcut("E"), closure: controller.executeDirectoryList)
}
application(title: 'Episode 2',
        size: [480, 320],
        // pack: true,
        //location:[50,50],
        locationByPlatform: true,
        iconImage: imageIcon('/griffon-icon-48x48.png').image,
        iconImages: [imageIcon('/griffon-icon-48x48.png').image,
                imageIcon('/griffon-icon-32x32.png').image,
                imageIcon('/griffon-icon-16x16.png').image]
) {
  tabbedPane() {
    busyComponent(name: "Tab 1", id: "c1", constraints: BorderLayout.CENTER, busy: bind {model.loading}) {
      busyModel(description:"Loading...")
      panel(name: "Tab 1") {
        borderLayout()
        scrollPane(constraints: CENTER) {
          textArea(id: "results")
        }
        hbox(constraints: SOUTH) {
          button(executeAction)
        }
      }
    }
    panel(name: "Tab 2") {
    }
  }
}

Episode2Model.groovy

1
2
3
4
5
import groovy.beans.Bindable
 
class Episode2Model {
    @Bindable Boolean loading
}

Episode2Controller.groovy

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class Episode2Controller {
  // these will be injected by Griffon
  def model
  def view
 
  void mvcGroupInit(Map args) {
    // this method is called after model and view are injected
  }
 
 
  def executeDirectoryList = {evt = null ->
    model.loading = true
    doOutside {
      try {
        def result = "ls -laR /Library/Documentation".execute().text
        edt {
          view.results.text = result
        }
      } finally {
        model.loading = false
      }
    }
  }

6 Responses to “Episode 2”

  1. [...] This post was mentioned on Twitter by vaclav_pech, ToddCostella. ToddCostella said: The second episode of the GriffonCast available at http://tinyurl.com/yf7hpte. Convention over configuration, installing and threading [...]

  2. GriffonNoob

    17. Nov, 2009

    Again a great episode!

    How about a small ‘real life’ application in the next screencast?

  3. Raj

    21. Nov, 2009

    Great to see some screencasts on Griffon. Thanks for your efforts.

    Some suggestions:
    1) I just could not hear any audio. ( Even at max volume ). Just a faint whisper. ( Admittedly i have a pretty average set of speaker ) If you could record it at a higher volume, that would be great. It’s easy to reduce the volume if folks think it’s too high – but not the other way around.

    2) If you could magnify the command-line inputs you give, it would help to see what’s going on. When you have a high-res monitor and you sit in front of it, things might look good – but it’s difficult to see what you are typing.

    3) It would also be nice to see some simple but complete applications built. Could be some simple utility or tool.

    On the whole, thanks for all the hard work you’ve put into these screencasts. I appreciate it.

  4. [...] Source code [...]

  5. [...] Source code [...]

  6. Fabian

    22. Dec, 2009

    Nice and useful introduction to griffon. The only catch is that the volume is way to low. I don’t have headphones with me and have a very hard time understanding you. But thanks for the time and effort you put into this!

Leave a Reply

PHVsPjxsaT48c3Ryb25nPndvb19hZHNfcm90YXRlPC9zdHJvbmc+IC0gdHJ1ZTwvbGk+PGxpPjxzdHJvbmc+d29vX2FkXzI1MF9hZHNlbnNlPC9zdHJvbmc+IC0gPC9saT48bGk+PHN0cm9uZz53b29fYWRfMjUwX2ltYWdlPC9zdHJvbmc+IC0gaHR0cDovL3d3dy53b290aGVtZXMuY29tL2Fkcy93b290aGVtZXMtMjUweDI1MC5naWY8L2xpPjxsaT48c3Ryb25nPndvb19hZF8yNTBfdXJsPC9zdHJvbmc+IC0gaHR0cDovL3d3dy53b290aGVtZXMuY29tPC9saT48bGk+PHN0cm9uZz53b29fYWRfY29udGVudF9hZHNlb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