Removed Action portions. Added logging framework. GUI architecture changed (move to dependancy injection)

This commit is contained in:
Jonathan Bernard
2009-12-23 18:29:13 -06:00
parent 5b19542355
commit cee6de1147
15 changed files with 1534 additions and 53 deletions

View File

@ -8,49 +8,52 @@ import javax.swing.BoxLayout
import net.miginfocom.swing.MigLayout
Point mousePressRelativeToDialog
Point offsetFromMainFrame
Point offsetFromMainFrame = new Point(0,0)
boolean coupledToMainFrame = false
mousePressed = { evt -> mousePressRelativeToDialog = evt?.point }
mouseDragged = { evt ->
GUIUtil.componentDragged(view.notesDialog, evt,
mousePressRelativeToDialog,
GUIUtil.componentDragged(dialog, evt, mousePressRelativeToDialog,
new Rectangle(Toolkit.defaultToolkit.screenSize),
app.views.TimeStamperMain.frame.bounds)
model.mainMVC.view.frame.bounds)
Point p = app.views.TimeStamperMain.frame.location
offsetFromMainFrame = new Point(notesDialog.location)
offsetFromMainFrame.translate((int) -p.x, (int) -p.y)
offsetFromMainFrame = GUIUtil.calculateOffset(
model.mainMVC.view.frame, dialog)
coupledToMainFrame = GUIUtil.componentsCoupled(dialog,
model.mainMVC.view.frame);
}
notesDialog = dialog(
dialog = dialog(
title: 'Notes',
modal: false,
undecorated: true,
minimumSize: [325, 200],
iconImage: imageIcon('/16-em-pencil.png').image,
iconImages: [imageIcon('/16-em-pencil.png').image],
location: bind(source: app.models.TimeStamperMain,
location: bind(source: model.mainMVC.model,
sourceProperty: 'absoluteLocation',
converter: { loc ->
Point p = new Point(offsetFromMainFrame)
p.translate((int) loc.x, (int) loc.y)
return p})
if (coupledToMainFrame) {
Point p = new Point(offsetFromMainFrame)
p.translate((int) loc.x, (int) loc.y)
return p
} else return dialog.location })
) {
panel(
border:lineBorder(color: Color.BLACK, thickness:1, parent:true),
mousePressed: mousePressed,
mouseDragged: mouseDragged,
layout: new MigLayout('insets 5 5 5 5, fill')
) {
scrollPane(constraints: 'growx, growy, spany 2') {
scrollPane(constraints: 'growx, growy') {
notesTextArea = textArea(lineWrap: true, columns: 20, rows: 5,
wrapStyleWord: true,
text: bind(source: app.models.TimeStamperMain,
text: bind(source: model.mainMVC.model,
sourceProperty: 'currentMarker',
sourceValue: { app.models.TimeStamperMain.currentMarker?.notes}))
sourceValue: { model.mainMVC.model.currentMarker?.notes}))
}
}
}

View File

@ -1,6 +1,5 @@
package com.jdbernard.timestamper
import groovy.beans.Bindable
import java.awt.Color
import java.awt.Font
import java.awt.Point
@ -12,8 +11,6 @@ import javax.swing.Timer
import com.jdbernard.timestamper.core.Timeline
import net.miginfocom.swing.MigLayout
Point mousePressRelativeToFrame
/* ========== *
* GUI Events *
* ========== */
@ -38,7 +35,7 @@ showToolsMenu = { evt = null ->
}
showNotes = { evt = null ->
notesDialog.visible = notesVisibleButton.selected
model.notesDialogMVC.view.dialog.visible = notesVisibleButton.selected
}
showPunchcard = { evt = null ->
@ -119,7 +116,7 @@ frame = application(title:'TimeStamper',
border: emptyBorder(0),
contentAreaFilled: false,
hideActionText: true)
button(gracefulExitAction,
button(actionPerformed: controller.&exitGracefully,
icon: imageIcon('/16-em-cross.png'),
rolloverIcon: imageIcon('/16-em-cross-hover.png'),
border: emptyBorder(0),