You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:31:00 UTC
[58/90] [abbrv] AIRAVATA-1124
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java
new file mode 100644
index 0000000..56f0ff0
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndDoWhileNodeGUI.java
@@ -0,0 +1,178 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
+import java.util.List;
+
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.EndDoWhileConfigurationDialog;
+import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
+
+
+public class EndDoWhileNodeGUI extends ConfigurableNodeGUI {
+
+ private EndDoWhileConfigurationDialog configurationWindow;
+
+ private EndDoWhileNode node;
+
+ private Polygon polygon;
+
+ private GeneralPath generalPath;
+
+ /**
+ * @param node
+ */
+ public EndDoWhileNodeGUI(EndDoWhileNode node) {
+ super(node);
+ this.node = node;
+ this.polygon = new Polygon();
+ generalPath = new GeneralPath();
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new EndDoWhileConfigurationDialog(this.node,
+ xbayaGUI);
+ }
+ this.configurationWindow.show();
+ }
+
+ /**
+ * @see edu.indiana.extreme.xbaya.graph.gui.NodeGUI#calculatePositions(java.awt.Graphics)
+ */
+ @Override
+ protected void calculatePositions(Graphics g) {
+ super.calculatePositions(g);
+ calculatePositions();
+ setPortPositions();
+ }
+
+ /**
+ * @see edu.indiana.extreme.xbaya.graph.gui.NodeGUI#getBounds()
+ */
+ @Override
+ protected Rectangle getBounds() {
+ return this.polygon.getBounds();
+ }
+
+ @Override
+ protected boolean isIn(Point point) {
+ return this.polygon.contains(point);
+ }
+
+ protected GeneralPath getComponentShape() {
+ return generalPath;
+ }
+
+ protected String getComponentHeaderText() {
+ return node.getName();
+ }
+
+ protected GeneralPath getComponentHeaderShape() {
+ return DrawUtils.getRoundedShape(createHeader(getPosition()));
+ }
+
+ protected Color getComponentHeaderColor() {
+ return headColor;
+ }
+
+ protected Node getNode() {
+ return this.node;
+ }
+
+ private Polygon createHeader(Point position) {
+ Polygon head = new Polygon();
+ head.addPoint(position.x, position.y);
+ head.addPoint(position.x, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y
+ + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y
+ + this.headHeight / 2);
+ return head;
+ }
+
+ /**
+ * @see edu.indiana.extreme.xbaya.graph.gui.NodeGUI#setPortPositions()
+ */
+ @Override
+ protected void setPortPositions() {
+ // inputs
+ List<? extends Port> inputPorts = this.node.getInputPorts();
+ for (int i = 0; i < inputPorts.size(); i++) {
+ Port port = inputPorts.get(i);
+ Point offset;
+ if (i < inputPorts.size() / 2) {
+ offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight
+ + PORT_INITIAL_GAP + PORT_GAP * i);
+ } else {
+ offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight
+ + PORT_INITIAL_GAP + PORT_GAP * (i + 1));
+ }
+ NodeController.getGUI(port).setOffset(offset);
+ }
+
+ // outputs
+ List<? extends Port> outputPorts = this.node.getOutputPorts();
+ for (int i = 0; i < outputPorts.size(); i++) {
+ Port port = outputPorts.get(i);
+ Point offset = new Point(this.getBounds().width
+ - PortGUI.DATA_PORT_SIZE / 2, (int) (this.headHeight
+ + PORT_INITIAL_GAP + PORT_GAP
+ * (outputPorts.size() / 2.0 + i)));
+ NodeController.getGUI(port).setOffset(offset);
+ }
+
+
+
+ }
+
+ private void calculatePositions() {
+ this.polygon.reset();
+ Point position = getPosition();
+ this.polygon.addPoint(position.x, position.y);
+ this.polygon.addPoint(position.x, position.y + this.dimension.height
+ + this.headHeight / 2);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y
+ + this.dimension.height);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y
+ + this.headHeight / 2);
+ DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java
new file mode 100644
index 0000000..a76c430
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndForEachNodeGUI.java
@@ -0,0 +1,148 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
+
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.EndForEachConfigurationDialog;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
+
+public class EndForEachNodeGUI extends ConfigurableNodeGUI {
+
+ private EndForEachNode node;
+
+ private Polygon polygon;
+
+ private EndForEachConfigurationDialog configurationWindow;
+ private GeneralPath generalPath;
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new EndForEachConfigurationDialog(this.node, xbayaGUI);
+ }
+ this.configurationWindow.show();
+ }
+
+ /**
+ * @param node
+ */
+ public EndForEachNodeGUI(EndForEachNode node) {
+ super(node);
+ this.node = node;
+ this.polygon = new Polygon(); // To avoid null check.
+ generalPath = new GeneralPath();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#calculatePositions(java.awt.Graphics)
+ */
+ @Override
+ protected void calculatePositions(Graphics g) {
+ super.calculatePositions(g);
+ calculatePositions();
+ setPortPositions();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#getBounds()
+ */
+ @Override
+ protected Rectangle getBounds() {
+ return this.polygon.getBounds();
+ }
+
+ @Override
+ protected boolean isIn(Point point) {
+ return this.polygon.contains(point);
+ }
+
+ protected Color getCompnentHeaderColor() {
+ return headColor;
+ }
+
+ protected String getComponentHeaderText() {
+ return node.getName();
+ }
+
+ protected GeneralPath getComponentHeaderShape() {
+ return DrawUtils.getRoundedShape(createHeader(getPosition()));
+ }
+
+ protected GeneralPath getComponentShape() {
+ return generalPath;
+ }
+
+ protected Node getNode() {
+ return this.node;
+ }
+
+ private Polygon createHeader(Point position) {
+ Polygon head = new Polygon();
+ head.addPoint(position.x, position.y);
+ head.addPoint(position.x, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ return head;
+ }
+
+ private void calculatePositions() {
+ this.polygon = new Polygon();
+ Point position = getPosition();
+ this.polygon.addPoint(position.x, position.y);
+ this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#setPortPositions()
+ */
+ @Override
+ protected void setPortPositions() {
+ // TODO Auto-generated method stub
+ super.setPortPositions();
+
+ for (Port controlOutPort : this.node.getControlOutPorts()) {
+ NodeController.getGUI(controlOutPort).setOffset(new Point(getBounds().width, getBounds().height - this.headHeight / 2));
+ break; // Has only one
+ }
+
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java
new file mode 100644
index 0000000..9151897
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/EndifNodeGUI.java
@@ -0,0 +1,176 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
+import java.util.List;
+
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.EndifConfigurationDialog;
+import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
+
+public class EndifNodeGUI extends ConfigurableNodeGUI {
+
+ private EndifConfigurationDialog configurationWindow;
+
+ private EndifNode node;
+
+ private Polygon polygon;
+
+ private GeneralPath generalPath;
+
+ /**
+ * @param node
+ */
+ public EndifNodeGUI(EndifNode node) {
+ super(node);
+ this.node = node;
+ this.polygon = new Polygon();
+ generalPath = new GeneralPath();
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new EndifConfigurationDialog(this.node, xbayaGUI);
+ }
+ this.configurationWindow.show();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#calculatePositions(java.awt.Graphics)
+ */
+ @Override
+ protected void calculatePositions(Graphics g) {
+ super.calculatePositions(g);
+ calculatePositions();
+ setPortPositions();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#getBounds()
+ */
+ @Override
+ protected Rectangle getBounds() {
+ return this.polygon.getBounds();
+ }
+
+ @Override
+ protected boolean isIn(Point point) {
+ return this.polygon.contains(point);
+ }
+
+ protected Color getComponentHeaderColor() {
+ return headColor;
+ }
+
+ protected String getComponentHeaderText() {
+ return this.node.getName();
+ }
+
+ protected GeneralPath getComponentHeaderShape() {
+ return DrawUtils.getRoundedShape(createHeader(getPosition()));
+ }
+
+ protected GeneralPath getComponentShape() {
+ return generalPath;
+ }
+
+ protected Node getNode() {
+ return this.node;
+ }
+
+ private Polygon createHeader(Point position) {
+ Polygon head = new Polygon();
+ head.addPoint(position.x, position.y);
+ head.addPoint(position.x, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ return head;
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#setPortPositions()
+ */
+ @Override
+ protected void setPortPositions() {
+ // inputs
+ List<? extends Port> inputPorts = this.node.getInputPorts();
+ for (int i = 0; i < inputPorts.size(); i++) {
+ Port port = inputPorts.get(i);
+ Point offset;
+ if (i < inputPorts.size() / 2) {
+ offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * i);
+ } else {
+ offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * (i + 1));
+ }
+ NodeController.getGUI(port).setOffset(offset);
+ }
+
+ // outputs
+ List<? extends Port> outputPorts = this.node.getOutputPorts();
+ for (int i = 0; i < outputPorts.size(); i++) {
+ Port port = outputPorts.get(i);
+ Point offset = new Point(this.getBounds().width - PortGUI.DATA_PORT_SIZE / 2, (int) (this.headHeight
+ + PORT_INITIAL_GAP + PORT_GAP * (outputPorts.size() / 2.0 + i)));
+ NodeController.getGUI(port).setOffset(offset);
+ }
+
+ // control-in
+ Port controlInPort = this.node.getControlInPort();
+ if (controlInPort != null) {
+ NodeController.getGUI(controlInPort).setOffset(new Point(0, 0));
+ }
+
+ // control-out
+ for (Port controlOutPort : this.node.getControlOutPorts()) {
+ NodeController.getGUI(controlOutPort).setOffset(new Point(getBounds().width, getBounds().height - this.headHeight / 2));
+ break; // Has only one
+ }
+
+ }
+
+ private void calculatePositions() {
+ this.polygon.reset();
+ Point position = getPosition();
+ this.polygon.addPoint(position.x, position.y);
+ this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java
new file mode 100644
index 0000000..66b2265
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ExitNodeGUI.java
@@ -0,0 +1,98 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.geom.Ellipse2D;
+
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.system.ExitNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+import org.apache.airavata.xbaya.ui.graph.Paintable;
+
+public class ExitNodeGUI extends NodeGUI {
+
+ public final static Color c_LIGHTER = new Color(255, 255, 255);
+ public final static Color c_DARKER = new Color(251, 103, 87);
+
+ /**
+ * Constructs a BPELExitNodeGUI.
+ *
+ * @param node
+ */
+ public ExitNodeGUI(ExitNode node) {
+ super(node);
+ node.setName(" Exit");
+ }
+
+ @Override
+ protected void paint(Graphics2D g2) {
+
+ Point position = this.node.getPosition();
+
+ Graphics2D g = (Graphics2D) g2.create();
+ GradientPaint gp = new GradientPaint(position.x, position.y, c_LIGHTER, (position.x + this.dimension.height),
+ (position.y + this.dimension.height), c_DARKER);
+ // Draws the body.
+
+ if (this.dragged) {
+ g.setColor(DRAGGED_BODY_COLOR);
+ } else {
+ g.setColor(this.bodyColor);
+ }
+ Ellipse2D.Double bodyShape = new Ellipse2D.Double(position.x + 2, position.y, this.dimension.height, this.dimension.height);
+ drawHeader(g, bodyShape, node.getName(), c_DARKER, false);
+// g.setPaint(gp);
+// g.fillOval(position.x + 2, position.y, this.dimension.height, this.dimension.height);
+// g.setColor(Color.black);
+//// g.setStroke(new BasicStroke(1.2f));
+// g.drawOval(position.x + 2, position.y, this.dimension.height, this.dimension.height);
+ // Text
+// g.setColor(TEXT_COLOR);
+
+ // XXX it's debatable if we should show the ID or the name.
+// String name = this.node.getName(); // + this.node.getID();
+// g.drawString(name, position.x + TEXT_GAP_X, position.y + this.headHeight - TEXT_GAP_Y + 2);
+
+ // Edge
+ drawEdge(g, bodyShape.getBounds2D(),EDGE_COLOR.brighter());
+ drawEdge(g, bodyShape, EDGE_COLOR);
+
+// g.setColor(EDGE_COLOR);
+// // Comment of dont want circle in rectangle
+// g.drawRect(position.x, position.y, this.dimension.height + 2, this.dimension.height);
+
+ // Paint all ports
+ drawPorts(g, node);
+
+ // Paint extras
+ for (Paintable paintable : this.paintables) {
+ paintable.paint(g, this.node.getPosition());
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java
new file mode 100644
index 0000000..2b98bfa
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ForEachNodeGUI.java
@@ -0,0 +1,155 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
+
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.impl.PortImpl;
+import org.apache.airavata.workflow.model.graph.system.ForEachNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.ForEachConfigurationDialog;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
+
+public class ForEachNodeGUI extends ConfigurableNodeGUI {
+
+ private static final String CONFIG_AREA_STRING = "Config";
+
+ private ForEachNode node;
+
+ private ForEachConfigurationDialog configurationWindow;
+
+ private Polygon polygon;
+
+ private GeneralPath generalPath;
+
+ /**
+ * @param node
+ */
+ public ForEachNodeGUI(ForEachNode node) {
+ super(node);
+ this.node = node;
+ setConfigurationText(CONFIG_AREA_STRING);
+ this.polygon = new Polygon(); // To avoid null check.
+ generalPath = new GeneralPath();
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new ForEachConfigurationDialog(this.node, xbayaGUI);
+ }
+ this.configurationWindow.show();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.system.ConfigurableNodeGUI#calculatePositions(java.awt.Graphics)
+ */
+ @Override
+ protected void calculatePositions(Graphics g) {
+ super.calculatePositions(g);
+ calculatePositions();
+ setPortPositions();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#getBounds()
+ */
+ @Override
+ protected Rectangle getBounds() {
+ return this.polygon.getBounds();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#isIn(java.awt.Point)
+ */
+ @Override
+ protected boolean isIn(Point point) {
+ return this.polygon.contains(point);
+ }
+
+ protected Color getComponentHeaderColor() {
+ return headColor;
+ }
+
+ protected String getComponentHeaderText() {
+ return node.getName();
+ }
+
+ protected GeneralPath getComponentHeaderShape() {
+ return DrawUtils.getRoundedShape(createHeader(getPosition()));
+ }
+
+ protected GeneralPath getComponentShape() {
+ return generalPath;
+ }
+
+ protected Node getNode() {
+ return this.node;
+ }
+
+ private Polygon createHeader(Point position) {
+ Polygon head = new Polygon();
+ head.addPoint(position.x, position.y + this.headHeight / 2);
+ head.addPoint(position.x, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y);
+ return head;
+ }
+
+ private void calculatePositions() {
+ // XXX Avoid instantiating a new polygon each time.
+ this.polygon = new Polygon();
+ Point position = getPosition();
+ this.polygon.addPoint(position.x, position.y + this.headHeight / 2);
+ this.polygon.addPoint(position.x, position.y + this.dimension.height);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height + this.headHeight
+ - this.headHeight / 2);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y);
+ DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
+ }
+
+ /**
+ * Sets up the position of ports
+ */
+ @Override
+ protected void setPortPositions() {
+ super.setPortPositions();
+
+ PortImpl controlInPort = this.node.getControlInPort();
+ if (controlInPort != null) {
+ Point off = new Point(0, this.headHeight / 2);
+ NodeController.getGUI(controlInPort).setOffset(off);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java
new file mode 100644
index 0000000..f5a7f68
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/IfNodeGUI.java
@@ -0,0 +1,183 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
+import java.util.List;
+
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.impl.PortImpl;
+import org.apache.airavata.workflow.model.graph.system.IfNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.IfConfigurationDialog;
+import org.apache.airavata.xbaya.ui.graph.PortGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
+
+public class IfNodeGUI extends ConfigurableNodeGUI {
+
+ private static final String CONFIG_AREA_STRING = "Config";
+
+ private IfNode node;
+
+ private IfConfigurationDialog configurationWindow;
+
+ private Polygon polygon;
+
+ private GeneralPath generalPath;
+
+ /**
+ * @param node
+ */
+ public IfNodeGUI(IfNode node) {
+ super(node);
+ this.node = node;
+ setConfigurationText(CONFIG_AREA_STRING);
+ this.polygon = new Polygon();
+ generalPath = new GeneralPath();
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new IfConfigurationDialog(this.node, xbayaGUI);
+ }
+ this.configurationWindow.show();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.system.ConfigurableNodeGUI#calculatePositions(java.awt.Graphics)
+ */
+ @Override
+ protected void calculatePositions(Graphics g) {
+ super.calculatePositions(g);
+ calculatePositions();
+ setPortPositions();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#getBounds()
+ */
+ @Override
+ protected Rectangle getBounds() {
+ return this.getComponentShape().getBounds();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#isIn(java.awt.Point)
+ */
+ @Override
+ protected boolean isIn(Point point) {
+ return this.polygon.contains(point);
+ }
+
+ protected Color getComponentHeaderColor() {
+ return this.headColor;
+ }
+
+ protected GeneralPath getComponentHeaderShape() {
+ return DrawUtils.getRoundedShape(createHeadNode(getPosition()));
+ }
+
+ protected String getComponentHeaderText() {
+ return this.node.getName();
+ }
+
+ protected GeneralPath getComponentShape() {
+ return generalPath;
+ }
+
+ protected Node getNode() {
+ return this.node;
+ }
+
+ private Polygon createHeadNode(Point position) {
+ Polygon head = new Polygon();
+ head.addPoint(position.x, position.y + this.headHeight / 2);
+ head.addPoint(position.x, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ head.addPoint(position.x + this.dimension.width / 2, position.y);
+ return head;
+ }
+
+ /**
+ * Sets up the position of ports
+ */
+ @Override
+ protected void setPortPositions() {
+ List<? extends Port> inputPorts = this.node.getInputPorts();
+ for (int i = 0; i < inputPorts.size(); i++) {
+ Port port = inputPorts.get(i);
+ Point offset = new Point(PortGUI.DATA_PORT_SIZE / 2, this.headHeight + PORT_INITIAL_GAP + PORT_GAP * i);
+ NodeController.getGUI(port).setOffset(offset);
+ }
+
+ PortImpl controlInPort = this.node.getControlInPort();
+ if (controlInPort != null) {
+ Point offset = new Point(0, this.headHeight / 2);
+ NodeController.getGUI(controlInPort).setOffset(offset);
+ }
+
+ // There are two controlOutPorts.
+ List<? extends Port> controlOutPorts = this.node.getControlOutPorts();
+ Port controlOutPort1 = controlOutPorts.get(0);
+ Point offset = new Point(getBounds().width, +this.headHeight / 2);
+ PortGUI truePortGUI = NodeController.getGUI(controlOutPort1);
+ truePortGUI.setOffset(offset);
+ truePortGUI.setPortText("T");
+
+ Port controlOutPort2 = controlOutPorts.get(1);
+ offset = new Point(this.getBounds().width, getBounds().height - this.headHeight / 2);
+ PortGUI falsePortGUI = NodeController.getGUI(controlOutPort2);
+ falsePortGUI.setOffset(offset);
+ falsePortGUI.setPortText("F");
+
+ // No outputs
+ }
+
+ private void calculatePositions() {
+ // Avoid instantiating a new polygon each time.
+ this.polygon.reset();
+ Point position = getPosition();
+ this.polygon.addPoint(position.x, position.y + this.headHeight / 2);
+ this.polygon.addPoint(position.x, position.y + this.dimension.height);
+ this.polygon.addPoint(position.x + this.dimension.width / 2, position.y + this.dimension.height
+ + this.headHeight / 2);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ this.polygon.addPoint(position.x + this.dimension.width / 2, position.y);
+ DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/InputNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/InputNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/InputNodeGUI.java
new file mode 100644
index 0000000..554964c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/InputNodeGUI.java
@@ -0,0 +1,81 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.InputConfigurationDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+
+public class InputNodeGUI extends ConfigurableNodeGUI {
+
+ private static final String CONFIG_AREA_STRING = "Config";
+
+ private static final Color HEAD_COLOR = new Color(153, 204, 255);
+
+ private InputNode inputNode;
+
+ private InputConfigurationDialog configurationWindow;
+
+ /**
+ * @param node
+ */
+ public InputNodeGUI(InputNode node) {
+ super(node);
+ this.inputNode = node;
+ setConfigurationText(CONFIG_AREA_STRING);
+ this.headColor = HEAD_COLOR;
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.inputNode.isConnected()) {
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new InputConfigurationDialog(this.inputNode, xbayaGUI);
+ }
+ this.configurationWindow.show();
+
+ } else {
+ xbayaGUI.getErrorWindow().info(ErrorMessages.INPUT_NOT_CONNECTED_WARNING);
+ }
+ }
+
+ public InputNode getInputNode() {
+ return this.inputNode;
+ }
+
+ protected void setSelectedFlag(boolean flag) {
+ this.selected = flag;
+ if (this.selected) {
+ this.headColor = SELECTED_HEAD_COLOR;
+ } else {
+ this.headColor = HEAD_COLOR;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java
new file mode 100644
index 0000000..0fddcfd
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/MemoNodeGUI.java
@@ -0,0 +1,107 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.airavata.workflow.model.graph.system.MemoNode;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.MemoConfigurationDialog;
+import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
+
+public class MemoNodeGUI extends NodeGUI {
+
+ private static final int BORDER_SIZE = 5;
+
+ private MemoNode node;
+
+ private JTextArea textArea;
+
+ private MemoConfigurationDialog window;
+
+ /**
+ * @param node
+ */
+ public MemoNodeGUI(MemoNode node) {
+ super(node);
+ this.node = node;
+
+ this.textArea = new JTextArea();
+ this.textArea.setBorder(new EmptyBorder(BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.GraphPieceGUI#mouseClicked(java.awt.event.MouseEvent,
+ * org.apache.airavata.xbaya.XBayaEngine)
+ */
+ @Override
+ public void mouseClicked(MouseEvent event, XBayaEngine engine) {
+ if (event.getClickCount() >= 2) {
+ showWindow(engine);
+ }
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#isIn(java.awt.Point)
+ */
+ @Override
+ protected boolean isIn(Point point) {
+ Point position = this.node.getPosition();
+ Dimension preferredSize = this.textArea.getPreferredSize();
+ Rectangle area = new Rectangle(position, preferredSize);
+ return area.contains(point);
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#paint(java.awt.Graphics2D)
+ */
+ @Override
+ protected void paint(Graphics2D g) {
+ Point position = this.node.getPosition();
+ this.textArea.setText(this.node.getMemo());
+ Dimension preferredSize = this.textArea.getPreferredSize();
+ Rectangle bounds = new Rectangle(position.x, position.y, preferredSize.width, preferredSize.height);
+ this.textArea.setBounds(bounds);
+ Graphics graphics = g.create(position.x, position.y, preferredSize.width, preferredSize.height);
+ this.textArea.paint(graphics);
+ }
+
+ /**
+ * @param engine
+ */
+ private void showWindow(XBayaEngine engine) {
+ if (this.window == null) {
+ this.window = new MemoConfigurationDialog(this.node, engine);
+ }
+ this.window.show();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/OutputNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/OutputNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/OutputNodeGUI.java
new file mode 100644
index 0000000..41a0d05
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/OutputNodeGUI.java
@@ -0,0 +1,91 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+import java.net.URL;
+
+import org.apache.airavata.common.utils.BrowserLauncher;
+import org.apache.airavata.workflow.model.graph.system.OutputNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.OutputConfigurationDialog;
+
+public class OutputNodeGUI extends ConfigurableNodeGUI {
+
+ private static final String CONFIG_AREA_STRING = "View";
+
+ private static final Color HEAD_COLOR = new Color(35, 107, 142);
+
+ private OutputNode outputNode;
+
+ private OutputConfigurationDialog configurationWindow;
+
+ /**
+ * @param node
+ */
+ public OutputNodeGUI(OutputNode node) {
+ super(node);
+ this.outputNode = node;
+ setConfigurationText(CONFIG_AREA_STRING);
+ this.headColor = HEAD_COLOR;
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+
+ if (this.node instanceof OutputNode) {
+
+ String description = ((OutputNode) this.node).getDescription();
+ if (null != description) {
+ // try to parse it to a URL and if yes try to open the browser
+ try {
+ description = description.trim();
+ URL url = new URL(description);
+ // no exception -> valid url lets try to open it
+ BrowserLauncher.openURL(url);
+ } catch (Exception e) {
+ // do nothing since this is an optional attempt
+ }
+
+ }
+ }
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new OutputConfigurationDialog(this.outputNode, xbayaGUI);
+ }
+ this.configurationWindow.show();
+
+ }
+
+ protected void setSelectedFlag(boolean flag) {
+ this.selected = flag;
+ if (this.selected) {
+ this.headColor = SELECTED_HEAD_COLOR;
+ } else {
+ this.headColor = HEAD_COLOR;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java
new file mode 100644
index 0000000..390a3d6
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/ReceiveNodeGUI.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.geom.GeneralPath;
+
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Port;
+import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.ReceiveConfigurationDialog;
+import org.apache.airavata.xbaya.ui.utils.DrawUtils;
+
+public class ReceiveNodeGUI extends ConfigurableNodeGUI {
+
+ private ReceiveNode node;
+
+ private Polygon polygon;
+
+ private ReceiveConfigurationDialog configurationDialog;
+
+ private GeneralPath generalPath;
+
+ /**
+ * @param node
+ */
+ public ReceiveNodeGUI(ReceiveNode node) {
+ super(node);
+ this.node = node;
+ this.polygon = new Polygon(); // To avoid null check.
+ generalPath = new GeneralPath();
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.configurationDialog == null) {
+ this.configurationDialog = new ReceiveConfigurationDialog(this.node, xbayaGUI);
+ }
+ this.configurationDialog.show();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#calculatePositions(java.awt.Graphics)
+ */
+ @Override
+ protected void calculatePositions(Graphics g) {
+ super.calculatePositions(g);
+ calculatePositions();
+ setPortPositions();
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#getBounds()
+ */
+ @Override
+ protected Rectangle getBounds() {
+ return this.polygon.getBounds();
+ }
+
+ @Override
+ protected boolean isIn(Point point) {
+ return this.polygon.contains(point);
+ }
+
+ protected Color getComponentHeaderColor() {
+ return headColor;
+ }
+
+ protected String getComponentHeaderText() {
+ return node.getName();
+ }
+
+ protected GeneralPath getComponentHeaderShape() {
+ return DrawUtils.getRoundedShape(createHeader(getPosition()));
+ }
+
+ protected GeneralPath getComponentShape() {
+ return generalPath;
+ }
+
+ protected Node getNode() {
+ return this.node;
+ }
+
+ private Polygon createHeader(Point position) {
+ Polygon head = new Polygon();
+ head.addPoint(position.x, position.y);
+ head.addPoint(position.x, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight);
+ head.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ return head;
+ }
+
+ private void calculatePositions() {
+ this.polygon = new Polygon();
+ Point position = getPosition();
+ this.polygon.addPoint(position.x, position.y);
+ this.polygon.addPoint(position.x, position.y + this.dimension.height + this.headHeight / 2);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.dimension.height);
+ this.polygon.addPoint(position.x + this.dimension.width, position.y + this.headHeight / 2);
+ DrawUtils.setupRoundedGeneralPath(polygon, getComponentShape());
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.NodeGUI#setPortPositions()
+ */
+ @Override
+ protected void setPortPositions() {
+ super.setPortPositions();
+
+ for (Port controlOutPort : this.node.getControlOutPorts()) {
+ NodeController.getGUI(controlOutPort).setOffset(new Point(getBounds().width, getBounds().height - this.headHeight / 2));
+ break; // Has only one
+ }
+
+ Port port = this.node.getEPRPort();
+ NodeController.getGUI(port).setOffset(new Point(getBounds().width / 2, this.headHeight / 4));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/S3InputNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/S3InputNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/S3InputNodeGUI.java
new file mode 100644
index 0000000..6b00f68
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/S3InputNodeGUI.java
@@ -0,0 +1,81 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+
+import org.apache.airavata.workflow.model.graph.system.S3InputNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.S3FileChooser;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+
+public class S3InputNodeGUI extends ConfigurableNodeGUI {
+
+ private static final String CONFIG_AREA_STRING = "Config";
+
+ private static final Color HEAD_COLOR = new Color(153, 204, 255);
+
+ private S3InputNode inputNode;
+
+ private S3FileChooser s3FileChooser;
+
+ /**
+ * @param node
+ */
+ public S3InputNodeGUI(S3InputNode node) {
+ super(node);
+ this.inputNode = node;
+ setConfigurationText(CONFIG_AREA_STRING);
+ this.headColor = HEAD_COLOR;
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+
+ if (!this.inputNode.isConnected()) {
+ xbayaGUI.getErrorWindow().info(ErrorMessages.INPUT_NOT_CONNECTED_WARNING);
+ } else {
+ if (this.s3FileChooser == null) {
+ this.s3FileChooser = new S3FileChooser(xbayaGUI, this.inputNode);
+ }
+ this.s3FileChooser.show();
+ }
+ }
+
+ public S3InputNode getInputNode() {
+ return this.inputNode;
+ }
+
+ protected void setSelectedFlag(boolean flag) {
+ this.selected = flag;
+ if (this.selected) {
+ this.headColor = SELECTED_HEAD_COLOR;
+ } else {
+ this.headColor = HEAD_COLOR;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/StreamSourceNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/StreamSourceNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/StreamSourceNodeGUI.java
new file mode 100644
index 0000000..d0b7c48
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/system/StreamSourceNodeGUI.java
@@ -0,0 +1,73 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.system;
+
+import java.awt.Color;
+
+import org.apache.airavata.workflow.model.graph.system.StreamSourceNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.system.StreamSourceConfigurationDialog;
+
+public class StreamSourceNodeGUI extends ConfigurableNodeGUI {
+
+ private static Color HEAD_COLOR = Color.BLUE;
+
+ private static final String CONFIG_AREA_STRING = "Config";
+
+ private StreamSourceNode inputNode;
+
+ private StreamSourceConfigurationDialog configurationWindow;
+
+ /**
+ * @param node
+ */
+ public StreamSourceNodeGUI(StreamSourceNode node) {
+ super(node);
+
+ this.inputNode = node;
+ setConfigurationText(CONFIG_AREA_STRING);
+ headColor = HEAD_COLOR;
+ }
+
+ /**
+ * Shows a configuration window when a user click the configuration area.
+ *
+ * @param engine
+ */
+ @Override
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI) {
+ if (this.configurationWindow == null) {
+ this.configurationWindow = new StreamSourceConfigurationDialog(this.inputNode, xbayaGUI);
+ }
+ this.configurationWindow.show();
+ }
+
+ protected void setSelectedFlag(boolean flag) {
+ this.selected = flag;
+ if (this.selected) {
+ this.headColor = SELECTED_HEAD_COLOR;
+ } else {
+ this.headColor = HEAD_COLOR;
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WSNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WSNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WSNodeGUI.java
new file mode 100644
index 0000000..0dbed32
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WSNodeGUI.java
@@ -0,0 +1,156 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.ws;
+
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.apache.airavata.ws.monitor.Monitor;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.graph.ws.ServiceInteractionWindow;
+import org.apache.airavata.xbaya.ui.dialogs.graph.ws.WSNodeWindow;
+import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WSNodeGUI extends NodeGUI {
+
+ private final static Logger logger = LoggerFactory.getLogger(WSNodeGUI.class);
+
+ private WSNode node;
+
+ private WSNodeWindow window;
+
+ protected static final Color CONFIG_AREA_COLOR = new Color(220, 220, 220);
+
+ protected static final String DEFAULT_CONFIG_AREA_TEXT = "Interact";
+
+ protected static final int CONFIG_AREA_GAP_X = 20;
+
+ protected String configurationText = DEFAULT_CONFIG_AREA_TEXT;
+
+ protected Rectangle configurationArea;
+
+ private boolean interactiveMode;
+
+ /**
+ * Creates a WsNodeGui
+ *
+ * @param node
+ */
+ public WSNodeGUI(WSNode node) {
+ super(node);
+ this.node = node;
+ this.configurationArea = new Rectangle();
+ }
+
+ private void showWindow(XBayaEngine engine) {
+ if (this.window == null) {
+ this.window = new WSNodeWindow(engine, this.node);
+ }
+ this.window.show();
+ }
+
+ protected void showConfigurationDialog(XBayaGUI xbayaGUI, Monitor monitor) {
+ new ServiceInteractionWindow(xbayaGUI, this.node.getID(),monitor).show();
+
+ }
+
+ protected void calculatePositions(Graphics g) {
+ super.calculatePositions(g);
+
+ Point position = this.node.getPosition();
+ FontMetrics fm = g.getFontMetrics();
+
+ if (this.interactiveMode && isInteractable()) {
+ this.configurationArea.height = fm.getHeight() + TEXT_GAP_Y * 2;
+ // it only need to say interact and the rest of the are should be
+ // available for double clicking
+ this.configurationArea.width = 50;
+ this.configurationArea.x = position.x + CONFIG_AREA_GAP_X;
+ this.configurationArea.y = position.y + this.headHeight
+ + (this.dimension.height - this.headHeight - this.configurationArea.height) / 2;
+ } else {
+ this.configurationArea.height = 0;
+ this.configurationArea.width = 0;
+ }
+
+ }
+
+ public void mouseClicked(MouseEvent event, XBayaEngine engine) {
+ if (event.getClickCount() >= 2) {
+ showWindow(engine);
+ } else if (this.interactiveMode && (isInteractable()) && isInConfig(event.getPoint())) {
+ showConfigurationDialog(engine.getGUI(),engine.getMonitor());
+ }
+ }
+
+ private boolean isInteractable() {
+ return this.bodyColor == NodeState.EXECUTING.color || this.bodyColor == NodeState.FAILED.color
+ || this.bodyColor == NodeState.FINISHED.color;
+ }
+
+ /**
+ * Paints the config area
+ *
+ * @param g
+ */
+ @Override
+ protected void paint(Graphics2D g) {
+ super.paint(g);
+ if (isInteractable()) {
+ paintConfiguration(g);
+ }
+ }
+
+ protected void paintConfiguration(Graphics2D g) {
+ g.setColor(CONFIG_AREA_COLOR);
+ g.fill(this.configurationArea);
+ g.setColor(TEXT_COLOR);
+ g.drawString(this.configurationText, this.configurationArea.x + TEXT_GAP_X, this.configurationArea.y
+ + this.configurationArea.height - TEXT_GAP_Y);
+ }
+
+ /**
+ * Checks if a user's click is to select the configuration
+ *
+ * @param point
+ * @return true if the user's click is to select the node, false otherwise
+ */
+ @Override
+ protected boolean isInConfig(Point point) {
+ return this.configurationArea.contains(point);
+ }
+
+ public void setInteractiveMode(boolean mode) {
+ this.interactiveMode = mode;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WorkflowNodeGUI.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WorkflowNodeGUI.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WorkflowNodeGUI.java
new file mode 100644
index 0000000..08a628d
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/graph/ws/WorkflowNodeGUI.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.graph.ws;
+
+import java.awt.event.MouseEvent;
+
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.ws.WorkflowNode;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.graph.NodeGUI;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WorkflowNodeGUI extends NodeGUI {
+
+ private final static Logger logger = LoggerFactory.getLogger(WorkflowNodeGUI.class);
+
+ private WorkflowNode node;
+
+ /**
+ * Creates a WsNodeGui
+ *
+ * @param node
+ */
+ public WorkflowNodeGUI(WorkflowNode node) {
+ super(node);
+ this.node = node;
+ }
+
+ /**
+ * @see org.apache.airavata.xbaya.ui.graph.GraphPieceGUI#mouseClicked(java.awt.event.MouseEvent,
+ * org.apache.airavata.xbaya.XBayaEngine)
+ */
+ @Override
+ public void mouseClicked(MouseEvent event, XBayaEngine engine) {
+ logger.debug(event.toString());
+ if (event.getClickCount() >= 2) {
+ openWorkflowTab(engine);
+ }
+ }
+
+ public void openWorkflowTab(XBayaEngine engine) {
+ try {
+ Workflow workflow = this.node.getComponent().getWorkflow();
+ engine.getGUI().selectOrCreateGraphCanvas(workflow);
+ } catch (GraphException e) {
+ engine.getGUI().getErrorWindow().error(ErrorMessages.GRAPH_FORMAT_ERROR, e);
+ } catch (ComponentException e) {
+ engine.getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java
new file mode 100644
index 0000000..1e4acfb
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/AmazonEC2MenuItem.java
@@ -0,0 +1,160 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+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;
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/EditMenuItem.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/EditMenuItem.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/EditMenuItem.java
new file mode 100644
index 0000000..05b6d90
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/EditMenuItem.java
@@ -0,0 +1,169 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.menues;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.dialogs.descriptors.DescriptorEditorDialog;
+import org.apache.airavata.xbaya.ui.dialogs.descriptors.DescriptorEditorDialog.DescriptorType;
+import org.apache.airavata.xbaya.ui.dialogs.workflow.ParameterPropertyWindow;
+import org.apache.airavata.xbaya.ui.dialogs.workflow.WorkflowPropertyWindow;
+import org.apache.airavata.xbaya.util.XBayaUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class EditMenuItem {
+
+ private XBayaEngine engine;
+
+ private JMenu editMenu;
+
+ private JMenuItem workflowDescriptionItem;
+
+ private JMenuItem parameterReorderingItem;
+
+ private JMenuItem editHostDescription;
+
+ private JMenuItem editServiceDescription;
+
+ private JMenuItem editApplicationDescription;
+
+ private static final Logger logger = LoggerFactory.getLogger(EditMenuItem.class);
+
+ /**
+ * Constructs a WorkflowMenu.
+ *
+ * @param engine
+ */
+ public EditMenuItem(XBayaEngine engine) {
+ this.engine = engine;
+ createWorkflowMenu();
+ }
+
+ /**
+ * @return The workflow menu.
+ */
+ public JMenu getMenu() {
+ return this.editMenu;
+ }
+
+ /**
+ * Creates workflow menu.
+ */
+ private void createWorkflowMenu() {
+ this.workflowDescriptionItem = createWorkflowDescriptionItem();
+ this.parameterReorderingItem = createParameterReorderingItem();
+
+ editHostDescription = createEditHostDescription();
+ editServiceDescription = createEditServiceDescription();
+ editApplicationDescription = createEditApplicationDescription();
+
+ editMenu = new JMenu("Edit");
+ editMenu.setMnemonic(KeyEvent.VK_E);
+
+ editMenu.add(this.workflowDescriptionItem);
+ editMenu.add(this.parameterReorderingItem);
+
+ editMenu.addSeparator();
+
+ editMenu.add(editHostDescription);
+ editMenu.add(editServiceDescription);
+// editMenu.add(editApplicationDescription);
+ }
+
+ private JMenuItem createWorkflowDescriptionItem() {
+ JMenuItem menuItem = new JMenuItem("Workflow Properties...");
+ menuItem.setMnemonic(KeyEvent.VK_W);
+ menuItem.addActionListener(new AbstractAction() {
+ private WorkflowPropertyWindow window;
+
+ public void actionPerformed(ActionEvent e) {
+ if (this.window == null) {
+ this.window = engine.getGUI().getWorkflowPropertyWindow();
+ }
+ this.window.show();
+ }
+ });
+ return menuItem;
+ }
+
+ private JMenuItem createParameterReorderingItem() {
+ JMenuItem menuItem = new JMenuItem("Parameter Properties...");
+ menuItem.setMnemonic(KeyEvent.VK_P);
+ menuItem.addActionListener(new AbstractAction() {
+ private ParameterPropertyWindow window;
+
+ public void actionPerformed(ActionEvent e) {
+ if (this.window == null) {
+ this.window = new ParameterPropertyWindow(EditMenuItem.this.engine);
+ }
+ this.window.show();
+ }
+ });
+ return menuItem;
+ }
+
+ private JMenuItem createEditHostDescription() {
+ JMenuItem menuItem = new JMenuItem("Hosts...");
+ menuItem.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ if (XBayaUtil.acquireJCRRegistry(engine)) {
+ DescriptorEditorDialog dialog = new DescriptorEditorDialog(engine,DescriptorType.HOST);
+ dialog.show();
+ }
+ }
+ });
+ return menuItem;
+ }
+
+ private JMenuItem createEditServiceDescription() {
+ JMenuItem menuItem = new JMenuItem("Applications...");
+ menuItem.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ if (XBayaUtil.acquireJCRRegistry(engine)) {
+ DescriptorEditorDialog dialog = new DescriptorEditorDialog(engine,DescriptorType.SERVICE);
+ dialog.show();
+ }
+ }
+ });
+ return menuItem;
+ }
+
+ private JMenuItem createEditApplicationDescription() {
+ JMenuItem menuItem = new JMenuItem("Application Descriptions...");
+ menuItem.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ if (XBayaUtil.acquireJCRRegistry(engine)) {
+ DescriptorEditorDialog dialog = new DescriptorEditorDialog(engine,DescriptorType.APPLICATION);
+ dialog.show();
+ }
+ }
+ });
+ return menuItem;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/MenuIcons.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/MenuIcons.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/MenuIcons.java
new file mode 100644
index 0000000..7b9ffe6
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/MenuIcons.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.menues;
+
+import javax.swing.ImageIcon;
+
+import org.apache.airavata.common.utils.SwingUtil;
+
+public class MenuIcons {
+ public static final ImageIcon OPEN_ICON = SwingUtil.createImageIcon("menu/open1.png");
+ public static final ImageIcon OPEN_DIR_ICON = SwingUtil.createImageIcon("menu/open_dir.png");
+ public static final ImageIcon SAVE_ICON = SwingUtil.createImageIcon("menu/save1.png");
+ public static final ImageIcon NEW_ICON = SwingUtil.createImageIcon("menu/new2.png");
+
+ public static final ImageIcon RUN_ICON = SwingUtil.createImageIcon("menu/play4.png");
+ public static final ImageIcon STOP_ICON = SwingUtil.createImageIcon("menu/stop.png");
+ public static final ImageIcon MONITOR_PAUSE_ICON = SwingUtil.createImageIcon("menu/pause_monitor1.png");
+ public static final ImageIcon MONITOR_RESUME_ICON = SwingUtil.createImageIcon("menu/resume_monitoring1.png");;
+ public static final ImageIcon JCR_ICON = SwingUtil.createImageIcon("jcr-repo.png");;
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RegistryMenuItem.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RegistryMenuItem.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RegistryMenuItem.java
new file mode 100644
index 0000000..94f2888
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/menues/RegistryMenuItem.java
@@ -0,0 +1,118 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.menues;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.XBayaConfiguration.XBayaExecutionMode;
+import org.apache.airavata.xbaya.core.ide.XBayaExecutionModeListener;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.widgets.ToolbarButton;
+import org.apache.airavata.xbaya.ui.widgets.XBayaToolBar;
+import org.apache.airavata.xbaya.util.XBayaUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RegistryMenuItem implements XBayaExecutionModeListener {
+
+ private static final String REGISTRY_ACTIONS = "registry_actions";
+
+ private XBayaEngine engine;
+
+ private JMenu registryMenu;
+
+ private JMenuItem jcrRegistryItem;
+
+ private static final Logger logger = LoggerFactory.getLogger(RegistryMenuItem.class);
+
+ private XBayaToolBar toolBar;
+
+ private ToolbarButton toolbarButtonJCR;
+
+ /**
+ * Constructs a WorkflowMenu.
+ *
+ * @param engine
+ */
+ public RegistryMenuItem(XBayaEngine engine, XBayaToolBar toolBar) {
+ this.engine = engine;
+ setToolBar(toolBar);
+ createWorkflowMenu();
+ engine.getConfiguration().registerExecutionModeChangeListener(this);
+ }
+
+ /**
+ * @return The workflow menu.
+ */
+ public JMenu getMenu() {
+ return this.registryMenu;
+ }
+
+ /**
+ * Creates workflow menu.
+ */
+ private void createWorkflowMenu() {
+ this.jcrRegistryItem = createJCRRegistryItem();
+
+ registryMenu = new JMenu("Registry");
+ registryMenu.setMnemonic(KeyEvent.VK_G);
+
+ registryMenu.add(this.jcrRegistryItem);
+ executionModeChanged(engine.getConfiguration());
+
+ }
+
+ private JMenuItem createJCRRegistryItem() {
+ JMenuItem item = new JMenuItem("Setup Airavata Registry...",MenuIcons.JCR_ICON);
+ item.setMnemonic(KeyEvent.VK_J);
+ AbstractAction action = new AbstractAction() {
+
+ public void actionPerformed(ActionEvent e) {
+ XBayaEngine xbayaEngine = engine;
+ XBayaUtil.updateJCRRegistryInfo(xbayaEngine);
+ }
+
+ };
+ item.addActionListener(action);
+ toolbarButtonJCR = getToolBar().addToolbarButton(REGISTRY_ACTIONS, item.getText(), MenuIcons.JCR_ICON, item.getText(), action, 1);
+ return item;
+ }
+
+ public XBayaToolBar getToolBar() {
+ return toolBar;
+ }
+
+ public void setToolBar(XBayaToolBar toolBar) {
+ this.toolBar = toolBar;
+ }
+
+ @Override
+ public void executionModeChanged(XBayaConfiguration config) {
+ toolbarButtonJCR.setVisible(config.getXbayaExecutionMode()==XBayaExecutionMode.IDE);
+ }
+}
\ No newline at end of file