Last active
August 29, 2015 14:03
-
-
Save aalmiray/007c32f01e3b17230278 to your computer and use it in GitHub Desktop.
sample-javafx-groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import griffon.core.GriffonApplication | |
import griffon.core.event.EventHandler | |
import javax.annotation.Nonnull | |
class ApplicationEventHandler implements EventHandler { | |
void onBootstrapStart(@Nonnull GriffonApplication application) { | |
if (application.startupArgs.length > 0) { | |
application.localeAsString = application.startupArgs[0] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import griffon.core.event.EventHandler | |
import griffon.core.injection.Module | |
import org.codehaus.griffon.runtime.core.injection.AbstractModule | |
import org.kordamp.jipsy.ServiceProviderFor | |
@ServiceProviderFor(Module) | |
class ApplicationModule extends AbstractModule { | |
@Override | |
protected void doConfigure() { | |
bind(EventHandler) | |
.to(ApplicationEventHandler) | |
.asSingleton() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'org.codehaus.griffon:gradle-griffon-plugin:1.0.0.BETA2' | |
classpath 'net.saliman:gradle-cobertura-plugin:2.2.4' | |
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:0.4.1' | |
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.9.0' | |
} | |
} | |
apply plugin: 'groovy' | |
apply plugin: 'org.codehaus.griffon.griffon' | |
griffon { | |
disableDependencyResolution = false | |
includeGroovyDependencies = true | |
version = '2.0.0.BETA3' | |
toolkit = 'javafx' | |
} | |
apply from: 'gradle/publishing.gradle' | |
apply from: 'gradle/code-coverage.gradle' | |
apply from: 'gradle/code-quality.gradle' | |
apply from: 'gradle/javafx-plugin.gradle' | |
mainClassName = 'org.example.Launcher' | |
javafx { | |
mainClass = mainClassName | |
} | |
dependencies { | |
compile "org.codehaus.griffon:griffon-guice:${griffon.version}" | |
runtime('log4j:log4j:1.2.17') { | |
exclude group: 'ant', module: 'ant-nodeps' | |
exclude group: 'ant', module: 'ant-junit' | |
exclude group: 'ant-contrib', module: 'ant-contrib' | |
} | |
runtime 'org.slf4j:slf4j-log4j12:1.7.7' | |
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0' | |
} | |
run { | |
if (project.hasProperty('locale')) { | |
args = [project.locale] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compile - Compile classpath for source set 'main'. | |
+--- org.codehaus.griffon:griffon-guice:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 | |
| | +--- javax.inject:javax.inject:1 | |
| | +--- com.google.code.findbugs:jsr305:2.0.2 | |
| | \--- org.slf4j:slf4j-api:1.7.7 | |
| \--- com.google.inject:guice:3.0 | |
| +--- javax.inject:javax.inject:1 | |
| +--- aopalliance:aopalliance:1.0 | |
| \--- org.sonatype.sisu.inject:cglib:2.2.1-v20090111 | |
| \--- asm:asm:3.1 | |
+--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-javafx:2.0.0.BETA3 | |
| \--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-javafx-groovy:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 | |
| | +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
| | \--- org.codehaus.groovy:groovy-all:2.3.3 | |
| +--- org.codehaus.griffon:griffon-javafx:2.0.0.BETA3 (*) | |
| \--- org.codehaus.groovyfx:groovyfx:0.4.0 | |
| +--- org.codehaus.groovy:groovy-all:2.3.0 -> 2.3.3 | |
| \--- org.ow2.asm:asm:5.0.2 | |
\--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 (*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compileOnly | |
+--- org.codehaus.griffon:griffon-core-compile:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 | |
| | +--- javax.inject:javax.inject:1 | |
| | +--- com.google.code.findbugs:jsr305:2.0.2 | |
| | \--- org.slf4j:slf4j-api:1.7.7 | |
| \--- org.kordamp.jipsy:jipsy:0.4.0 | |
\--- org.codehaus.griffon:griffon-groovy-compile:2.0.0.BETA3 | |
+--- org.codehaus.griffon:griffon-core-compile:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
| \--- org.codehaus.groovy:groovy-all:2.3.3 | |
+--- org.kordamp.gipsy:gipsy:0.4.0 | |
| +--- org.kordamp.jipsy:jipsy:0.4.0 | |
| \--- org.codehaus.groovy:groovy-all:2.2.2 -> 2.3.3 | |
\--- org.codehaus.groovy:groovy-all:2.3.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application { | |
title = 'sample-javafx-groovy' | |
startupGroups = ['sample'] | |
autoShutdown = true | |
} | |
mvcGroups { | |
// MVC Group for "sample" | |
'sample' { | |
model = 'org.example.SampleModel' | |
view = 'org.example.SampleView' | |
controller = 'org.example.SampleController' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── README.md | |
├── build.gradle | |
├── griffon-app | |
│ ├── conf | |
│ │ └── Config.groovy | |
│ ├── controllers | |
│ │ └── org | |
│ │ └── example | |
│ │ └── SampleController.groovy | |
│ ├── i18n | |
│ │ ├── messages.properties | |
│ │ └── messages_es.properties | |
│ ├── models | |
│ │ └── org | |
│ │ └── example | |
│ │ └── SampleModel.groovy | |
│ ├── services | |
│ │ └── org | |
│ │ └── example | |
│ │ └── SampleService.groovy | |
│ └── views | |
│ └── org | |
│ └── example | |
│ └── SampleView.groovy | |
└── src | |
├── main | |
│ └── groovy | |
│ └── org | |
│ └── example | |
│ ├── ApplicationEventHandler.groovy | |
│ ├── ApplicationModule.groovy | |
│ └── Launcher.groovy | |
└── test | |
└── groovy | |
└── org | |
└── example | |
└── SampleControllerTest.groovy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import griffon.javafx.JavaFXGriffonApplication | |
class Launcher { | |
static void main(String[] args) throws Exception { | |
JavaFXGriffonApplication.main(args) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lazybones create griffon-javafx-groovy sample-javafx-groovy | |
Creating project from template griffon-javafx-groovy (latest) in 'sample-javafx-groovy' | |
Define value for 'group' [org.example]: | |
Define value for 'artifactId' [sample-javafx-groovy]: | |
Define value for 'version' [0.1.0-SNAPSHOT]: | |
Define value for 'griffonVersion' [2.0.0.BETA3]: | |
Define value for 'package' [org.example]: | |
Define value for 'className' [SampleJavafxGroovy]: sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application.title = Hello World JavaFX | |
greeting.label = Please enter your name: | |
greeting.default = Howdy stranger! | |
greeting.parameterized = Hello {0} | |
# | |
org.example.SampleController.action.SayHello.name = Say Hello! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application.title = Hola Mundo JavaFX | |
greeting.label = Escribe tu nombre: | |
greeting.default = Hola desconocido! | |
greeting.parameterized = Hola {0} | |
# | |
org.example.SampleController.action.SayHello.name = Saluda! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
runtime - Runtime classpath for source set 'main'. | |
+--- org.codehaus.griffon:griffon-guice:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 | |
| | +--- javax.inject:javax.inject:1 | |
| | +--- com.google.code.findbugs:jsr305:2.0.2 | |
| | \--- org.slf4j:slf4j-api:1.7.7 | |
| \--- com.google.inject:guice:3.0 | |
| +--- javax.inject:javax.inject:1 | |
| +--- aopalliance:aopalliance:1.0 | |
| \--- org.sonatype.sisu.inject:cglib:2.2.1-v20090111 | |
| \--- asm:asm:3.1 | |
+--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-javafx:2.0.0.BETA3 | |
| \--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-javafx-groovy:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 | |
| | +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
| | \--- org.codehaus.groovy:groovy-all:2.3.3 | |
| +--- org.codehaus.griffon:griffon-javafx:2.0.0.BETA3 (*) | |
| \--- org.codehaus.groovyfx:groovyfx:0.4.0 | |
| +--- org.codehaus.groovy:groovy-all:2.3.0 -> 2.3.3 | |
| \--- org.ow2.asm:asm:5.0.2 | |
+--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 (*) | |
+--- log4j:log4j:1.2.17 | |
\--- org.slf4j:slf4j-log4j12:1.7.7 | |
+--- org.slf4j:slf4j-api:1.7.7 | |
\--- log4j:log4j:1.2.17 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import griffon.core.artifact.GriffonController | |
import griffon.metadata.ArtifactProviderFor | |
import javax.inject.Inject | |
@ArtifactProviderFor(GriffonController) | |
class SampleController { | |
SampleModel model | |
@Inject | |
private SampleService sampleService | |
void sayHello() { | |
String result = sampleService.sayHello(model.input) | |
runInsideUIAsync { model.output = result } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class org.example.SampleModel extends org.codehaus.griffon.runtime.core.artifact.AbstractGriffonModel implements groovy.lang.GroovyObject { | |
private javafx.beans.property.StringProperty inputProp; | |
private javafx.beans.property.StringProperty outputProp; | |
public org.example.SampleModel(griffon.core.GriffonApplication); | |
public final java.lang.String getInput(); | |
public final void setInput(java.lang.String); | |
public javafx.beans.property.StringProperty getInputProperty(); | |
public javafx.beans.property.StringProperty inputProperty(); | |
public javafx.beans.property.StringProperty input(); | |
public final java.lang.String getOutput(); | |
public final void setOutput(java.lang.String); | |
public javafx.beans.property.StringProperty getOutputProperty(); | |
public javafx.beans.property.StringProperty outputProperty(); | |
public javafx.beans.property.StringProperty output(); | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import griffon.core.artifact.GriffonModel | |
import griffon.transform.FXObservable | |
import griffon.metadata.ArtifactProviderFor | |
@ArtifactProviderFor(GriffonModel) | |
class SampleModel { | |
@FXObservable String input = '' | |
@FXObservable String output = '' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import griffon.core.artifact.GriffonService | |
import griffon.core.i18n.MessageSource | |
import griffon.metadata.ArtifactProviderFor | |
import javax.annotation.Nonnull | |
import javax.annotation.Nullable | |
import static griffon.util.GriffonNameUtils.isBlank | |
@ArtifactProviderFor(GriffonService) | |
class SampleService { | |
@Nonnull | |
String sayHello(@Nullable String input) { | |
MessageSource ms = application.messageSource | |
isBlank(input) ? ms.getMessage('greeting.default') : ms. getMessage('greeting.parameterized', [input]) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example | |
import griffon.core.artifact.GriffonView | |
import griffon.core.i18n.MessageSource | |
import griffon.metadata.ArtifactProviderFor | |
@ArtifactProviderFor(GriffonView) | |
class SampleView { | |
FactoryBuilderSupport builder | |
SampleModel model | |
void initUI() { | |
MessageSource ms = application.messageSource | |
builder.application(title: ms.getMessage('application.title'), | |
sizeToScene: true, centerOnScreen: true, name: 'mainWindow') { | |
scene(fill: WHITE, width: 400, height: 120) { | |
anchorPane(prefHeight: 80.0, prefWidth: 384.0) { | |
label(layoutX: 14.0, layoutY: 14.0, text: ms.getMessage('greeting.label')) | |
textField(layoutX: 172.0, layoutY: 11.0, prefWidth: 200.0, | |
text: bind(model.inputProperty())) | |
button(layoutX: 172.0, layoutY: 45.0, prefWidth: 200.0, | |
sayHelloAction) | |
label(layoutX: 14.0, layoutY: 80.0, prefWidth: 360.0, | |
text: bind(model.outputProperty())) | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+----------------------+-------+-------+ | |
| Name | Files | LOC | | |
+----------------------+-------+-------+ | |
| Groovy Sources | 3 | 32 | | |
| Groovy Test Sources | 1 | 16 | | |
| Models | 1 | 9 | | |
| Views | 1 | 26 | | |
| Controllers | 1 | 14 | | |
| Services | 1 | 15 | | |
| Configuration | 1 | 12 | | |
| Lifecycle | 1 | 13 | | |
+----------------------+-------+-------+ | |
| Totals | 10 | 137 | | |
+----------------------+-------+-------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testCompile - Compile classpath for source set 'test'. | |
+--- org.codehaus.griffon:griffon-guice:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 | |
| | +--- javax.inject:javax.inject:1 | |
| | +--- com.google.code.findbugs:jsr305:2.0.2 | |
| | \--- org.slf4j:slf4j-api:1.7.7 | |
| \--- com.google.inject:guice:3.0 | |
| +--- javax.inject:javax.inject:1 | |
| +--- aopalliance:aopalliance:1.0 | |
| \--- org.sonatype.sisu.inject:cglib:2.2.1-v20090111 | |
| \--- asm:asm:3.1 | |
+--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-javafx:2.0.0.BETA3 | |
| \--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-javafx-groovy:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 | |
| | +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
| | \--- org.codehaus.groovy:groovy-all:2.3.3 | |
| +--- org.codehaus.griffon:griffon-javafx:2.0.0.BETA3 (*) | |
| \--- org.codehaus.groovyfx:groovyfx:0.4.0 | |
| +--- org.codehaus.groovy:groovy-all:2.3.0 -> 2.3.3 | |
| \--- org.ow2.asm:asm:5.0.2 | |
+--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 (*) | |
+--- org.spockframework:spock-core:0.7-groovy-2.0 | |
| +--- junit:junit-dep:4.10 | |
| | \--- org.hamcrest:hamcrest-core:1.1 -> 1.3 | |
| +--- org.codehaus.groovy:groovy-all:2.0.5 -> 2.3.3 | |
| \--- org.hamcrest:hamcrest-core:1.3 | |
\--- org.codehaus.griffon:griffon-core-test:2.0.0.BETA3 | |
+--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
+--- junit:junit:4.11 | |
| \--- org.hamcrest:hamcrest-core:1.3 | |
\--- com.jayway.awaitility:awaitility:1.4.0 | |
+--- org.hamcrest:hamcrest-library:1.3 | |
| \--- org.hamcrest:hamcrest-core:1.3 | |
+--- org.hamcrest:hamcrest-core:1.3 | |
+--- cglib:cglib-nodep:2.2 | |
\--- org.objenesis:objenesis:1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testCompileOnly | |
+--- org.codehaus.griffon:griffon-core-compile:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 | |
| | +--- javax.inject:javax.inject:1 | |
| | +--- com.google.code.findbugs:jsr305:2.0.2 | |
| | \--- org.slf4j:slf4j-api:1.7.7 | |
| \--- org.kordamp.jipsy:jipsy:0.4.0 | |
\--- org.codehaus.griffon:griffon-groovy-compile:2.0.0.BETA3 | |
+--- org.codehaus.griffon:griffon-core-compile:2.0.0.BETA3 (*) | |
+--- org.codehaus.griffon:griffon-groovy:2.0.0.BETA3 | |
| +--- org.codehaus.griffon:griffon-core:2.0.0.BETA3 (*) | |
| \--- org.codehaus.groovy:groovy-all:2.3.3 | |
+--- org.kordamp.gipsy:gipsy:0.4.0 | |
| +--- org.kordamp.jipsy:jipsy:0.4.0 | |
| \--- org.codehaus.groovy:groovy-all:2.2.2 -> 2.3.3 | |
\--- org.codehaus.groovy:groovy-all:2.3.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment