Author: jfuerth
Date: Tue Sep  2 15:29:20 2008
New Revision: 2677

Added:
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateEnergonCubeAction.java
   trunk/src/icons/olap/energonCube.png   (contents, props changed)
   trunk/src/icons/olap/energonCubeAdd.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_1.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_10.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_11.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_12.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_13.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_14.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_15.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_16.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_2.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_3.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_4.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_5.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_6.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_7.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_8.png   (contents, props changed)
   trunk/src/icons/olap/energonCube_anim_9.png   (contents, props changed)
trunk/src/icons/olap/energonCube_background.jpg (contents, props changed)
Modified:
   trunk/src/ca/sqlpower/architect/swingui/olap/OLAPContextMenuFactory.java

Log:
Giulio's final contribution to the cube designer.

Modified: trunk/src/ca/sqlpower/architect/swingui/olap/OLAPContextMenuFactory.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/olap/OLAPContextMenuFactory.java (original) +++ trunk/src/ca/sqlpower/architect/swingui/olap/OLAPContextMenuFactory.java Tue Sep 2 15:29:20 2008
@@ -31,6 +31,7 @@
 import ca.sqlpower.architect.olap.MondrianModel.VirtualCube;
 import ca.sqlpower.architect.swingui.ArchitectSwingSession;
 import ca.sqlpower.architect.swingui.PopupMenuFactory;
+import ca.sqlpower.architect.swingui.olap.action.CreateEnergonCubeAction;
 import ca.sqlpower.architect.swingui.olap.action.EditCubeAction;
 import ca.sqlpower.architect.swingui.olap.action.EditDimensionAction;
 import ca.sqlpower.architect.swingui.olap.action.EditHierarchyAction;
@@ -75,6 +76,7 @@
             m.add(oSession.getCreateCubeAction());
             m.add(oSession.getCreateDimensionAction());
             m.add(oSession.getCreateVirtualCubeAction());
+ m.add(new CreateEnergonCubeAction(session, oSession.getOlapPlayPen()));
             m.addSeparator();
m.add(new EditSchemaAction(session,(Schema) obj, oSession.getOlapPlayPen()));
             m.addSeparator();

Added: trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateEnergonCubeAction.java
==============================================================================
--- (empty file)
+++ trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateEnergonCubeAction.java Tue Sep 2 15:29:20 2008
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2008, SQL Power Group Inc.
+ *
+ * This file is part of Power*Architect.
+ *
+ * Power*Architect is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Power*Architect is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package ca.sqlpower.architect.swingui.olap.action;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.Timer;
+
+import ca.sqlpower.architect.swingui.ArchitectSwingSession;
+import ca.sqlpower.architect.swingui.PlayPen;
+import ca.sqlpower.architect.swingui.action.AbstractArchitectAction;
+import ca.sqlpower.swingui.SPSUtils;
+
+public class CreateEnergonCubeAction extends AbstractArchitectAction {
+
+    private final class FrameAdvancer implements ActionListener {
+        private final JLabel energon;
+
+
+        int frame;
+
+        private FrameAdvancer(JLabel energon) {
+            this.energon = energon;
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            if (frame >= frames.length) {
+                timer.stop();
+                return;
+            }
+            energon.setIcon(new CompositeIcon(bg, frames[frame++]));
+        }
+    }
+
+    private ImageIcon bg;
+    private Icon[] frames;
+    private Timer timer;
+
+ public CreateEnergonCubeAction(ArchitectSwingSession session, PlayPen pp) {
+        super(
+ session, pp, "New Energon Cube...", "Create a new Energon Cube", + new ImageIcon(CreateEnergonCubeAction.class.getResource("/icons/olap/energonCubeAdd.png")));
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        if (bg == null) {
+ bg = new ImageIcon(getClass().getResource("/icons/olap/energonCube_background.jpg"));
+        }
+        if (frames == null) {
+            frames = new Icon[15];
+            for (int i = 0; i < frames.length; i++) {
+ frames[i] = new ImageIcon(getClass().getResource("/icons/olap/energonCube_anim_"+(i+1)+".png"));
+            }
+        }
+        final JLabel energon = new JLabel(bg);
+        timer = new Timer(200, new FrameAdvancer(energon));
+
+        JDialog d = SPSUtils.makeOwnedDialog(playpen, "New Energon Cube");
+        d.setContentPane(energon);
+        d.setModal(true);
+        d.pack();
+        timer.start();
+        d.setVisible(true);
+    }
+
+    private static class CompositeIcon implements Icon {
+
+        private final Icon bg;
+        private final Icon overlay;
+
+        CompositeIcon(Icon bg, Icon overlay) {
+            this.bg = bg;
+            this.overlay = overlay;
+        }
+
+        public int getIconHeight() {
+            return bg.getIconHeight();
+        }
+
+        public int getIconWidth() {
+            return bg.getIconWidth();
+        }
+
+        public void paintIcon(Component c, Graphics g, int x, int y) {
+            bg.paintIcon(c, g, x, y);
+            overlay.paintIcon(c, g, x, y);
+        }
+
+    }
+}

Added: trunk/src/icons/olap/energonCube.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCubeAdd.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_1.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_10.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_11.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_12.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_13.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_14.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_15.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_16.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_2.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_3.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_4.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_5.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_6.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_7.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_8.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_anim_9.png
==============================================================================
Binary file. No diff available.

Added: trunk/src/icons/olap/energonCube_background.jpg
==============================================================================
Binary file. No diff available.

Reply via email to