Search in sources :

Example 1 with XBayaTextComponent

use of org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent in project airavata by apache.

the class InputConfigurationDialog method setInput.

private void setInput() {
    XBayaTextComponent textComponent;
    textComponent = this.valueTextField;
    String name = this.nameTextField.getText();
    String description = this.descriptionTextArea.getText();
    String valueString = textComponent.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;
    }
    this.node.setConfigured(true);
    this.node.setConfiguredName(name);
    this.node.setDescription(description);
    this.node.setDefaultValue(value);
    hide();
    this.xbayaGUI.getGraphCanvas().repaint();
}
Also used : XBayaTextComponent(org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent)

Example 2 with XBayaTextComponent

use of org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent 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();
}
Also used : XBayaTextComponent(org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) XmlElement(org.xmlpull.infoset.XmlElement)

Example 3 with XBayaTextComponent

use of org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent 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();
}
Also used : XBayaTextComponent(org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) XmlElement(org.xmlpull.infoset.XmlElement)

Example 4 with XBayaTextComponent

use of org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent 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();
}
Also used : XBayaTextComponent(org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) XmlElement(org.xmlpull.infoset.XmlElement)

Aggregations

XBayaTextComponent (org.apache.airavata.xbaya.ui.widgets.XBayaTextComponent)4 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)3 XmlElement (org.xmlpull.infoset.XmlElement)3