airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hes...@apache.org
Subject svn commit: r1459864 - /airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java
Date Fri, 22 Mar 2013 16:01:32 GMT
Author: heshan
Date: Fri Mar 22 16:01:32 2013
New Revision: 1459864

URL: http://svn.apache.org/r1459864
Log:
AIRAVATA-775 Adding ec2 menu to XBaya.

Added:
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java

Added: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java?rev=1459864&view=auto
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java
(added)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java
Fri Mar 22 16:01:32 2013
@@ -0,0 +1,139 @@
+package org.apache.airavata.xbaya.ui.menues;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.dialogs.amazon.AmazonEC2InvokerWindow;
+import org.apache.airavata.xbaya.ui.dialogs.amazon.AmazonS3UtilsWindow;
+import org.apache.airavata.xbaya.ui.dialogs.amazon.ChangeCredentialWindow;
+import org.apache.airavata.xbaya.ui.dialogs.amazon.EC2InstancesManagementWindow;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+
+public class AmazonEC2MenuItem {
+
+    private JMenu amazonEC2Menu;
+
+    private JMenuItem amazonAuthenticationItem;
+
+    private JMenuItem amazonEC2ToolItem;
+
+    private JMenuItem amazonS3ToolItem;
+
+    private JMenuItem configAndDeploy;
+
+    private XBayaEngine engine;
+
+    /**
+     * Constructs a AmazonEC2MenuItem.
+     *
+     * @param engine XBaya engine
+     */
+    public AmazonEC2MenuItem(XBayaEngine engine) {
+        this.engine = engine;
+
+        createAmazonEC2Menu();
+    }
+
+    /**
+     * create menu
+     */
+    private void createAmazonEC2Menu() {
+        createAmazonAuthenticationItem();
+        createAmazonEC2ToolItem();
+        createAmazonS3ToolItem();
+        createConfigAndRunItem();
+
+        this.amazonEC2Menu = new JMenu("Amazon");
+
+        this.amazonEC2Menu.add(this.amazonAuthenticationItem);
+        this.amazonEC2Menu.addSeparator();
+        this.amazonEC2Menu.add(this.amazonEC2ToolItem);
+        this.amazonEC2Menu.add(this.amazonS3ToolItem);
+        this.amazonEC2Menu.addSeparator();
+        this.amazonEC2Menu.add(this.configAndDeploy);
+    }
+
+    private void createAmazonAuthenticationItem() {
+        this.amazonAuthenticationItem = new JMenuItem("Security Credentials");
+        this.amazonAuthenticationItem.addActionListener(new AbstractAction() {
+            private ChangeCredentialWindow window;
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (this.window == null) {
+                    this.window = new ChangeCredentialWindow(AmazonEC2MenuItem.this.engine);
+                }
+                try {
+                    this.window.show();
+                } catch (Exception e1) {
+                    AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1);
+                }
+            }
+        });
+    }
+
+    private void createAmazonEC2ToolItem(){
+        this.amazonEC2ToolItem = new JMenuItem("EC2 Instances Management");
+        this.amazonEC2ToolItem.addActionListener(new AbstractAction() {
+            private EC2InstancesManagementWindow window;
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (this.window == null) {
+                    this.window = new EC2InstancesManagementWindow(AmazonEC2MenuItem.this.engine);
+                }
+                try {
+                    this.window.show();
+                } catch (Exception e1) {
+                    AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1);
+                }
+            }
+        });
+    }
+
+    private void createAmazonS3ToolItem() {
+        this.amazonS3ToolItem = new JMenuItem("S3 Upload/Download Tool");
+        this.amazonS3ToolItem.addActionListener(new AbstractAction() {
+            private AmazonS3UtilsWindow window;
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (this.window == null) {
+                    this.window = AmazonS3UtilsWindow.getInstance(AmazonEC2MenuItem.this.engine);
+                }
+                try {
+                    this.window.show();
+                } catch (Exception e1) {
+                    AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1);
+                }
+            }
+        });
+    }
+
+    private void createConfigAndRunItem() {
+        this.configAndDeploy = new JMenuItem("Config and Deploy Job Flow");
+        this.configAndDeploy.addActionListener(new AbstractAction() {
+            private AmazonEC2InvokerWindow window;
+
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                if (this.window == null) {
+                    this.window = new AmazonEC2InvokerWindow(AmazonEC2MenuItem.this.engine);
+                }
+                try {
+                    this.window.show();
+                } catch (Exception e1) {
+                    AmazonEC2MenuItem.this.engine.getGUI().getErrorWindow().error(e1);
+                }
+
+            }
+        });
+
+    }
+
+    public JMenu getMenu() {
+        return this.amazonEC2Menu;
+    }
+
+}
+



Mime
View raw message