Author: kevin1219
Date: Tue Aug 26 10:29:28 2008
New Revision: 2610

Modified:
   trunk/src/ca/sqlpower/architect/olap/OLAPUtil.java
   trunk/src/ca/sqlpower/architect/swingui/olap/DnDOLAPTransferable.java
   trunk/src/ca/sqlpower/architect/swingui/olap/VirtualCubePane.java

Log:
Fixed a problem with findReferencedCube, it tried to find the OLAPSession through the CubeUsage but because CubeUsages is a property of the VirtualCube, that's not possible. So now, the method takes in the parent VirtualCube instead. Also made the olap DnDLabels used OLAPUtil.nameFor() instead of OLAPObject.getName() so that a CubeUsage wouldn't display as gibberish.

Modified: trunk/src/ca/sqlpower/architect/olap/OLAPUtil.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/olap/OLAPUtil.java  (original)
+++ trunk/src/ca/sqlpower/architect/olap/OLAPUtil.java Tue Aug 26 10:29:28 2008
@@ -256,14 +256,15 @@
     /**
      * Finds and returns the Cube that the given CubeUsage references.
      *
+     * @param vCube
+ * Parent of the CubeUsage, used to find OLAPSession ancestor.
      * @param CubeUsage
- * The CubeUsage to search by, OLAPSession ancestor must not be
-     *            null.
+     *            The CubeUsage to search by.
      *
* @return The Cube that the CubeUsage references, or null if not found.
      */
-    public static Cube findReferencedCube(CubeUsage cu) {
-        OLAPSession olapSession = getSession(cu);
+ public static Cube findReferencedCube(VirtualCube vCube, CubeUsage cu) {
+        OLAPSession olapSession = getSession(vCube);
         if (olapSession == null) {
throw new IllegalArgumentException("Can't find OLAPSession ancestor: " + cu);
         }

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/DnDOLAPTransferable.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/DnDOLAPTransferable.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/olap/DnDOLAPTransferable.java Tue Aug 26 10:29:28 2008
@@ -28,6 +28,7 @@
 import org.apache.log4j.Logger;

 import ca.sqlpower.architect.olap.OLAPObject;
+import ca.sqlpower.architect.olap.OLAPUtil;
 import ca.sqlpower.architect.swingui.DnDTreePathTransferable;
 import ca.sqlpower.architect.swingui.PlayPen;
 import ca.sqlpower.architect.swingui.PlayPenComponent;
@@ -77,7 +78,7 @@
                     if (ppco.getItem() == null) {
                         name.append(section.getTitle());
                     } else {
-                        name.append(ppco.getItem().getName());
+                        name.append(OLAPUtil.nameFor(ppco.getItem()));
                     }
                 }
             }

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/VirtualCubePane.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/VirtualCubePane.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/olap/VirtualCubePane.java Tue Aug 26 10:29:28 2008
@@ -100,7 +100,7 @@
         } else if (coord.getIndex() > PlayPenCoordinate.ITEM_INDEX_TITLE){
             if (coord.getItem() instanceof CubeUsage) {
                 CubeUsage cu = (CubeUsage) coord.getItem();
-                Cube c = OLAPUtil.findReferencedCube(cu);
+                Cube c = OLAPUtil.findReferencedCube(model, cu);
if (c == null) throw new NullPointerException("Couldn't find cube!");
                 panel = new CubeEditPanel(c);
             } else if (coord.getItem() instanceof VirtualCubeDimension) {

Reply via email to