timestamper/griffon-app/lifecycle/Initialize.groovy

40 lines
1.2 KiB
Groovy
Raw Normal View History

2009-12-17 23:12:09 -06:00
/*
* This script is executed inside the EDT, so be sure to
* call long running code in another thread.
*
* You have the following options
* - SwingBuilder.doOutside { // your code }
* - Thread.start { // your code }
* - SwingXBuilder.withWorker( start: true ) {
* onInit { // initialization (optional, runs in current thread) }
* work { // your code }
* onDone { // finish (runs inside EDT) }
* }
*
* You have the following options to run code again inside EDT
* - SwingBuilder.doLater { // your code }
* - SwingBuilder.edt { // your code }
* - SwingUtilities.invokeLater { // your code }
*/
import groovy.swing.SwingBuilder
import griffon.util.GriffonPlatformHelper
import org.apache.log4j.Logger
2009-12-17 23:12:09 -06:00
GriffonPlatformHelper.tweakForNativePlatform(app)
SwingBuilder.lookAndFeel('system', 'nimbus', ['metal', [boldFonts: false]])
Logger.metaClass.traceIfEnabled = { String message, Throwable t = null ->
if (delegate.isTraceEnabled()) {
if (t != null) delegate.trace(message, t)
else delegate.trace(message)
}
}
Logger.metaClass.debugIfEnabled = { String message, Throwable t = null ->
if (delegate.isDebugEnabled()) {
if (t != null) delegate.debug(message, t)
else delegate.debug(message)
}
}