Revision: 4034
Author: [email protected]
Date: Thu Dec 9 10:57:57 2010
Log: There was some unfinished stuff in this class. We recently refactored
the way playpencomponents saved their data. This was trying to do things
the old way, and so auto layout did not work in the OLAP playpen. Now it
does.
http://code.google.com/p/power-architect/source/detail?r=4034
Modified:
/trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponentLocationEdit.java
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponentLocationEdit.java
Tue Dec 7 14:09:21 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponentLocationEdit.java
Thu Dec 9 10:57:57 2010
@@ -19,7 +19,7 @@
package ca.sqlpower.architect.swingui;
-import java.awt.Rectangle;
+import java.awt.Point;
import java.beans.PropertyChangeEvent;
import java.util.HashMap;
import java.util.Map;
@@ -44,11 +44,11 @@
*/
public class PlayPenComponentLocationEdit extends AbstractUndoableEdit {
- private final Map<PlayPenComponent, Rectangle> initialBounds =
- new HashMap<PlayPenComponent, Rectangle>();
-
- private final Map<PlayPenComponent, Rectangle> finalBounds =
- new HashMap<PlayPenComponent, Rectangle>();
+ private final Map<PlayPenComponent, Point> initialBounds =
+ new HashMap<PlayPenComponent, Point>();
+
+ private final Map<PlayPenComponent, Point> finalBounds =
+ new HashMap<PlayPenComponent, Point>();
@Override
public boolean addEdit(UndoableEdit anEdit) {
@@ -62,9 +62,9 @@
&& pce.getSource() instanceof PlayPenComponent) {
PlayPenComponent ppc = (PlayPenComponent) pce.getSource();
if (!initialBounds.containsKey(pce.getSource())) {
- initialBounds.put(ppc, new Rectangle((Rectangle)
pce.getOldValue()));
- }
- finalBounds.put(ppc, new Rectangle((Rectangle)
pce.getNewValue()));
+ initialBounds.put(ppc, new Point((Point)
pce.getOldValue()));
+ }
+ finalBounds.put(ppc, new Point((Point) pce.getNewValue()));
anEdit.die();
return true;
}
@@ -76,16 +76,16 @@
@Override
public void undo() throws CannotUndoException {
super.undo();
- for (Map.Entry<PlayPenComponent, Rectangle> entry :
initialBounds.entrySet()) {
- entry.getKey().setBounds(entry.getValue());
+ for (Map.Entry<PlayPenComponent, Point> entry :
initialBounds.entrySet()) {
+ entry.getKey().setTopLeftCorner(entry.getValue());
}
}
@Override
public void redo() throws CannotRedoException {
super.redo();
- for (Map.Entry<PlayPenComponent, Rectangle> entry :
finalBounds.entrySet()) {
- entry.getKey().setBounds(entry.getValue());
+ for (Map.Entry<PlayPenComponent, Point> entry :
finalBounds.entrySet()) {
+ entry.getKey().setTopLeftCorner(entry.getValue());
}
}