SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Downloaden Sie, um offline zu lesen
Griffon
                G*



2011   9   23
id:kiy0taka @kiy0taka

                JGGUG

                G*Magazine Griffon

                Griffon                 (?)


2011   9   23
create-command-alias
                $ griffon create-command-alias hoge 
                > test-app unit: foo.BarTests

                $ griffon hoge


                Grails
                                 Griffon

                                      (ry


2011   9   23
Griffon



                Grails




2011   9   23
Java
       package sample;                                                         contentPane.add(button);

       import   java.awt.Container;                                            setDefaultCloseOperation(EXIT_ON_CLOSE);
       import   java.awt.GridLayout;                                           pack();
       import   java.awt.event.ActionEvent;                                    setVisible(true);
       import   java.awt.event.ActionListener;                             }

       import   javax.swing.JButton;                                       public static void main(String[] args) {
       import   javax.swing.JFrame;                                            SwingUtilities.invokeLater(new Runnable() {
       import   javax.swing.JLabel;                                                public void run() {
       import   javax.swing.JTextArea;                                                 new Hello();
       import   javax.swing.SwingUtilities;                                        }
                                                                               });
       public class Hello extends JFrame {                                 }
                                                                       }
            public Hello() {
                super("Hello");

                 Container contentPane = getContentPane();
                 contentPane.setLayout(new GridLayout(3, 1));

                 JLabel label = new JLabel("Label");
                 contentPane.add(label);

                 JTextArea textArea = new JTextArea("Text Area");
                 textArea.setColumns(20);
                 textArea.setRows(2);
                 contentPane.add(textArea);

                 JButton button = new JButton("Button");
                 button.addActionListener(new ActionListener() {
                     public void actionPerformed(ActionEvent evt) {

                       }
                 });



2011   9   23
Groovy
                import groovy.swing.SwingBuilder

                new SwingBuilder().edt {
                    frame(title:'Hello', show:true, pack:true) {
                        gridLayout(cols:1, rows:3)
                        label 'Label'
                        textArea('Text Area', rows:2, columns:20)
                        button('Button', actionPerformed:{ evt ->
                            ...
                        })
                    }
                }




2011   9   23
Java

            button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    ...
                }
            });

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    ...
                }
            });



2011   9   23
&

                export GRIFFON_HOME=/path/to/griffon

                export PATH=$GRIFFON_HOME/bin:$PATH




2011   9   23
griffon            [   ]

                griffon create-app myApp

                griffon run-app

                griffon test-app

                griffon package



2011   9   23
Grails


2011   9   23
Griffon Wrapper

                griffonw / griffonw.bat

                Griffon



                gradlew

                CI



2011   9   23
View




2011   9   23
View



                SwingBuilder




2011   9   23
SwingBuilder

                groovy.swing.SwingBuilder

                Groovy

                javax.swing.JXxx -> xxx()

                  JButton -> button()

                  JLabel -> label()



2011   9   23
View

                application(title:'Sample', pack:true, ...) {
                    tableLayout {
                        tr {
                             td { label('User Name') }
                             td { textField(columns:20) }
                        }
                        tr {
                             td { label('Password') }
                             td { passwordField(columns:20) }
                        }
                        tr {
                             td(colspan:2, align:'right') { button('Submit') }
                        }
                    }
                }




2011   9   23
View
                // MyMenuBar.groovy
                menuBar {
                    menu('File') {
                        menuItem('Open')
                        menuItem('Save')
                    }
                }

                // MyAppView.groovy
                application(...) {
                    build(MyMenuBar)
                }

2011   9   23
View      Java
                // MyPanel.java
                class MyPanel extends JPanel {
                    ...
                }


                // MyAppView.groovy
                application(...) {
                    widget(new MyPanel())
                }


2011   9   23
SwingPad




2011   9   23
SwingPad




2011   9   23
View


                SwingPad




                GroovyConsole




2011   9   23
SwingBuilder
                View

                SwingPad




2011   9   23
generate-view-script


                NetBeans           View   Griffon

                NetBeans Griffon




2011   9   23
Model




2011   9   23
Model

                package sample

                class SampleModel {
                    String username
                    String password
                }




2011   9   23
View           Model

                Model   View




2011   9   23
Model
                 package sample

                 import groovy.beans.Bindable

                 class SampleModel {
                     @Bindable String username
                     @Bindable String password
                 }




2011   9   23
Model
                 package sample

                 import groovy.beans.Bindable

                 @Bindable
                 class SampleModel {
                     String username
                     String password
                 }




2011   9   23
View -> Model


  textField(text:bind(target:model, targetProperty:‘username’))

   textField(text:bind(target:model, ‘username’))




2011   9   23
Model -> View


  textField(text:bind(source:model, sourceProperty:‘username’))

   textField(text:bind(source:model, ‘username’))


   textField(text:bind { model.username })




2011   9   23
View -> View


           buttonGroup(id:'group1')
           radioButton(id:‘radio1’, ‘    ’, buttonGroup:group1)
           radioButton(id:‘radio2’, ‘      ’, buttonGroup:group1)
           textField(editable:bind(source:radio1,
               sourceEvent:‘itemStateChanged’,
               sourceValue:{radio1.selected}))




2011   9   23
// Model
           class Model {
               Date now = new Date()
           }

           // View
           label(text:bind(‘now’, source:model,
               converter:{it.format(‘yyyy-MM-dd’)}))




2011   9   23
// Model
           class Model {
               int num
           }

           // View
           textField(text:bind(‘num’, target:model,
               validator:{ it?.isInteger() }))




2011   9   23
constraints?
                class MyModel   {
                    @Bindable   String requiredText
                    @Bindable   String url
                    @Bindable   String email

                    static constraints = {
                        requiredText(blank:false)
                        url(url:true)
                        email(email:true)
                    }
                }

2011   9   23
Validation

                Grails         constraints Model

                model.validate()

                model.errors

                net.sourceforge.gvalidation.swing.ErrorMessagePanel




2011   9   23
ErrorMessagePanel

       // View
       widget(new ErrorMessagePanel(messageSource),
           errors: bind(source: model, 'errors'))




2011   9   23
Controller




2011   9   23
Controller

                class SampleController {
                    def model
                    def view

                    void mvcGroupInit(Map args) { ... }
                    void mvcGroupDestroy() { ... }

                    def fooAction = { evt -> ... }
                    def barAction = { evt -> ... }
                }




2011   9   23
View


           button(‘Click!’,
               actionPerformed:controller.fooAction)




2011   9   23
Model View

                Controller     Model

                             View




2011   9   23
Controller
                             ( < 0.9.2 )

                             0.9.2         UI




2011   9   23
@Threading


                griffon.transform.Threading




2011   9   23
class MyController {

                @Threading(Threading.Policy.INSIDE_UITHREAD_SYNC)
                def myAction = {
                }

           }




2011   9   23
Threading.Policy
                OUTSIDE_UITHREAD

                                        (   )

                INSIDE_UITHREAD_SYNC

                  UI

                INSIDE_UITHREAD_ASYNC

                  UI

                SKIP



2011   9   23
class MyController {

                def myAction = {
                    //
                    execSync {
                        //       UI
                        execOutside {
                            //
                        }
                    }
                }
           }


2011   9   23
exec

                execSync

                  UI

                execAsync

                  UI

                execOutside




2011   9   23
Java/Groovy/Griffon

                    Java         Groovy       Griffon

                new Thread()    doOutside   execOutside

                 invokeLater     doLater    execAsync

                invokeAndWait     edt        execSync


2011   9   23
MVC


                Model View   Controller

                MVC

                  griffon create-mvc myNewGroup




2011   9   23
create-mvc

                -skip(View|Model|Controller)

                  View/Model/Controller        MVC

                -fileType=(groovy|java|etc)

                  Java




2011   9   23
createMvcGroup


                    MVC

                createMvcGroup(groupType, groupName, args)




2011   9   23
MVC

                SplitPane            MVC

                TabbedPane         MVC




                View         MVC



2011   9   23
Group1

           // View
           button('Add tab', actionPerformed:controller.addTab)
           tabbedPane id: 'tabGroup'

           // Controller
           def addTab = {
             def name = new Date().format('yyyy-MM-dd HH:mm:ss')
             createMVCGroup("tab", name
               [tabGroup: view.tabGroup, tabName: name])
           }




2011   9   23
Group2


           // View
           tabbedPane(tabGroup, selectedIndex:tabGroup.tabCount) {
              panel(title: tabName) {
                   label(tabName)
              }
           }




2011   9   23
Spock + FEST




2011   9   23
Spock + FEST
           class CalcSpec extends FestSpec {
               def 'my first FEST spec'() {
                   when:
                   window.textBox('arg1').enterText(arg1)
                   window.textBox('arg2').enterText(arg2)
                   window.button('calculate').click()

                    then:
                    window.label('result').requireText(result)

                    where:
                    arg1 | arg2 | result
                    '1' | '1' | '2'
                    '1' | '2' | '3'
                }
           }
2011   9   23
WebStart/Applet/Jar/Zip



                  griffon package [webstart|applet|jar|zip]



                  izpack|mac|rpm|deb|jsmooth


2011   9   23
0.9.3




                Griffon

                          0.9.3



2011   9   23

Weitere ähnliche Inhalte

Was ist angesagt?

Say Hello To Ecmascript 5
Say Hello To Ecmascript 5Say Hello To Ecmascript 5
Say Hello To Ecmascript 5
Juriy Zaytsev
 
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2
PRN USM
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
cymbron
 
Swiss army knife Spring
Swiss army knife SpringSwiss army knife Spring
Swiss army knife Spring
Mario Fusco
 
Refactoring group 1 - chapter 3,4,6
Refactoring   group 1 - chapter 3,4,6Refactoring   group 1 - chapter 3,4,6
Refactoring group 1 - chapter 3,4,6
Duy Lâm
 

Was ist angesagt? (20)

Testing Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UKTesting Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UK
 
5 Favorite Gems (Lightning Talk(
5 Favorite Gems (Lightning Talk(5 Favorite Gems (Lightning Talk(
5 Favorite Gems (Lightning Talk(
 
Quiniela
QuinielaQuiniela
Quiniela
 
Say Hello To Ecmascript 5
Say Hello To Ecmascript 5Say Hello To Ecmascript 5
Say Hello To Ecmascript 5
 
Graphical User Components Part 1
Graphical User Components Part 1Graphical User Components Part 1
Graphical User Components Part 1
 
How do we use hooks
How do we use hooksHow do we use hooks
How do we use hooks
 
Kotlin Generation
Kotlin GenerationKotlin Generation
Kotlin Generation
 
Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2Graphical User Interface (GUI) - 2
Graphical User Interface (GUI) - 2
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 
Scala101, first steps with Scala
Scala101, first steps with ScalaScala101, first steps with Scala
Scala101, first steps with Scala
 
Swiss army knife Spring
Swiss army knife SpringSwiss army knife Spring
Swiss army knife Spring
 
New text document
New text documentNew text document
New text document
 
RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017RxSwift 활용하기 - Let'Swift 2017
RxSwift 활용하기 - Let'Swift 2017
 
Refactoring group 1 - chapter 3,4,6
Refactoring   group 1 - chapter 3,4,6Refactoring   group 1 - chapter 3,4,6
Refactoring group 1 - chapter 3,4,6
 
Swing
SwingSwing
Swing
 
Intro to Advanced JavaScript
Intro to Advanced JavaScriptIntro to Advanced JavaScript
Intro to Advanced JavaScript
 
Doc Parsers Api Cheatsheet 1 0
Doc Parsers Api Cheatsheet 1 0Doc Parsers Api Cheatsheet 1 0
Doc Parsers Api Cheatsheet 1 0
 
LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기LetSwift RxSwift 시작하기
LetSwift RxSwift 시작하기
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
 

Andere mochten auch (9)

Jenkins入門
Jenkins入門Jenkins入門
Jenkins入門
 
ミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考えるミニ四駆ジャパンカップで勝つ方法を考える
ミニ四駆ジャパンカップで勝つ方法を考える
 
JUC2012
JUC2012JUC2012
JUC2012
 
GDK48総選挙の裏側
GDK48総選挙の裏側GDK48総選挙の裏側
GDK48総選挙の裏側
 
Spockの基礎
Spockの基礎Spockの基礎
Spockの基礎
 
G * magazine 1
G * magazine 1G * magazine 1
G * magazine 1
 
javafx-mini4wd
javafx-mini4wdjavafx-mini4wd
javafx-mini4wd
 
BaseScriptについて
BaseScriptについてBaseScriptについて
BaseScriptについて
 
Jenkins plugin memo
Jenkins plugin memoJenkins plugin memo
Jenkins plugin memo
 

Ähnlich wie Griffon不定期便〜G*ワークショップ編〜

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdf
flashfashioncasualwe
 
Grails/Groovyによる開発事例紹介
Grails/Groovyによる開発事例紹介Grails/Groovyによる開発事例紹介
Grails/Groovyによる開発事例紹介
Kiyotaka Oku
 
Registro de venta
Registro de ventaRegistro de venta
Registro de venta
lupe ga
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
venkt12345
 
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
Tsuyoshi Yamamoto
 

Ähnlich wie Griffon不定期便〜G*ワークショップ編〜 (20)

JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
Groovy-er desktop applications with Griffon
Groovy-er desktop applications with GriffonGroovy-er desktop applications with Griffon
Groovy-er desktop applications with Griffon
 
Groovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With GriffonGroovy-er Desktop Applications With Griffon
Groovy-er Desktop Applications With Griffon
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
Write a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdfWrite a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdf
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdf
 
662305 11
662305 11662305 11
662305 11
 
Action bar
Action barAction bar
Action bar
 
Grails/Groovyによる開発事例紹介
Grails/Groovyによる開発事例紹介Grails/Groovyによる開発事例紹介
Grails/Groovyによる開発事例紹介
 
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai UniversityT.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
T.Y.B.S.CS Advance Java Practicals Sem 5 Mumbai University
 
The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196The Ring programming language version 1.7 book - Part 16 of 196
The Ring programming language version 1.7 book - Part 16 of 196
 
The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189The Ring programming language version 1.6 book - Part 15 of 189
The Ring programming language version 1.6 book - Part 15 of 189
 
Registro de venta
Registro de ventaRegistro de venta
Registro de venta
 
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdfimport java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
import java.awt.Color;import java.awt.Insets;import java.awt.Con.pdf
 
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
culadora cientifica en java
culadora cientifica en javaculadora cientifica en java
culadora cientifica en java
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Chap1 1.4
Chap1 1.4Chap1 1.4
Chap1 1.4
 

Mehr von Kiyotaka Oku

Mehr von Kiyotaka Oku (14)

Osaka Venture Meetup #3
Osaka Venture Meetup #3Osaka Venture Meetup #3
Osaka Venture Meetup #3
 
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
巨大不明ビルドの継続的統合を目的とするビルドパイプラインを主軸とした作戦要綱
 
日本Grails/Groovyユーザーグループ
日本Grails/Groovyユーザーグループ日本Grails/Groovyユーザーグループ
日本Grails/Groovyユーザーグループ
 
GroovyConsole2
GroovyConsole2GroovyConsole2
GroovyConsole2
 
GroovyConsole
GroovyConsoleGroovyConsole
GroovyConsole
 
Jenkinsプラグインの作り方
Jenkinsプラグインの作り方Jenkinsプラグインの作り方
Jenkinsプラグインの作り方
 
Devsumi Openjam
Devsumi OpenjamDevsumi Openjam
Devsumi Openjam
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
 
とある断片の超動的言語
とある断片の超動的言語とある断片の超動的言語
とある断片の超動的言語
 
Mote Hudson
Mote HudsonMote Hudson
Mote Hudson
 
Groovy and-hudson2
Groovy and-hudson2Groovy and-hudson2
Groovy and-hudson2
 
Gaelyk
GaelykGaelyk
Gaelyk
 
JDO
JDOJDO
JDO
 
Grails on GAE/J
Grails on GAE/JGrails on GAE/J
Grails on GAE/J
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

Griffon不定期便〜G*ワークショップ編〜

  • 1. Griffon G* 2011 9 23
  • 2. id:kiy0taka @kiy0taka JGGUG G*Magazine Griffon Griffon (?) 2011 9 23
  • 3. create-command-alias $ griffon create-command-alias hoge > test-app unit: foo.BarTests $ griffon hoge Grails Griffon (ry 2011 9 23
  • 4. Griffon Grails 2011 9 23
  • 5. Java package sample; contentPane.add(button); import java.awt.Container; setDefaultCloseOperation(EXIT_ON_CLOSE); import java.awt.GridLayout; pack(); import java.awt.event.ActionEvent; setVisible(true); import java.awt.event.ActionListener; } import javax.swing.JButton; public static void main(String[] args) { import javax.swing.JFrame; SwingUtilities.invokeLater(new Runnable() { import javax.swing.JLabel; public void run() { import javax.swing.JTextArea; new Hello(); import javax.swing.SwingUtilities; } }); public class Hello extends JFrame { } } public Hello() { super("Hello"); Container contentPane = getContentPane(); contentPane.setLayout(new GridLayout(3, 1)); JLabel label = new JLabel("Label"); contentPane.add(label); JTextArea textArea = new JTextArea("Text Area"); textArea.setColumns(20); textArea.setRows(2); contentPane.add(textArea); JButton button = new JButton("Button"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { } }); 2011 9 23
  • 6. Groovy import groovy.swing.SwingBuilder new SwingBuilder().edt { frame(title:'Hello', show:true, pack:true) { gridLayout(cols:1, rows:3) label 'Label' textArea('Text Area', rows:2, columns:20) button('Button', actionPerformed:{ evt -> ... }) } } 2011 9 23
  • 7. Java button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ... } }); SwingUtilities.invokeLater(new Runnable() { public void run() { ... } }); 2011 9 23
  • 8. & export GRIFFON_HOME=/path/to/griffon export PATH=$GRIFFON_HOME/bin:$PATH 2011 9 23
  • 9. griffon [ ] griffon create-app myApp griffon run-app griffon test-app griffon package 2011 9 23
  • 10. Grails 2011 9 23
  • 11. Griffon Wrapper griffonw / griffonw.bat Griffon gradlew CI 2011 9 23
  • 12. View 2011 9 23
  • 13. View SwingBuilder 2011 9 23
  • 14. SwingBuilder groovy.swing.SwingBuilder Groovy javax.swing.JXxx -> xxx() JButton -> button() JLabel -> label() 2011 9 23
  • 15. View application(title:'Sample', pack:true, ...) { tableLayout { tr { td { label('User Name') } td { textField(columns:20) } } tr { td { label('Password') } td { passwordField(columns:20) } } tr { td(colspan:2, align:'right') { button('Submit') } } } } 2011 9 23
  • 16. View // MyMenuBar.groovy menuBar { menu('File') { menuItem('Open') menuItem('Save') } } // MyAppView.groovy application(...) { build(MyMenuBar) } 2011 9 23
  • 17. View Java // MyPanel.java class MyPanel extends JPanel { ... } // MyAppView.groovy application(...) { widget(new MyPanel()) } 2011 9 23
  • 20. View SwingPad GroovyConsole 2011 9 23
  • 21. SwingBuilder View SwingPad 2011 9 23
  • 22. generate-view-script NetBeans View Griffon NetBeans Griffon 2011 9 23
  • 23. Model 2011 9 23
  • 24. Model package sample class SampleModel { String username String password } 2011 9 23
  • 25. View Model Model View 2011 9 23
  • 26. Model package sample import groovy.beans.Bindable class SampleModel { @Bindable String username @Bindable String password } 2011 9 23
  • 27. Model package sample import groovy.beans.Bindable @Bindable class SampleModel { String username String password } 2011 9 23
  • 28. View -> Model textField(text:bind(target:model, targetProperty:‘username’)) textField(text:bind(target:model, ‘username’)) 2011 9 23
  • 29. Model -> View textField(text:bind(source:model, sourceProperty:‘username’)) textField(text:bind(source:model, ‘username’)) textField(text:bind { model.username }) 2011 9 23
  • 30. View -> View buttonGroup(id:'group1') radioButton(id:‘radio1’, ‘ ’, buttonGroup:group1) radioButton(id:‘radio2’, ‘ ’, buttonGroup:group1) textField(editable:bind(source:radio1, sourceEvent:‘itemStateChanged’, sourceValue:{radio1.selected})) 2011 9 23
  • 31. // Model class Model { Date now = new Date() } // View label(text:bind(‘now’, source:model, converter:{it.format(‘yyyy-MM-dd’)})) 2011 9 23
  • 32. // Model class Model { int num } // View textField(text:bind(‘num’, target:model, validator:{ it?.isInteger() })) 2011 9 23
  • 33. constraints? class MyModel { @Bindable String requiredText @Bindable String url @Bindable String email static constraints = { requiredText(blank:false) url(url:true) email(email:true) } } 2011 9 23
  • 34. Validation Grails constraints Model model.validate() model.errors net.sourceforge.gvalidation.swing.ErrorMessagePanel 2011 9 23
  • 35. ErrorMessagePanel // View widget(new ErrorMessagePanel(messageSource), errors: bind(source: model, 'errors')) 2011 9 23
  • 37. Controller class SampleController { def model def view void mvcGroupInit(Map args) { ... } void mvcGroupDestroy() { ... } def fooAction = { evt -> ... } def barAction = { evt -> ... } } 2011 9 23
  • 38. View button(‘Click!’, actionPerformed:controller.fooAction) 2011 9 23
  • 39. Model View Controller Model View 2011 9 23
  • 40. Controller ( < 0.9.2 ) 0.9.2 UI 2011 9 23
  • 41. @Threading griffon.transform.Threading 2011 9 23
  • 42. class MyController { @Threading(Threading.Policy.INSIDE_UITHREAD_SYNC) def myAction = { } } 2011 9 23
  • 43. Threading.Policy OUTSIDE_UITHREAD ( ) INSIDE_UITHREAD_SYNC UI INSIDE_UITHREAD_ASYNC UI SKIP 2011 9 23
  • 44. class MyController { def myAction = { // execSync { // UI execOutside { // } } } } 2011 9 23
  • 45. exec execSync UI execAsync UI execOutside 2011 9 23
  • 46. Java/Groovy/Griffon Java Groovy Griffon new Thread() doOutside execOutside invokeLater doLater execAsync invokeAndWait edt execSync 2011 9 23
  • 47. MVC Model View Controller MVC griffon create-mvc myNewGroup 2011 9 23
  • 48. create-mvc -skip(View|Model|Controller) View/Model/Controller MVC -fileType=(groovy|java|etc) Java 2011 9 23
  • 49. createMvcGroup MVC createMvcGroup(groupType, groupName, args) 2011 9 23
  • 50. MVC SplitPane MVC TabbedPane MVC View MVC 2011 9 23
  • 51. Group1 // View button('Add tab', actionPerformed:controller.addTab) tabbedPane id: 'tabGroup' // Controller def addTab = { def name = new Date().format('yyyy-MM-dd HH:mm:ss') createMVCGroup("tab", name [tabGroup: view.tabGroup, tabName: name]) } 2011 9 23
  • 52. Group2 // View tabbedPane(tabGroup, selectedIndex:tabGroup.tabCount) { panel(title: tabName) { label(tabName) } } 2011 9 23
  • 54. Spock + FEST class CalcSpec extends FestSpec { def 'my first FEST spec'() { when: window.textBox('arg1').enterText(arg1) window.textBox('arg2').enterText(arg2) window.button('calculate').click() then: window.label('result').requireText(result) where: arg1 | arg2 | result '1' | '1' | '2' '1' | '2' | '3' } } 2011 9 23
  • 55. WebStart/Applet/Jar/Zip griffon package [webstart|applet|jar|zip] izpack|mac|rpm|deb|jsmooth 2011 9 23
  • 56. 0.9.3 Griffon 0.9.3 2011 9 23