use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class BlockNode method toXML.
@Override
protected XmlElement toXML() {
XmlElement nodeElement = super.toXML();
nodeElement.setAttributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_IF);
return nodeElement;
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class WorkflowInterpreterLaunchWindow 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();
DataType parameterType = node.getParameterType();
JLabel nameLabel = new JLabel(id);
JLabel typeField = new JLabel(parameterType.toString());
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);
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();
if (hosts.isEmpty()) {
JOptionPane.showMessageDialog(engine.getGUI().getFrame(), "No Compute Resources found", "Compute Resources", JOptionPane.ERROR_MESSAGE);
return;
}
} catch (InvalidRequestException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (AiravataClientException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (AiravataSystemException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (TException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
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(0);
XBayaLabel hostLabel = new XBayaLabel("Host", host);
this.parameterPanel.add(hostLabel);
this.parameterPanel.add(host);
this.parameterPanel.layout(inputNodes.size(), 3, GridPanel.WEIGHT_NONE, 2);
this.dialog.show();
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class ParameterPropertyWindow method ok.
private void ok() {
String inputMetadataText = this.inputPanel.getMetadata();
XmlElement inputMetadata;
if (inputMetadataText.length() == 0) {
inputMetadata = null;
} else {
try {
inputMetadata = XMLUtil.stringToXmlElement(inputMetadataText);
} catch (RuntimeException e) {
String warning = "The input metadata is ill-formed.";
this.engine.getGUI().getErrorWindow().error(warning, e);
return;
}
}
String outputMetadataText = this.outputPanel.getMetadata();
XmlElement outputMetadata;
if (outputMetadataText.length() == 0) {
outputMetadata = null;
} else {
try {
outputMetadata = XMLUtil.stringToXmlElement(outputMetadataText);
} catch (RuntimeException e) {
String warning = "The output metadata is ill-formed.";
this.engine.getGUI().getErrorWindow().error(warning, e);
return;
}
}
// outputs, and the rest.
for (int i = 0; i < this.inputNodes.size(); i++) {
InputNode inputNode = this.inputNodes.get(i);
Collections.swap(this.nodes, i, this.nodes.indexOf(inputNode));
}
for (int i = 0; i < this.outputNodes.size(); i++) {
OutputNode outputNode = this.outputNodes.get(i);
Collections.swap(this.nodes, this.inputNodes.size() + i, this.nodes.indexOf(outputNode));
}
hide();
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class DifferedInputConfigurationDialog method setInput.
private void setInput() {
DataType type = this.node.getParameterType();
XBayaTextComponent textComponent;
textComponent = this.valueTextField;
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 (!this.node.isInputValid(valueString)) {
String warning = "The defalut value is not valid for " + this.node.getParameterType() + ".";
this.xbayaGUI.getErrorWindow().error(warning);
}
value = valueString;
}
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();
}
use of org.xmlpull.infoset.XmlElement in project airavata by apache.
the class EndBlockNode method toXML.
@Override
protected XmlElement toXML() {
XmlElement nodeElement = super.toXML();
nodeElement.setAttributeValue(GraphSchema.NS, GraphSchema.NODE_TYPE_ATTRIBUTE, GraphSchema.NODE_TYPE_ENDBLOCK);
return nodeElement;
}
Aggregations