use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.
the class ForEachNode method edgeWasAdded.
/**
* @param edge
* @throws GraphException
*/
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
// XXX cannot detect if the type is array or not from WSDL at this
// point. so no check here.
// super.edgeWasAdded(edge);
Port fromPort = edge.getFromPort();
Port toPort = edge.getToPort();
if (edge instanceof DataEdge) {
if (fromPort instanceof EPRPort) {
// TODO
return;
}
DataPort fromDataPort = (DataPort) fromPort;
DataPort toDataPort = (DataPort) toPort;
DataType fromType = fromDataPort.getType();
DataType toType = toDataPort.getType();
if (fromDataPort.getNode() == this) {
if (!(toType == null || toType.equals(WSConstants.XSD_ANY_TYPE))) {
fromDataPort.copyType(toDataPort);
}
} else if (toDataPort.getNode() == this) {
if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE))) {
toDataPort.copyType(fromDataPort);
}
} else {
throw new WorkflowRuntimeException();
}
}
}
use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.
the class LaunchApplicationWindow method show.
/**
* Shows the dialog.
*/
public void show() {
this.workflow = this.engine.getGUI().getWorkflow();
// Create input fields
// Collection<InputNode> inputNodes = GraphUtil.getInputNodes(this.workflow.getGraph());
// for (InputNode node : inputNodes) {
// String id = node.getID();
// QName parameterType = node.getParameterType();
// JLabel nameLabel = new JLabel(id);
// JLabel typeField = new JLabel(parameterType.getLocalPart());
// XBayaTextField paramField = new XBayaTextField();
// Object value = node.getDefaultValue();
//
// String valueString;
// if (value == null) {
// valueString = "";
// } else {
// if (value instanceof XmlElement) {
// XmlElement valueElement = (XmlElement) value;
// valueString = XMLUtil.xmlElementToString(valueElement);
// } else {
// // Only string comes here for now.
// valueString = value.toString();
// }
// }
// paramField.setText(valueString);
List<NodeImpl> nodes = workflow.getGraph().getNodes();
NodeImpl node = null;
for (int i = 0; i < nodes.size(); i++) {
node = nodes.get(i);
String html = node.getComponent().toHTML();
String nodeType = html.substring(html.indexOf("<h1>") + 4, html.indexOf(":")).trim();
if (nodeType.equals("Application")) {
break;
}
}
List<DataPort> inputPorts = node.getInputPorts();
for (DataPort port : inputPorts) {
String id = port.getName();
DataType parameterType = port.getType();
JLabel nameLabel = new JLabel(id);
JLabel typeField = new JLabel(parameterType.toString());
XBayaTextField paramField = new XBayaTextField();
paramField.setText("");
this.parameterPanel.add(nameLabel);
this.parameterPanel.add(typeField);
this.parameterPanel.add(paramField);
this.parameterTextFields.add(paramField);
}
Map<String, String> hosts = null;
try {
hosts = airavataClient.getAllComputeResourceNames();
} catch (InvalidRequestException e) {
logger.error(e.getMessage(), e);
} catch (AiravataClientException e) {
logger.error(e.getMessage(), e);
} catch (AiravataSystemException e) {
logger.error(e.getMessage(), e);
} catch (TException e) {
logger.error(e.getMessage(), e);
}
hostNames = new HashMap<String, String>();
Iterator it = hosts.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
String key = (String) pairs.getKey();
String value = (String) pairs.getValue();
if (!hostNames.containsKey(value)) {
hostNames.put(value, key);
}
}
host = new JComboBox();
it = hostNames.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
String key = (String) pairs.getKey();
host.addItem(key);
}
host.setSelectedIndex(1);
XBayaLabel hostLabel = new XBayaLabel("Host", this.host);
this.parameterPanel.add(hostLabel);
this.parameterPanel.add(host);
// this.parameterPanel.layout(inputNodes.size()+1, 2, GridPanel.WEIGHT_NONE, 2);
this.dialog.show();
}
use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.
the class ConstantConfigurationDialog method setInput.
private void setInput() {
String name = this.nameTextField.getText();
DataType type = this.node.getType();
String valueString;
valueString = this.valueTextField.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 (!this.node.isInputValid(valueString)) {
String warning = "The defalut value is not valid for " + this.node.getType() + ".";
this.xbayaGUI.getErrorWindow().error(warning);
}
value = valueString;
}
this.node.setName(name);
this.node.setValue(value);
hide();
this.xbayaGUI.getGraphCanvas().repaint();
}
use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.
the class ConstantConfigurationDialog method show.
/**
* Shows the dialog.
*/
public void show() {
DataType type = this.node.getType();
XBayaTextComponent textComponent;
textComponent = this.valueTextField;
this.valueLabel.setText("Default value");
this.valueLabel.setLabelFor(textComponent);
final int index = 7;
this.gridPanel.remove(index);
this.gridPanel.add(textComponent, index);
this.gridPanel.layout(4, 2, 3, 1);
String name = this.node.getName();
this.nameTextField.setText(name);
this.idTextField.setText(this.node.getID());
this.typeTextField.setText(type.toString());
Object value = this.node.getValue();
String valueString;
if (value == null) {
valueString = "";
} else if (value instanceof XmlElement) {
valueString = XMLUtil.xmlElementToString((XmlElement) value);
} else {
valueString = value.toString();
}
textComponent.setText(valueString);
this.dialog.show();
}
use of org.apache.airavata.model.appcatalog.appinterface.DataType in project airavata by apache.
the class DifferedInputConfigurationDialog method show.
/**
* Shows the dialog.
*/
public void show() {
DataType type = this.node.getParameterType();
XBayaTextComponent textComponent;
// boolean knownType = LEADTypes.isKnownType(type);
textComponent = this.valueTextField;
this.valueLabel.setText("Default value");
this.valueLabel.setLabelFor(textComponent);
final int index = 5;
this.gridPanel.remove(index);
this.gridPanel.add(textComponent, index);
this.gridPanel.layout(new double[] { 0, 1.0 / 2, 0, 1.0 / 2 }, new double[] { 0, 1 });
// String name = this.node.getConfiguredName();
// if (name == null) {
// name = this.node.getName();
// }
// Show ID.
String name = this.node.getID();
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();
}
Aggregations