Revision: 4004
Author: [email protected]
Date: Wed Dec  1 09:08:22 2010
Log: Fixed bug 3084. The labels were not having their dimensions re-calculated when they were loaded from the server because the code was hidden behind a magic check. The OLAP UI was also falling into a similar problem so that has been fixed as well.
http://code.google.com/p/power-architect/source/detail?r=4004

Modified:
 /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponent.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenContentPane.java
 /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenLabel.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponent.java Tue Nov 30 12:44:42 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenComponent.java Wed Dec 1 09:08:22 2010
@@ -231,16 +231,10 @@
             return;
         } else {
             Rectangle r = new Rectangle(topLeftCorner, lengths);
-            if (isMagicEnabled()) {
-                // This temporary disabling of magic is under the
-                // assumption that this method properly revalidates
-                // the component in one pass, and does not rely
-                // on recursive calls due to magical side effects
-                setMagicEnabled(false);
-                updateLengths(true);
- if (logger.isDebugEnabled()) logger.debug("Scheduling repaint at "+r); //$NON-NLS-1$
-                setMagicEnabled(true);
-            }
+            setMagicEnabled(false);
+            updateLengths(true);
+ if (logger.isDebugEnabled()) logger.debug("Scheduling repaint at "+r); //$NON-NLS-1$
+            setMagicEnabled(true);
             pp.zoomRect(r);
             pp.repaint(r);
         }
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenContentPane.java Fri Jul 16 07:18:35 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenContentPane.java Wed Dec 1 09:08:22 2010
@@ -184,6 +184,9 @@
owner.addPropertyChangeListener("zoom", new ZoomFixer()); //$NON-NLS-1$
             firePropertyChange("playPen", null, owner);
         }
+        for (PlayPenComponent c : components) {
+            c.revalidate();
+        }
     }

     public boolean contains(Point p) {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenLabel.java Wed Sep 8 09:03:21 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/swingui/PlayPenLabel.java Wed Dec 1 09:08:22 2010
@@ -65,6 +65,9 @@

         @Override
         public Dimension getPreferredSize() {
+            if (label.getText() == null) {
+                return new Dimension(0, 0);
+            }
             String[] textToRender = label.getText().split("\n");
FontMetrics fm = getPlayPen().getFontMetrics(getPlayPen().getFont());
             int textHeight = fm.getHeight() * textToRender.length;
@@ -97,6 +100,9 @@
             g2.translate(insets.left, insets.top);
             g2.setColor(Color.BLACK);

+            if (label.getText() == null) {
+                return;
+            }
             String[] textToRender = label.getText().split("\n");
             g2.setFont(getPlayPen().getFont());
             FontMetrics fm = g2.getFontMetrics();

Reply via email to