Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added wizard app

  • Loading branch information...
commit ab45f9a21412224db816cfd06f5d90a0655a57e0 1 parent adf6fff
@aalmiray authored
Showing with 704 additions and 0 deletions.
  1. +21 −0 misc/wizard/README.md
  2. +8 −0 misc/wizard/application.properties
  3. +36 −0 misc/wizard/griffon-app/conf/Application.groovy
  4. +185 −0 misc/wizard/griffon-app/conf/BuildConfig.groovy
  5. +14 −0 misc/wizard/griffon-app/conf/Builder.groovy
  6. +15 −0 misc/wizard/griffon-app/conf/Config.groovy
  7. +44 −0 misc/wizard/griffon-app/conf/webstart/applet.html
  8. +59 −0 misc/wizard/griffon-app/conf/webstart/applet.jnlp
  9. +54 −0 misc/wizard/griffon-app/conf/webstart/application.jnlp
  10. BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-128x128.png
  11. BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-16x16.png
  12. BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-24x24.png
  13. BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-256x256.png
  14. BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-32x32.png
  15. BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-48x48.png
  16. BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-64x64.png
  17. BIN  misc/wizard/griffon-app/conf/webstart/griffon.png
  18. +47 −0 misc/wizard/griffon-app/controllers/wizard/WizardController.groovy
  19. 0  misc/wizard/griffon-app/i18n/messages.properties
  20. +18 −0 misc/wizard/griffon-app/lifecycle/Initialize.groovy
  21. +13 −0 misc/wizard/griffon-app/lifecycle/Ready.groovy
  22. +13 −0 misc/wizard/griffon-app/lifecycle/Shutdown.groovy
  23. +13 −0 misc/wizard/griffon-app/lifecycle/Startup.groovy
  24. +13 −0 misc/wizard/griffon-app/lifecycle/Stop.groovy
  25. +7 −0 misc/wizard/griffon-app/models/wizard/Page1Model.groovy
  26. +7 −0 misc/wizard/griffon-app/models/wizard/Page2Model.groovy
  27. +7 −0 misc/wizard/griffon-app/models/wizard/Page3Model.groovy
  28. +36 −0 misc/wizard/griffon-app/models/wizard/WizardModel.groovy
  29. BIN  misc/wizard/griffon-app/resources/griffon-icon-128x128.png
  30. BIN  misc/wizard/griffon-app/resources/griffon-icon-16x16.png
  31. BIN  misc/wizard/griffon-app/resources/griffon-icon-24x24.png
  32. BIN  misc/wizard/griffon-app/resources/griffon-icon-256x256.png
  33. BIN  misc/wizard/griffon-app/resources/griffon-icon-32x32.png
  34. BIN  misc/wizard/griffon-app/resources/griffon-icon-48x48.png
  35. BIN  misc/wizard/griffon-app/resources/griffon-icon-64x64.png
  36. BIN  misc/wizard/griffon-app/resources/griffon.png
  37. +13 −0 misc/wizard/griffon-app/views/wizard/Page1View.groovy
  38. +13 −0 misc/wizard/griffon-app/views/wizard/Page2View.groovy
  39. +13 −0 misc/wizard/griffon-app/views/wizard/Page3View.groovy
  40. +35 −0 misc/wizard/griffon-app/views/wizard/WizardView.groovy
  41. +20 −0 misc/wizard/test/integration/wizard/WizardTests.groovy
View
21 misc/wizard/README.md
@@ -0,0 +1,21 @@
+Simple Wizard
+=============
+
+12345678901234567890123456789012345678901234567890123456789012345678901234567890
+This application demonstrates how a trivial wizard-like bahavior can be created.
+All pages are instantiated upon launching the wizard, in other words there is no
+lazy page instantiation nor support for adding new pages dynamically. Branching
+is not supported either. Furthermore, page models do not have any specific
+validation logic in order to keep them simple.
+
+The Back button is tied to the ESCAPE key. Any time a user presses that key the
+previous page will be displayed. Likewise, the Next button is tied to both the
+ENTER and SPACE key. Be aware that these keys are used to accept text updates
+on text components, also triggering state changes in radio and checkboxes. It's
+very likely that attempting to change a radio button's state will trigger the
+next button instead.
+
+Both controller actions (back and next) skip injection of threading code because
+they are only concerned to changing the state of the wizard (which must be done
+inside the EDT). If validation were to be added to page updates then these
+actions would require proper threading management.
View
8 misc/wizard/application.properties
@@ -0,0 +1,8 @@
+#Griffon Metadata file
+#Tue Nov 29 16:44:24 CET 2011
+app.griffon.version=0.9.4
+app.name=wizard
+app.version=0.1
+plugins.actions=0.2
+plugins.i18n=0.4.1
+plugins.miglayout=0.3
View
36 misc/wizard/griffon-app/conf/Application.groovy
@@ -0,0 +1,36 @@
+application {
+ title = 'Wizard'
+ startupGroups = ['wizard']
+
+ // Should Griffon exit when no Griffon created frames are showing?
+ autoShutdown = true
+
+ // If you want some non-standard application class, apply it here
+ //frameClass = 'javax.swing.JFrame'
+}
+mvcGroups {
+ // MVC Group for "page3"
+ 'page3' {
+ model = 'wizard.Page3Model'
+ view = 'wizard.Page3View'
+ }
+
+ // MVC Group for "page2"
+ 'page2' {
+ model = 'wizard.Page2Model'
+ view = 'wizard.Page2View'
+ }
+
+ // MVC Group for "page1"
+ 'page1' {
+ model = 'wizard.Page1Model'
+ view = 'wizard.Page1View'
+ }
+
+ // MVC Group for "wizard"
+ 'wizard' {
+ model = 'wizard.WizardModel'
+ view = 'wizard.WizardView'
+ controller = 'wizard.WizardController'
+ }
+}
View
185 misc/wizard/griffon-app/conf/BuildConfig.groovy
@@ -0,0 +1,185 @@
+// key signing information
+environments {
+ development {
+ signingkey {
+ params {
+ sigfile = 'GRIFFON'
+ keystore = "${basedir}/griffon-app/conf/keys/devKeystore"
+ alias = 'development'
+ storepass = 'BadStorePassword'
+ keypass = 'BadKeyPassword'
+ lazy = true // only sign when unsigned
+ }
+ }
+
+ }
+ test {
+ griffon {
+ jars {
+ sign = false
+ pack = false
+ }
+ }
+ }
+ production {
+ signingkey {
+ params {
+ sigfile = 'GRIFFON'
+ keystore = 'CHANGE ME'
+ alias = 'CHANGE ME'
+ // NOTE: for production keys it is more secure to rely on key prompting
+ // no value means we will prompt //storepass = 'BadStorePassword'
+ // no value means we will prompt //keypass = 'BadKeyPassword'
+ lazy = false // sign, regardless of existing signatures
+ }
+ }
+
+ griffon {
+ jars {
+ sign = true
+ pack = true
+ destDir = "${basedir}/staging"
+ }
+ webstart {
+ codebase = 'CHANGE ME'
+ }
+ }
+ }
+}
+
+griffon {
+ memory {
+ //max = '64m'
+ //min = '2m'
+ //maxPermSize = '64m'
+ }
+ jars {
+ sign = false
+ pack = false
+ destDir = "${basedir}/staging"
+ jarName = "${appName}.jar"
+ }
+ extensions {
+ jarUrls = []
+ jnlpUrls = []
+ /*
+ props {
+ someProperty = 'someValue'
+ }
+ resources {
+ linux { // windows, macosx, solaris
+ jars = []
+ nativelibs = []
+ props {
+ someProperty = 'someValue'
+ }
+ }
+ }
+ */
+ }
+ webstart {
+ codebase = "${new File(griffon.jars.destDir).toURI().toASCIIString()}"
+ jnlp = 'application.jnlp'
+ }
+ applet {
+ jnlp = 'applet.jnlp'
+ html = 'applet.html'
+ }
+}
+
+// required for custom environments
+signingkey {
+ params {
+ def env = griffon.util.Environment.current.name
+ sigfile = 'GRIFFON-' + env
+ keystore = "${basedir}/griffon-app/conf/keys/${env}Keystore"
+ alias = env
+ // storepass = 'BadStorePassword'
+ // keypass = 'BadKeyPassword'
+ lazy = true // only sign when unsigned
+ }
+}
+
+griffon.project.dependency.resolution = {
+ // inherit Griffon' default dependencies
+ inherits("global") {
+ }
+ log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
+ repositories {
+ griffonPlugins()
+ griffonHome()
+ griffonCentral()
+
+ // uncomment the below to enable remote dependency resolution
+ // from public Maven repositories
+ //mavenLocal()
+ //mavenCentral()
+ //mavenRepo "http://snapshots.repository.codehaus.org"
+ //mavenRepo "http://repository.codehaus.org"
+ //mavenRepo "http://download.java.net/maven/2/"
+ //mavenRepo "http://repository.jboss.com/maven2/"
+ }
+ dependencies {
+ // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
+
+ // runtime 'mysql:mysql-connector-java:5.1.5'
+ }
+}
+
+log4j = {
+ // Example of changing the log pattern for the default console
+ // appender:
+ appenders {
+ console name: 'stdout', layout: pattern(conversionPattern: '%d [%t] %-5p %c - %m%n')
+ }
+
+ error 'org.codehaus.griffon'
+}
+
+griffon {
+ doc {
+ logo = '<a href="http://griffon.codehaus.org" target="_blank"><img alt="The Griffon Framework" src="../img/griffon.png" border="0"/></a>'
+ sponsorLogo = "<br/>"
+ footer = "<br/><br/>Made with Griffon (0.9.4)"
+ }
+}
+
+deploy {
+ application {
+ title = 'Wizard 0.1'
+ vendor = System.properties['user.name']
+ homepage = 'http://localhost/Wizard'
+ description {
+ complete = 'Wizard 0.1'
+ oneline = 'Wizard 0.1'
+ minimal = 'Wizard 0.1'
+ tooltip = 'Wizard 0.1'
+ }
+ icon {
+ fallback {
+ name = 'griffon-icon-48x48.png'
+ width = '48'
+ height = '48'
+ }
+ splash {
+ name = 'griffon.png'
+ width = '391'
+ height = '123'
+ }
+ menu {
+ name = 'griffon-icon-16x16.png'
+ width = '48'
+ height = '48'
+ }
+ desktop {
+ name = 'griffon-icon-32x32.png'
+ width = '32'
+ height = '32'
+ }
+ }
+ }
+}
+
+app.archetype = 'default'
+app.fileType = '.groovy'
+app.defaultPackageName = 'wizard'
View
14 misc/wizard/griffon-app/conf/Builder.groovy
@@ -0,0 +1,14 @@
+root {
+ 'groovy.swing.SwingBuilder' {
+ controller = ['Threading']
+ view = '*'
+ }
+ 'griffon.app.ApplicationBuilder' {
+ view = '*'
+ }
+}
+root.'MiglayoutGriffonAddon'.addon=true
+
+root.'I18nGriffonAddon'.addon=true
+
+root.'ActionsGriffonAddon'.addon=true
View
15 misc/wizard/griffon-app/conf/Config.groovy
@@ -0,0 +1,15 @@
+log4j = {
+ // Example of changing the log pattern for the default console
+ // appender:
+ appenders {
+ console name: 'stdout', layout: pattern(conversionPattern: '%d [%t] %-5p %c - %m%n')
+ }
+
+ error 'org.codehaus.griffon'
+
+ info 'griffon.util',
+ 'griffon.core',
+ 'griffon.swing',
+ 'griffon.app'
+}
+
View
44 misc/wizard/griffon-app/conf/webstart/applet.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <title></title>
+</head>
+<body>
+
+<script src="http://java.com/js/deployJava.js"></script>
+<script>
+ var attributes = {id: 'Wizard',
+ codebase:'@griffonAppCodebase@',
+ code:'@griffonAppletClass@',
+ archive:'@appletJars@',
+ width:'@applet.width@', height:'@applet.height@'} ;
+ var parameters = {fontSize:16,
+ java_arguments: "-Djnlp.packEnabled=true",
+ jnlp_href:'@griffonAppCodebase@/applet.jnlp',
+ draggable:'true',
+ image:'griffon.png',
+ boxmessage:'Loading Wizard',
+ boxbgcolor:'#FFFFFF', boxfgcolor:'#000000',
+ codebase_lookup: 'false'@applet.script.params@} ;
+ var version = '1.5.0' ;
+ deployJava.runApplet(attributes, parameters, version);
+</script>
+<!--
+<APPLET CODEBASE='@griffonAppCodebase@'
+ CODE='@griffonAppletClass@'
+ ARCHIVE='@appletJars@'
+ WIDTH='@applet.width@' HEIGHT='@applet.height@'>
+ <PARAM NAME="java_arguments" VALUE="-Djnlp.packEnabled=true">
+ <PARAM NAME='jnlp_href' VALUE='@griffonAppCodebase@/applet.jnlp'>
+ <PARAM NAME='dragggable' VALUE='true'>
+ <PARAM NAME='image' VALUE='griffon.png'>
+ <PARAM NAME='boxmessage' VALUE='Loading Wizard'>
+ <PARAM NAME='boxbgcolor' VALUE='#FFFFFF'>
+ <PARAM NAME='boxfgcolor' VALUE='#000000'>
+ <PARAM NAME='codebase_lookup' VALUE='false'>
+@applet.tag.params@
+</APPLET>
+-->
+</body>
+</html>
View
59 misc/wizard/griffon-app/conf/webstart/applet.jnlp
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE jnlp SYSTEM "http://java.sun.com/dtd/JNLP-1.5.dtd">
+<jnlp
+ version="0.1"
+ codebase="@griffonAppCodebase@"
+ href="@jnlpFileName@"
+>
+ <information>
+ <title>@griffon.application.title@</title>
+ <vendor>@griffon.application.vendor@</vendor>
+ <homepage href="@griffon.application.homepage@"/>
+ <!--fallback description-->
+ <description>@griffon.application.description.complete@</description>
+ <description kind="one-line">@griffon.application.description.oneline@</description>
+ <description kind="short">@griffon.application.description.minimal@</description>
+ <description kind="tooltip">@griffon.application.description.tooltip@</description>
+ <!-- fallback icon -->
+ <icon href="@griffon.application.icon.fallback@" kind="default" width="@griffon.application.icon.fallback.width@" height="@griffon.application.icon.fallback.height@"/>
+ <!-- icon used for splash screen -->
+ <icon href="@griffon.application.icon.splash@" kind="default" width="@griffon.application.icon.splash.width@" height="@griffon.application.icon.splash.height@"/>
+ <!-- icon used in menu -->
+ <icon href="@griffon.application.icon.menu@" kind="default" width="@griffon.application.icon.menu.width@" height="@griffon.application.icon.menu.height@"/>
+ <!-- icon used on desktop -->
+ <icon href="@griffon.application.icon.desktop@" kind="default" width="@griffon.application.icon.desktop.width@" height="@griffon.application.icon.desktop.height@"/>
+<!-- to create shortcuts, uncomment this
+ <shortcut online="true">
+ <desktop/>
+ <menu submenu="Wizard"/>
+ </shortcut>
+-->
+ <offline-allowed/>
+ </information>
+ <security>
+ <all-permissions/>
+ <!--<j2ee-application-client-permissions/>-->
+ </security>
+ <resources>
+ <property name="griffon.runmode" value="applet"/>
+ <property name="jnlp.packEnabled" value="true"/>
+ <j2se version="1.5+" @memoryOptions@/>
+ <!-- auto-added jars follow, griffon-rt, app, and groovy -->
+@jnlpJars@
+ <!-- Add all extra jars below here, or the app may break -->
+@jnlpExtensions@
+@jnlpProperties@
+ </resources>
+@jnlpResources@
+ <applet-desc
+ documentbase="@griffonAppCodebase@"
+ name="WizardApplet"
+ main-class="@griffonAppletClass@"
+ width="@applet.width@"
+ height="@applet.height@">
+ <!-- params are ignored when referenced from web page for 6u10 -->
+ <!--<param name="key1" value="value1"/>-->
+ <!--<param name="key2" value="value2"/>-->
+@applet.tag.params@
+ </applet-desc>
+</jnlp>
View
54 misc/wizard/griffon-app/conf/webstart/application.jnlp
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE jnlp SYSTEM "http://java.sun.com/dtd/JNLP-1.5.dtd">
+<jnlp
+ version="0.1"
+ codebase="@griffonAppCodebase@"
+ href="@jnlpFileName@"
+>
+ <information>
+ <title>@griffon.application.title@</title>
+ <vendor>@griffon.application.vendor@</vendor>
+ <homepage href="@griffon.application.homepage@"/>
+ <!--fallback description-->
+ <description>@griffon.application.description.complete@</description>
+ <description kind="one-line">@griffon.application.description.oneline@</description>
+ <description kind="short">@griffon.application.description.minimal@</description>
+ <description kind="tooltip">@griffon.application.description.tooltip@</description>
+ <!-- fallback icon -->
+ <icon href="@griffon.application.icon.fallback@" kind="default" width="@griffon.application.icon.fallback.width@" height="@griffon.application.icon.fallback.height@"/>
+ <!-- icon used for splash screen -->
+ <icon href="@griffon.application.icon.splash@" kind="default" width="@griffon.application.icon.splash.width@" height="@griffon.application.icon.splash.height@"/>
+ <!-- icon used in menu -->
+ <icon href="@griffon.application.icon.menu@" kind="default" width="@griffon.application.icon.menu.width@" height="@griffon.application.icon.menu.height@"/>
+ <!-- icon used on desktop -->
+ <icon href="@griffon.application.icon.desktop@" kind="default" width="@griffon.application.icon.desktop.width@" height="@griffon.application.icon.desktop.height@"/>
+<!-- to create shortcuts, uncomment this
+ <shortcut online="true">
+ <desktop/>
+ <menu submenu="Wizard"/>
+ </shortcut>
+ <offline-allowed/>
+-->
+ </information>
+ <security>
+ <all-permissions/>
+ <!--<j2ee-application-client-permissions/>-->
+ </security>
+ <resources>
+ <property name="griffon.runmode" value="webstart"/>
+ <property name="jnlp.packEnabled" value="true"/>
+ <j2se version="1.5+" @memoryOptions@/>
+ <!-- auto-added jars follow, griffon-rt, app, and groovy -->
+@jnlpJars@
+ <!-- Add all extra jars below here, or the app may break -->
+@jnlpExtensions@
+@jnlpProperties@
+ </resources>
+@jnlpResources@
+ <application-desc main-class="@griffonApplicationClass@">
+ <!-- params are ignored when referenced from web page for 6u10 -->
+ <!--<param name="key1" value="value1"/>-->
+ <!--<param name="key2" value="value2"/>-->
+@applet.tag.params@
+ </application-desc>
+</jnlp>
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-128x128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-16x16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-24x24.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-256x256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-32x32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-48x48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon-icon-64x64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/conf/webstart/griffon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
47 misc/wizard/griffon-app/controllers/wizard/WizardController.groovy
@@ -0,0 +1,47 @@
+package wizard
+
+import griffon.transform.Threading
+import static griffon.util.GriffonNameUtils.getNaturalName
+
+class WizardController {
+ def model
+ def view
+
+ void mvcGroupInit(Map args) {
+ (1..3).each { index ->
+ def (m, v, c) = createMVCGroup('page'+index)
+ view.wizardContainer.add('page'+index, v.page)
+ }
+ model.totalPages = 3
+ execAsync {
+ view.wizardContainer.layout.first(view.wizardContainer)
+ }
+ }
+
+ @Threading(Threading.Policy.SKIP)
+ void backAction(evt = null) {
+ if(model.decrease()) {
+ view.wizardContainer.layout.previous(view.wizardContainer)
+ }
+ }
+
+ @Threading(Threading.Policy.SKIP)
+ void nextAction(evt = null) {
+ if(model.increase()) {
+ view.wizardContainer.layout.next(view.wizardContainer)
+ } else {
+ List values = []
+ (1..3).each { index ->
+ def m = app.models."page${index}"
+ m.griffonClass.propertyNames.collect(values) { name ->
+ "${getNaturalName(name)} = ${m[name]}"
+ }
+ }
+
+ javax.swing.JOptionPane.showMessageDialog(
+ app.windowManager.windows.find{it.focused},
+ values.join('\n')
+ )
+ }
+ }
+}
View
0  misc/wizard/griffon-app/i18n/messages.properties
No changes.
View
18 misc/wizard/griffon-app/lifecycle/Initialize.groovy
@@ -0,0 +1,18 @@
+/*
+ * This script is executed inside the UI thread, so be sure to call
+ * long running code in another thread.
+ *
+ * You have the following options
+ * - execOutside { // your code }
+ * - execFuture { // your code }
+ * - Thread.start { // your code }
+ *
+ * You have the following options to run code again inside the UI thread
+ * - execAsync { // your code }
+ * - execSync { // your code }
+ */
+
+import groovy.swing.SwingBuilder
+import static griffon.util.GriffonApplicationUtils.isMacOSX
+
+SwingBuilder.lookAndFeel((isMacOSX ? 'system' : 'nimbus'), 'gtk', ['metal', [boldFonts: false]])
View
13 misc/wizard/griffon-app/lifecycle/Ready.groovy
@@ -0,0 +1,13 @@
+/*
+ * This script is executed inside the UI thread, so be sure to call
+ * long running code in another thread.
+ *
+ * You have the following options
+ * - execOutside { // your code }
+ * - execFuture { // your code }
+ * - Thread.start { // your code }
+ *
+ * You have the following options to run code again inside the UI thread
+ * - execAsync { // your code }
+ * - execSync { // your code }
+ */
View
13 misc/wizard/griffon-app/lifecycle/Shutdown.groovy
@@ -0,0 +1,13 @@
+/*
+ * This script is executed inside the UI thread, so be sure to call
+ * long running code in another thread.
+ *
+ * You have the following options
+ * - execOutside { // your code }
+ * - execFuture { // your code }
+ * - Thread.start { // your code }
+ *
+ * You have the following options to run code again inside the UI thread
+ * - execAsync { // your code }
+ * - execSync { // your code }
+ */
View
13 misc/wizard/griffon-app/lifecycle/Startup.groovy
@@ -0,0 +1,13 @@
+/*
+ * This script is executed inside the UI thread, so be sure to call
+ * long running code in another thread.
+ *
+ * You have the following options
+ * - execOutside { // your code }
+ * - execFuture { // your code }
+ * - Thread.start { // your code }
+ *
+ * You have the following options to run code again inside the UI thread
+ * - execAsync { // your code }
+ * - execSync { // your code }
+ */
View
13 misc/wizard/griffon-app/lifecycle/Stop.groovy
@@ -0,0 +1,13 @@
+/*
+ * This script is executed inside the UI thread, so be sure to call
+ * long running code in another thread.
+ *
+ * You have the following options
+ * - execOutside { // your code }
+ * - execFuture { // your code }
+ * - Thread.start { // your code }
+ *
+ * You have the following options to run code again inside the UI thread
+ * - execAsync { // your code }
+ * - execSync { // your code }
+ */
View
7 misc/wizard/griffon-app/models/wizard/Page1Model.groovy
@@ -0,0 +1,7 @@
+package wizard
+
+import groovy.beans.Bindable
+
+class Page1Model {
+ @Bindable String value1
+}
View
7 misc/wizard/griffon-app/models/wizard/Page2Model.groovy
@@ -0,0 +1,7 @@
+package wizard
+
+import groovy.beans.Bindable
+
+class Page2Model {
+ @Bindable String value2
+}
View
7 misc/wizard/griffon-app/models/wizard/Page3Model.groovy
@@ -0,0 +1,7 @@
+package wizard
+
+import groovy.beans.Bindable
+
+class Page3Model {
+ @Bindable String value3
+}
View
36 misc/wizard/griffon-app/models/wizard/WizardModel.groovy
@@ -0,0 +1,36 @@
+package wizard
+
+import groovy.beans.Bindable
+import groovy.transform.Synchronized
+
+class WizardModel {
+ @Bindable boolean backEnabled
+
+ private int currentPage = 0i
+ private int totalPages = 0i
+
+ @Synchronized
+ void setTotalPages(int n) { totalPages = n }
+ @Synchronized
+ int getTotalPages() { totalPages }
+
+ @Synchronized
+ boolean decrease() {
+ int nextPage = currentPage - 1
+ if(nextPage >= 0) {
+ currentPage = nextPage
+ }
+ setBackEnabled(currentPage != 0)
+ nextPage == currentPage
+ }
+
+ @Synchronized
+ boolean increase() {
+ int nextPage = currentPage + 1
+ if(nextPage < totalPages) {
+ currentPage = nextPage
+ }
+ setBackEnabled(currentPage != 0)
+ nextPage == currentPage
+ }
+}
View
BIN  misc/wizard/griffon-app/resources/griffon-icon-128x128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/resources/griffon-icon-16x16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/resources/griffon-icon-24x24.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/resources/griffon-icon-256x256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/resources/griffon-icon-32x32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/resources/griffon-icon-48x48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/resources/griffon-icon-64x64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  misc/wizard/griffon-app/resources/griffon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
13 misc/wizard/griffon-app/views/wizard/Page1View.groovy
@@ -0,0 +1,13 @@
+package wizard
+
+import static griffon.util.GriffonNameUtils.getNaturalName
+
+panel(id: 'page',
+ border: titledBorder(title: 'Page 1')) {
+ migLayout()
+ model.griffonClass.propertyNames.each { name ->
+ label(getNaturalName(name), constraints: 'left')
+ textField(columns: 20, constraints: 'growx, wrap',
+ text: bind(name, target: model, mutual: true))
+ }
+}
View
13 misc/wizard/griffon-app/views/wizard/Page2View.groovy
@@ -0,0 +1,13 @@
+package wizard
+
+import static griffon.util.GriffonNameUtils.getNaturalName
+
+panel(id: 'page',
+ border: titledBorder(title: 'Page 2')) {
+ migLayout()
+ model.griffonClass.propertyNames.each { name ->
+ label(getNaturalName(name), constraints: 'left')
+ textField(columns: 20, constraints: 'growx, wrap',
+ text: bind(name, target: model, mutual: true))
+ }
+}
View
13 misc/wizard/griffon-app/views/wizard/Page3View.groovy
@@ -0,0 +1,13 @@
+package wizard
+
+import static griffon.util.GriffonNameUtils.getNaturalName
+
+panel(id: 'page',
+ border: titledBorder(title: 'Page 3')) {
+ migLayout()
+ model.griffonClass.propertyNames.each { name ->
+ label(getNaturalName(name), constraints: 'left')
+ textField(columns: 20, constraints: 'growx, wrap',
+ text: bind(name, target: model, mutual: true))
+ }
+}
View
35 misc/wizard/griffon-app/views/wizard/WizardView.groovy
@@ -0,0 +1,35 @@
+package wizard
+
+actions {
+ action(backAction,
+ enabled: bind { model.backEnabled })
+}
+
+application(title: 'Wizard',
+ preferredSize: [320, 240],
+ pack: true,
+ 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]) {
+ migLayout(layoutConstraints: 'fill')
+ panel(id: 'wizardContainer', constraints: 'grow, span 2, wrap') {
+ cardLayout()
+ }
+ button(backAction, constraints: 'left')
+ button(nextAction, constraints: 'right')
+
+ keyStrokeAction(component: current.rootPane,
+ keyStroke: 'ESCAPE',
+ condition: 'in focused window',
+ action: backAction)
+ keyStrokeAction(component: current.rootPane,
+ keyStroke: 'ENTER',
+ condition: 'in focused window',
+ action: nextAction)
+ keyStrokeAction(component: current.rootPane,
+ keyStroke: 'SPACE',
+ condition: 'in focused window',
+ action: nextAction)
+}
View
20 misc/wizard/test/integration/wizard/WizardTests.groovy
@@ -0,0 +1,20 @@
+package wizard
+
+import griffon.core.GriffonApplication
+import griffon.test.*
+
+class WizardTests extends GriffonUnitTestCase {
+ GriffonApplication app
+
+ protected void setUp() {
+ super.setUp()
+ }
+
+ protected void tearDown() {
+ super.tearDown()
+ }
+
+ void testSomething() {
+
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.