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:04 UTC
[62/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/dialogs/graph/system/DifferedInputConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java
new file mode 100644
index 0000000..8b075c4
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DifferedInputConfigurationDialog.java
@@ -0,0 +1,263 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
+import org.apache.airavata.workflow.model.graph.system.DifferedInputNode;
+import org.apache.airavata.xbaya.graph.controller.NodeController;
+import org.apache.airavata.xbaya.lead.LEADTypes;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.graph.system.DifferedInputNodeGUI;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.xmlpull.infoset.XmlElement;
+
+public class DifferedInputConfigurationDialog {
+ private XBayaGUI xbayaGUI;
+
+ private DifferedInputNode node;
+
+ private XBayaDialog dialog;
+
+ private GridPanel gridPanel;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextArea descriptionTextArea;
+
+ private XBayaLabel valueLabel;
+
+ private XBayaTextField valueTextField;
+
+ private XBayaTextArea valueTextArea;
+
+ private XBayaTextArea metadataTextArea;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public DifferedInputConfigurationDialog(DifferedInputNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ public void show() {
+ QName type = this.node.getParameterType();
+ XBayaTextComponent textComponent;
+ boolean knownType = LEADTypes.isKnownType(type);
+ if (knownType) {
+ textComponent = this.valueTextField;
+ this.valueLabel.setText("Default value");
+ } else {
+ textComponent = this.valueTextArea;
+ this.valueLabel.setText("Default value (in XML)");
+ }
+ this.valueLabel.setLabelFor(textComponent);
+ final int index = 5;
+ this.gridPanel.remove(index);
+ this.gridPanel.add(textComponent, index);
+ if (knownType) {
+ this.gridPanel.layout(new double[] { 0, 1.0 / 2, 0, 1.0 / 2 },
+ new double[] { 0, 1 });
+ } else {
+ this.gridPanel.layout(
+ new double[] { 0, 1.0 / 3, 1.0 / 3, 1.0 / 3 },
+ new double[] { 0, 1 });
+ }
+
+ // String name = this.node.getConfiguredName();
+ // if (name == null) {
+ // name = this.node.getName();
+ // }
+ String name = this.node.getID(); // Show ID.
+ this.nameTextField.setText(name);
+
+ this.descriptionTextArea.setText(this.node.getDescription());
+ Object value = this.node.getDefaultValue();
+ String valueString;
+ if (value == null) {
+ valueString = "";
+ } else if (value instanceof XmlElement) {
+ valueString = XMLUtil.xmlElementToString((XmlElement) value);
+ } else {
+ valueString = value.toString();
+ }
+ textComponent.setText(valueString);
+ XmlElement metadata = this.node.getMetadata();
+ String metadataText;
+ if (metadata == null) {
+ metadataText = WSConstants.EMPTY_APPINFO;
+ } else {
+ metadataText = XMLUtil.xmlElementToString(metadata);
+ }
+ this.metadataTextArea.setText(metadataText);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+
+ this.dialog.hide();
+ ((DifferedInputNodeGUI)NodeController.getGUI(this.node)).closingDisplay();
+ }
+
+ private void setInput() {
+ QName type = this.node.getParameterType();
+ XBayaTextComponent textComponent;
+ if (LEADTypes.isKnownType(type)) {
+ textComponent = this.valueTextField;
+ } else {
+ textComponent = this.valueTextArea;
+ }
+
+ String name = this.nameTextField.getText();
+ String description = this.descriptionTextArea.getText();
+ String valueString = textComponent.getText();
+ String metadataText = this.metadataTextArea.getText();
+
+ if (name.length() == 0) {
+ String warning = "The name cannot be empty.";
+ this.xbayaGUI.getErrorWindow().error(warning);
+ return;
+ }
+ Object value = null;
+ if (valueString.length() > 0) {
+ if (LEADTypes.isKnownType(type)) {
+ if (!this.node.isInputValid(valueString)) {
+ String warning = "The defalut value is not valid for "
+ + this.node.getParameterType() + ".";
+ this.xbayaGUI.getErrorWindow().error(warning);
+ }
+ value = valueString;
+ } else {
+ try {
+ value = XMLUtil.stringToXmlElement(valueString);
+ } catch (RuntimeException e) {
+ String warning = "The XML for the default value is not valid.";
+ this.xbayaGUI.getErrorWindow().error(warning, e);
+ }
+ }
+ }
+ XmlElement metadata;
+ if (metadataText.length() == 0) {
+ metadata = null;
+ } else {
+ try {
+ metadata = XMLUtil.stringToXmlElement(metadataText);
+ } catch (RuntimeException e) {
+ String warning = "The metadata is ill-formed.";
+ this.xbayaGUI.getErrorWindow().error(warning, e);
+ return;
+ }
+ }
+
+ this.node.setConfigured(true);
+ this.node.setConfiguredName(name);
+ this.node.setDescription(description);
+ this.node.setDefaultValue(value);
+ this.node.setMetadata(metadata);
+ this.node.setState(NodeExecutionState.FINISHED);
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.descriptionTextArea = new XBayaTextArea();
+ XBayaLabel descriptionLabel = new XBayaLabel("Description",
+ this.descriptionTextArea);
+
+ this.valueTextField = new XBayaTextField(); // for string
+ this.valueTextArea = new XBayaTextArea(); // for XML
+ // temporaly set text field.
+ this.valueLabel = new XBayaLabel("", this.valueTextField);
+
+ this.metadataTextArea = new XBayaTextArea();
+ XBayaLabel metadataLabel = new XBayaLabel("Metadata",
+ this.metadataTextArea);
+
+ this.gridPanel = new GridPanel();
+ this.gridPanel.add(nameLabel);
+ this.gridPanel.add(this.nameTextField);
+ this.gridPanel.add(descriptionLabel);
+ this.gridPanel.add(this.descriptionTextArea);
+ this.gridPanel.add(this.valueLabel);
+ this.gridPanel.add(this.valueTextField);
+ this.gridPanel.add(metadataLabel);
+ this.gridPanel.add(this.metadataTextArea);
+ this.gridPanel.layout(4, 2, 3, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI,
+ "Input Parameter Configuration", this.gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+
+}
\ 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/dialogs/graph/system/DoWhileConfigrationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DoWhileConfigrationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DoWhileConfigrationDialog.java
new file mode 100644
index 0000000..7093445
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/DoWhileConfigrationDialog.java
@@ -0,0 +1,189 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+
+public class DoWhileConfigrationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private DoWhileNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ private XBayaTextField xpathTextField;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public DoWhileConfigrationDialog(DoWhileNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI = xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+ int number = this.node.getInputPorts().size();
+ this.numPorts.setValue(number);
+ String xpath = this.node.getXpath();
+ this.xpathTextField.setText(xpath);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ String xpathString = this.xpathTextField.getText();
+
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getInputPorts().size();
+ try {
+ if (number < 2){
+ this.xbayaGUI.getErrorWindow().error("Number of inputs can't be less than 2");
+ }
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addInputPort();
+ this.node.addOutputPort();
+ }
+ } else if (number >= 2 && number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeInputPort();
+ this.node.removeOutputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ if (xpathString.length() == 0) {
+ String warning = "XPath cannot be empty.";
+// this.engine.getErrorWindow().error(warning);
+ return;
+ }
+
+ this.node.setXpath(xpathString);
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Inputs", this.numPorts);
+
+ this.xpathTextField = new XBayaTextField();
+ XBayaLabel xpathLabel = new XBayaLabel("XPath", this.xpathTextField);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.add(xpathLabel);
+ gridPanel.add(this.xpathTextField);
+ gridPanel.layout(4, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(xbayaGUI, "While Configuration", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndBlockConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndBlockConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndBlockConfigurationDialog.java
new file mode 100644
index 0000000..b246569
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndBlockConfigurationDialog.java
@@ -0,0 +1,163 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.EndBlockNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class EndBlockConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private EndBlockNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public EndBlockConfigurationDialog(EndBlockNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+ int number = this.node.getOutputPorts().size();
+ this.numPorts.setValue(number);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getOutputPorts().size();
+ try {
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addOutputPort();
+ this.node.addInputPort();
+ this.node.addInputPort();
+ }
+ } else if (number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeOutputPort();
+ this.node.removeInputPort();
+ this.node.removeInputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Parameters", this.numPorts);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "Endif Configuration", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+}
\ 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/dialogs/graph/system/EndDoWhileConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndDoWhileConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndDoWhileConfigurationDialog.java
new file mode 100644
index 0000000..4002fca
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndDoWhileConfigurationDialog.java
@@ -0,0 +1,172 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class EndDoWhileConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private EndDoWhileNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public EndDoWhileConfigurationDialog(EndDoWhileNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI = xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+
+ int number = this.node.getOutputPorts().size();
+ this.numPorts.setValue(number);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getOutputPorts().size();
+ try {
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addOutputPort();
+ this.node.addInputPort();
+ }
+ } else if (number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeOutputPort();
+ this.node.removeInputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR,
+ e);
+ }
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1,
+ Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Parameters",
+ this.numPorts);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(xbayaGUI, "EndDoWhile Configuration",gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+
+}
+
+
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndForEachConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndForEachConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndForEachConfigurationDialog.java
new file mode 100644
index 0000000..03ded0b
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndForEachConfigurationDialog.java
@@ -0,0 +1,161 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class EndForEachConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private EndForEachNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public EndForEachConfigurationDialog(EndForEachNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+ int number = this.node.getInputPorts().size();
+ this.numPorts.setValue(number);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getOutputPorts().size();
+ try {
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addInputPort();
+ this.node.addOutputPort();
+ }
+ } else if (number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeInputPort();
+ this.node.removeOutputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Parameters", this.numPorts);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "EndForEach Configuration", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+}
\ 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/dialogs/graph/system/EndifConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndifConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndifConfigurationDialog.java
new file mode 100644
index 0000000..db075ee
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/EndifConfigurationDialog.java
@@ -0,0 +1,163 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class EndifConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private EndifNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public EndifConfigurationDialog(EndifNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+ int number = this.node.getOutputPorts().size();
+ this.numPorts.setValue(number);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getOutputPorts().size();
+ try {
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addOutputPort();
+ this.node.addInputPort();
+ this.node.addInputPort();
+ }
+ } else if (number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeOutputPort();
+ this.node.removeInputPort();
+ this.node.removeInputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Parameters", this.numPorts);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "Endif Configuration", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+}
\ 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/dialogs/graph/system/ForEachConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ForEachConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ForEachConfigurationDialog.java
new file mode 100644
index 0000000..a2c699a
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ForEachConfigurationDialog.java
@@ -0,0 +1,161 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.ForEachNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class ForEachConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private ForEachNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public ForEachConfigurationDialog(ForEachNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+ int number = this.node.getInputPorts().size();
+ this.numPorts.setValue(number);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getOutputPorts().size();
+ try {
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addInputPort();
+ this.node.addOutputPort();
+ }
+ } else if (number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeInputPort();
+ this.node.removeOutputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Parameters", this.numPorts);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "ForEach Configuration", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+}
\ 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/dialogs/graph/system/IfConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/IfConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/IfConfigurationDialog.java
new file mode 100644
index 0000000..2de7a12
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/IfConfigurationDialog.java
@@ -0,0 +1,190 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.IfNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class IfConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private IfNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ private XBayaTextField xpathTextField;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public IfConfigurationDialog(IfNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI = xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+ int number = this.node.getInputPorts().size();
+ this.numPorts.setValue(number);
+ String xpath = this.node.getXPath();
+ this.xpathTextField.setText(xpath);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ String xpathString = this.xpathTextField.getText();
+
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getInputPorts().size();
+ try {
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addInputPort();
+ }
+ } else if (number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeInputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ if (xpathString.length() == 0) {
+ String warning = "XPath cannot be empty.";
+ this.xbayaGUI.getErrorWindow().error(warning);
+ return;
+ }
+ // Check if it's a valid XPath.
+ // We need to replace $1, $2 to something neutral and evaluate it as
+ // XPath.
+
+ // XPath xpath;
+ // try {
+ // xpath = new XisXPath(xpathString);
+ // } catch (RuntimeException e) {
+ // String warning = "XPath is in wrong format.";
+ // this.xbayaGUI.getErrorWindow().error(warning, e);
+ // return;
+ // }
+ this.node.setXPath(xpathString);
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Inputs", this.numPorts);
+
+ this.xpathTextField = new XBayaTextField();
+ XBayaLabel xpathLabel = new XBayaLabel("XPath", this.xpathTextField);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.add(xpathLabel);
+ gridPanel.add(this.xpathTextField);
+ gridPanel.layout(4, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "If Configuration", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+
+}
\ 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/dialogs/graph/system/InputConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java
new file mode 100644
index 0000000..03130be
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/InputConfigurationDialog.java
@@ -0,0 +1,261 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.xbaya.lead.LEADTypes;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.xmlpull.infoset.XmlElement;
+
+public class InputConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private InputNode node;
+
+ private XBayaDialog dialog;
+
+ private GridPanel gridPanel;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextArea descriptionTextArea;
+
+ private XBayaLabel valueLabel;
+
+ private XBayaTextField valueTextField;
+
+ private XBayaTextArea valueTextArea;
+
+ private XBayaTextArea metadataTextArea;
+
+ private XBayaTextField visibilityTextField;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public InputConfigurationDialog(InputNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ public void show() {
+ QName type = this.node.getParameterType();
+ XBayaTextComponent textComponent;
+ boolean knownType = LEADTypes.isKnownType(type);
+ if (knownType) {
+ textComponent = this.valueTextField;
+ this.valueLabel.setText("Default value");
+ } else {
+ textComponent = this.valueTextArea;
+ this.valueLabel.setText("Default value (in XML)");
+ }
+ this.valueLabel.setLabelFor(textComponent);
+ final int index = 7;
+ this.gridPanel.remove(index);
+ this.gridPanel.add(textComponent, index);
+ if (knownType) {
+ this.gridPanel.layout(new double[] { 0, 1.0 / 2,0, 0, 1.0 / 2 }, new double[] { 0, 1 });
+ } else {
+ this.gridPanel.layout(new double[] { 0, 1.0 / 3,0, 1.0 / 3, 1.0 / 3 }, new double[] { 0, 1 });
+ }
+
+ String name = this.node.getID(); // Show ID.
+ this.nameTextField.setText(name);
+
+ String visibility = Boolean.toString(this.node.isVisibility());
+ this.visibilityTextField.setText(visibility);
+
+ this.descriptionTextArea.setText(this.node.getDescription());
+ Object value = this.node.getDefaultValue();
+ String valueString;
+ if (value == null) {
+ valueString = "";
+ } else if (value instanceof XmlElement) {
+ valueString = XMLUtil.xmlElementToString((XmlElement) value);
+ } else {
+ valueString = value.toString();
+ }
+ if (knownType) {
+ this.valueTextField.setText(valueString);
+ } else {
+ this.valueTextArea.setText(valueString);
+ }
+ textComponent.setText(valueString);
+ XmlElement metadata = this.node.getMetadata();
+ String metadataText;
+ if (metadata == null) {
+ metadataText = WSConstants.EMPTY_APPINFO;
+ } else {
+ metadataText = XMLUtil.xmlElementToString(metadata);
+ }
+ this.metadataTextArea.setText(metadataText);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ QName type = this.node.getParameterType();
+ XBayaTextComponent textComponent;
+ if (LEADTypes.isKnownType(type)) {
+ textComponent = this.valueTextField;
+ } else {
+ textComponent = this.valueTextArea;
+ }
+
+ String name = this.nameTextField.getText();
+ String description = this.descriptionTextArea.getText();
+ String valueString = textComponent.getText();
+ String metadataText = this.metadataTextArea.getText();
+ String visibilityText = this.visibilityTextField.getText();
+
+ if (name.length() == 0) {
+ String warning = "The name cannot be empty.";
+ this.xbayaGUI.getErrorWindow().error(warning);
+ return;
+ }
+ Object value = null;
+ if (valueString.length() > 0) {
+ if (LEADTypes.isKnownType(type)) {
+ if (!this.node.isInputValid(valueString)) {
+ String warning = "The defalut value is not valid for " + this.node.getParameterType() + ".";
+ this.xbayaGUI.getErrorWindow().error(warning);
+ }
+ value = valueString;
+ } else {
+ try {
+ value = XMLUtil.stringToXmlElement(valueString);
+ } catch (RuntimeException e) {
+ String warning = "The XML for the default value is not valid.";
+ this.xbayaGUI.getErrorWindow().error(warning, e);
+ }
+ }
+ }
+ XmlElement metadata;
+ if (metadataText.length() == 0) {
+ metadata = null;
+ } else {
+ try {
+ metadata = XMLUtil.stringToXmlElement(metadataText);
+ } catch (RuntimeException e) {
+ String warning = "The metadata is ill-formed.";
+ this.xbayaGUI.getErrorWindow().error(warning, e);
+ return;
+ }
+ }
+
+ this.node.setConfigured(true);
+ this.node.setConfiguredName(name);
+ this.node.setDescription(description);
+ this.node.setDefaultValue(value);
+ this.node.setMetadata(metadata);
+ this.node.setVisibility(Boolean.parseBoolean(visibilityText));
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.descriptionTextArea = new XBayaTextArea();
+ XBayaLabel descriptionLabel = new XBayaLabel("Description", this.descriptionTextArea);
+
+ this.valueTextField = new XBayaTextField(); // for string
+ this.valueTextArea = new XBayaTextArea(); // for XML
+ // temporaly set text field.
+ this.valueLabel = new XBayaLabel("", this.valueTextField);
+
+ this.metadataTextArea = new XBayaTextArea();
+ XBayaLabel metadataLabel = new XBayaLabel("Metadata", this.metadataTextArea);
+
+ this.visibilityTextField = new XBayaTextField();
+ XBayaLabel visibilityLabel = new XBayaLabel("Visibility", this.visibilityTextField);
+
+ this.gridPanel = new GridPanel();
+ this.gridPanel.add(nameLabel);
+ this.gridPanel.add(this.nameTextField);
+ this.gridPanel.add(visibilityLabel);
+ this.gridPanel.add(this.visibilityTextField);
+ this.gridPanel.add(descriptionLabel);
+ this.gridPanel.add(this.descriptionTextArea);
+ this.gridPanel.add(this.valueLabel);
+ this.gridPanel.add(this.valueTextField);
+ this.gridPanel.add(metadataLabel);
+ this.gridPanel.add(this.metadataTextArea);
+ this.gridPanel.layout(5, 2, 3, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "Input Parameter Configuration", this.gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+
+}
\ 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/dialogs/graph/system/MemoConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/MemoConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/MemoConfigurationDialog.java
new file mode 100644
index 0000000..651492e
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/MemoConfigurationDialog.java
@@ -0,0 +1,115 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.apache.airavata.workflow.model.graph.system.MemoNode;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+
+public class MemoConfigurationDialog {
+
+ private XBayaEngine engine;
+
+ private MemoNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextArea memoTextArea;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public MemoConfigurationDialog(MemoNode node, XBayaEngine engine) {
+ this.engine = engine;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ public void show() {
+ this.memoTextArea.setText(this.node.getMemo());
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ String memo = this.memoTextArea.getText();
+ this.node.setMemo(memo);
+ hide();
+ this.engine.getGUI().getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.memoTextArea = new XBayaTextArea();
+ XBayaLabel memoLabel = new XBayaLabel("Memo", this.memoTextArea);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(memoLabel);
+ gridPanel.add(this.memoTextArea);
+ gridPanel.layout(1, 2, 0, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.engine.getGUI(), "Memo", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+
+}
\ 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/dialogs/graph/system/OutputConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/OutputConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/OutputConfigurationDialog.java
new file mode 100644
index 0000000..a3c063e
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/OutputConfigurationDialog.java
@@ -0,0 +1,172 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+
+import org.apache.airavata.common.utils.WSConstants;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.airavata.workflow.model.graph.system.OutputNode;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextArea;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+import org.xmlpull.infoset.XmlElement;
+
+public class OutputConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private OutputNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextArea descriptionTextArea;
+
+ private XBayaTextArea metadataTextArea;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public OutputConfigurationDialog(OutputNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ public void show() {
+
+ String name = this.node.getConfiguredName();
+ if (name == null) {
+ name = this.node.getName();
+ }
+ this.nameTextField.setText(name);
+ this.descriptionTextArea.setText(this.node.getDescription());
+ XmlElement metadata = this.node.getMetadata();
+ String metadataText;
+ if (metadata == null) {
+ metadataText = WSConstants.EMPTY_APPINFO;
+ } else {
+ metadataText = XMLUtil.xmlElementToString(metadata);
+ }
+ this.metadataTextArea.setText(metadataText);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ String name = this.nameTextField.getText();
+ String description = this.descriptionTextArea.getText();
+ String metadataText = this.metadataTextArea.getText();
+
+ if (name.length() == 0) {
+ String warning = "The name cannot be empty.";
+ this.xbayaGUI.getErrorWindow().error(warning);
+ return;
+ }
+
+ XmlElement metadata;
+ if (metadataText.length() == 0) {
+ metadata = null;
+ } else {
+ try {
+ metadata = XMLUtil.stringToXmlElement(metadataText);
+ } catch (RuntimeException e) {
+ String warning = "The metadata is ill-formed.";
+ this.xbayaGUI.getErrorWindow().error(warning, e);
+ return;
+ }
+ }
+
+ this.node.setConfigured(true);
+ this.node.setConfiguredName(name);
+ this.node.setDescription(description);
+ this.node.setMetadata(metadata);
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.descriptionTextArea = new XBayaTextArea();
+ XBayaLabel descriptionLabel = new XBayaLabel("Description", this.descriptionTextArea);
+
+ this.metadataTextArea = new XBayaTextArea();
+ XBayaLabel metadataLabel = new XBayaLabel("Metadata", this.metadataTextArea);
+
+ GridPanel mainPanel = new GridPanel();
+ mainPanel.add(nameLabel);
+ mainPanel.add(this.nameTextField);
+ mainPanel.add(descriptionLabel);
+ mainPanel.add(this.descriptionTextArea);
+ mainPanel.add(metadataLabel);
+ mainPanel.add(this.metadataTextArea);
+ mainPanel.layout(3, 2, 2, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "Input Parameter Configuration", mainPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+}
\ 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/dialogs/graph/system/ReceiveConfigurationDialog.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ReceiveConfigurationDialog.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ReceiveConfigurationDialog.java
new file mode 100644
index 0000000..66fc055
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/ReceiveConfigurationDialog.java
@@ -0,0 +1,161 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.graph.system.ReceiveNode;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.GridPanel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaLabel;
+import org.apache.airavata.xbaya.ui.widgets.XBayaTextField;
+
+public class ReceiveConfigurationDialog {
+
+ private XBayaGUI xbayaGUI;
+
+ private ReceiveNode node;
+
+ private XBayaDialog dialog;
+
+ private XBayaTextField nameTextField;
+
+ private XBayaTextField idTextField;
+
+ private JSpinner numPorts;
+
+ /**
+ * Constructs an InputConfigurationWindow.
+ *
+ * @param node
+ * @param engine
+ */
+ public ReceiveConfigurationDialog(ReceiveNode node, XBayaGUI xbayaGUI) {
+ this.xbayaGUI=xbayaGUI;
+ this.node = node;
+ initGui();
+ }
+
+ /**
+ * Shows the dialog.
+ */
+ @SuppressWarnings("boxing")
+ public void show() {
+ String name = this.node.getName();
+ this.nameTextField.setText(name);
+ this.idTextField.setText(this.node.getID());
+ int number = this.node.getOutputPorts().size();
+ this.numPorts.setValue(number);
+
+ this.dialog.show();
+ }
+
+ /**
+ * Hides the dialog.
+ */
+ private void hide() {
+ this.dialog.hide();
+ }
+
+ private void setInput() {
+ Integer value = (Integer) this.numPorts.getValue();
+ int number = value.intValue();
+ int current = this.node.getOutputPorts().size();
+ try {
+ if (number > current) {
+ // Add ports
+ for (int i = 0; i < number - current; i++) {
+ this.node.addOutputPort();
+ }
+ } else if (number < current) {
+ for (int i = 0; i < current - number; i++) {
+ this.node.removeOutputPort();
+ }
+ } else {
+ // Do nothing.
+ }
+ } catch (GraphException e) {
+ this.xbayaGUI.getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ hide();
+ this.xbayaGUI.getGraphCanvas().repaint();
+ }
+
+ /**
+ * Initializes the GUI.
+ */
+ private void initGui() {
+ this.nameTextField = new XBayaTextField();
+ this.nameTextField.setEditable(false);
+ XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
+
+ this.idTextField = new XBayaTextField();
+ this.idTextField.setEditable(false);
+ XBayaLabel idLabel = new XBayaLabel("ID", this.idTextField);
+
+ SpinnerNumberModel model = new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1);
+ this.numPorts = new JSpinner(model);
+ XBayaLabel numPortLabel = new XBayaLabel("Number of Parameters", this.numPorts);
+
+ GridPanel gridPanel = new GridPanel();
+ gridPanel.add(nameLabel);
+ gridPanel.add(this.nameTextField);
+ gridPanel.add(idLabel);
+ gridPanel.add(this.idTextField);
+ gridPanel.add(numPortLabel);
+ gridPanel.add(this.numPorts);
+ gridPanel.layout(3, 2, GridPanel.WEIGHT_NONE, 1);
+
+ JButton okButton = new JButton("OK");
+ okButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ setInput();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "Receive Configuration", gridPanel, buttonPanel);
+ this.dialog.setDefaultButton(okButton);
+ }
+
+}
\ 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/dialogs/graph/system/S3FileChooser.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/S3FileChooser.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/S3FileChooser.java
new file mode 100644
index 0000000..2f23b0e
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/dialogs/graph/system/S3FileChooser.java
@@ -0,0 +1,193 @@
+/*
+ *
+ * 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.dialogs.graph.system;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import org.apache.airavata.workflow.model.graph.system.S3InputNode;
+import org.apache.airavata.xbaya.core.amazon.AmazonCredential;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.dialogs.XBayaDialog;
+import org.apache.airavata.xbaya.ui.dialogs.amazon.BucketsLoader;
+import org.apache.airavata.xbaya.ui.dialogs.amazon.ChangeCredentialWindow;
+import org.apache.airavata.xbaya.ui.widgets.amazon.S3Tree;
+import org.jets3t.service.S3Service;
+import org.jets3t.service.S3ServiceException;
+import org.jets3t.service.impl.rest.httpclient.RestS3Service;
+import org.jets3t.service.security.AWSCredentials;
+
+public class S3FileChooser implements TreeSelectionListener {
+
+ private XBayaDialog dialog;
+ private XBayaGUI xbayaGUI;
+ protected S3InputNode inputNode;
+ private String chosenFile;
+
+ private S3Tree s3Tree;
+
+ /**
+ *
+ * Constructs a S3FileChooser.
+ *
+ * @param engine
+ * @param inputNode
+ */
+ public S3FileChooser(XBayaGUI xbayaGUI, S3InputNode inputNode) {
+ this.xbayaGUI=xbayaGUI;
+ this.inputNode = inputNode;
+ initGUI();
+ }
+
+ private void initGUI() {
+
+ /*
+ * ScrollPane for S3 Tree
+ */
+ // add tree listener to this
+ this.s3Tree = new S3Tree();
+ this.s3Tree.addTreeSelectionListener(this);
+
+ JScrollPane scrollPane = new JScrollPane(this.s3Tree);
+
+ /*
+ * Button Panel
+ */
+ JButton refreshButton = new JButton("Connect/Refresh");
+ refreshButton.addActionListener(new AbstractAction() {
+
+ private ChangeCredentialWindow credentialWindow;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (AmazonCredential.getInstance().getAwsAccessKeyId().isEmpty()
+ || AmazonCredential.getInstance().getAwsSecretAccessKey().isEmpty()) {
+ S3FileChooser.this.xbayaGUI.getErrorWindow().warning(S3FileChooser.this.dialog.getDialog(), "Error",
+ "Aws Access Key not set!");
+
+ if (this.credentialWindow == null) {
+ this.credentialWindow = new ChangeCredentialWindow(S3FileChooser.this.dialog.getDialog());
+ }
+ try {
+ this.credentialWindow.show();
+ } catch (Exception e1) {
+ S3FileChooser.this.xbayaGUI.getErrorWindow().error(e1);
+ }
+
+ return;
+ }
+ S3FileChooser.this.s3Tree.clean();
+
+ try {
+
+ // create S3Service
+ S3Service s3Service = new RestS3Service(new AWSCredentials(AmazonCredential.getInstance()
+ .getAwsAccessKeyId(), AmazonCredential.getInstance().getAwsSecretAccessKey()));
+
+ BucketsLoader bucketsLoader = new BucketsLoader(S3FileChooser.this.xbayaGUI,
+ S3FileChooser.this.dialog.getDialog());
+ bucketsLoader.load(s3Service, S3FileChooser.this.s3Tree);
+
+ } catch (S3ServiceException s3ex) {
+ S3FileChooser.this.xbayaGUI.getErrorWindow().error(s3ex);
+ }
+ }
+ });
+
+ JButton okButton = new JButton("Ok");
+ okButton.addActionListener(new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (S3FileChooser.this.chosenFile != null) {
+ S3FileChooser.this.inputNode.setDefaultValue(new String(S3FileChooser.this.chosenFile));
+ }
+ hide();
+ }
+ });
+
+ JButton cancelButton = new JButton("Cancel");
+ cancelButton.addActionListener(new AbstractAction() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ hide();
+ }
+ });
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(refreshButton);
+ buttonPanel.add(okButton);
+ buttonPanel.add(cancelButton);
+
+ this.dialog = new XBayaDialog(this.xbayaGUI, "Amazon S3 Input Chooser", scrollPane, buttonPanel);
+ }
+
+ /**
+ *
+ */
+ public void hide() {
+ this.dialog.hide();
+ }
+
+ /**
+ *
+ */
+ public void show() {
+ this.dialog.show();
+ }
+
+ /**
+ *
+ * @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent)
+ */
+ @Override
+ public void valueChanged(TreeSelectionEvent e) {
+ DefaultMutableTreeNode node = s3Tree.getSelectedNode();
+
+ if (node == null) {
+ this.chosenFile = null;
+ return;
+ }
+
+ Object nodeInfo = node.getUserObject();
+ String bucketName = "";
+ if (node.isLeaf()) {
+ DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) node.getParent();
+ bucketName = (String) parentNode.getUserObject();
+ String keyName = (String) nodeInfo;
+ this.chosenFile = "s3n://" + bucketName + "/" + keyName;
+
+ } else {
+ bucketName = (String) nodeInfo;
+ this.chosenFile = "s3n://" + bucketName;
+ }
+
+ }
+}
\ No newline at end of file