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

@ -83,9 +83,50 @@ public class GUIUtil {
return finalWindowPoint;
}
def static componentDragged(frame, MouseEvent evt,
static void componentDragged(frame, MouseEvent evt,
Point mousePressRelativeToFrame, Rectangle... snapBoxes) {
frame.location = calculateWindowMovement(evt.getLocationOnScreen(),
mousePressRelativeToFrame, frame.bounds, snapBoxes)
}
static boolean componentsCoupled(c1, c2) {
def h1 = c1.bounds.height
def w1 = c1.bounds.width
def h2 = c2.bounds.height
def w2 = c2.bounds.width
return (
( // horizontal
( // snapped horizontally
((c1.x - c2.x).abs() < 20) || // c1 left edge to c2 left edge
((c1.x + w1 - c2.x - w2).abs() < 20) || // c1 right edge to c2 right edge
((c1.x + w1 - c2.x).abs() < 20) || // c1 right edge to c2 left edge
((c2.x + w2 - c1.x).abs() < 20) // c1 left edge to c2 right edge
) && (// touching vertically
(c1.y <= c2.y && c1.y + h1 >= c2.y) ||
(c1.y <= c2.y + h2 && c1.y + h1 >= c2.y + h2) ||
(c1.y > c2.y && c1.y + h1 < c2.y + h2)
)
) || ( // vertical
( // snapped vertically
((c1.y - c2.y).abs() < 20) || // c1 top to c2 top
((c1.y + h1 - c2.y - h2).abs() < 20) || // c1 bot to c2 bot
((c1.y + h1 - c2.y).abs() < 20) || // c1 bot to c2 top
((c2.y + h2 - c1.y).abs() < 20) // c1 top to c2 bot
) && (// touching horizontally
(c1.x <= c2.x && c1.x + w1 >= c2.x) ||
(c1.x <= c2.x + w2 && c1.x + w1 >= c2.x + w2) ||
(c1.x > c2.x && c1.x + w1 < c2.x + w2)
)
)
)
}
static Point calculateOffset(c1, c2) {
Point p = c1.location
Rectangle r = c1.bounds
Point offset = new Point(c2.location)
offset.translate((int) -p.x, (int) -p.y)
return offset
}
}