Added NotesDialog MVC. Wired window movement. Added GUIUtil
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
package com.jdbernard.timestamper
|
||||
|
||||
import java.awt.Point
|
||||
import java.awt.Rectangle
|
||||
import java.awt.Toolkit
|
||||
|
||||
class NotesDialogController {
|
||||
// these will be injected by Griffon
|
||||
def model
|
||||
def view
|
||||
|
||||
|
||||
void mvcGroupInit(Map args) {
|
||||
}
|
||||
|
||||
Point mousePressRelativeToDialog
|
||||
|
||||
def mousePressed = { evt -> mousePressRelativeToDialog = evt?.point }
|
||||
|
||||
def mouseDragged = { evt ->
|
||||
GUIUtil.componentDragged(view.notesDialog, evt,
|
||||
mousePressRelativeToDialog,
|
||||
new Rectangle(Toolkit.defaultToolkit.screenSize),
|
||||
app.views.TimeStamperMain.frame.bounds)
|
||||
}
|
||||
}
|
@ -1,12 +1,24 @@
|
||||
package com.jdbernard.timestamper
|
||||
|
||||
import java.awt.Point
|
||||
import java.awt.Rectangle
|
||||
import java.awt.Toolkit
|
||||
import java.util.Timer
|
||||
|
||||
class TimeStamperMainController {
|
||||
// these will be injected by Griffon
|
||||
def model
|
||||
def view
|
||||
|
||||
Timer updateTimer
|
||||
|
||||
Point mousePressRelativeToFrame
|
||||
|
||||
void mvcGroupInit(Map args) {
|
||||
// this method is called after model and view are injected
|
||||
def notes = buildMVCGroup('NotesDialog')
|
||||
view.notesDialog = notes.view.notesDialog
|
||||
|
||||
updateTimer
|
||||
}
|
||||
|
||||
def exitGracefully = { evt = null ->
|
||||
@ -16,4 +28,22 @@ class TimeStamperMainController {
|
||||
def showToolsMenu = { evt = null ->
|
||||
|
||||
}
|
||||
|
||||
def showNotes = { evt = null ->
|
||||
view.notesDialog.visible = view.notesVisibleButton.selected
|
||||
}
|
||||
|
||||
def showPunchcard = { evt = null ->
|
||||
|
||||
}
|
||||
|
||||
def mousePressed = { evt = null ->
|
||||
mousePressRelativeToFrame = evt?.point
|
||||
}
|
||||
|
||||
def mouseDragged = { evt = null ->
|
||||
GUIUtil.componentDragged(view.frame, evt, mousePressRelativeToFrame,
|
||||
new Rectangle(Toolkit.defaultToolkit.screenSize))
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user