Search in sources :

Example 26 with XBayaTextField

use of org.apache.airavata.xbaya.ui.widgets.XBayaTextField 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();
}
Also used : TException(org.apache.thrift.TException) NodeImpl(org.apache.airavata.workflow.model.graph.impl.NodeImpl) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) DataPort(org.apache.airavata.workflow.model.graph.DataPort) AiravataSystemException(org.apache.airavata.model.error.AiravataSystemException) Iterator(java.util.Iterator) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) InvalidRequestException(org.apache.airavata.model.error.InvalidRequestException) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AiravataClientException(org.apache.airavata.model.error.AiravataClientException) HashMap(java.util.HashMap) Map(java.util.Map) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 27 with XBayaTextField

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

the class ChangeCredentialWindow method initGUI.

protected void initGUI() {
    this.accessKeyIDTextField = new XBayaTextField();
    XBayaLabel accessKeyIDLabel = new XBayaLabel("Access Key", this.accessKeyIDTextField);
    this.secretAccessKeyTextField = new XBayaTextField();
    XBayaLabel secretAccessKeyLabel = new XBayaLabel("Secret Key", this.secretAccessKeyTextField);
    GridPanel infoPanel = new GridPanel();
    infoPanel.add(accessKeyIDLabel);
    infoPanel.add(this.accessKeyIDTextField);
    infoPanel.add(secretAccessKeyLabel);
    infoPanel.add(this.secretAccessKeyTextField);
    infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
    GridPanel mainPanel = new GridPanel();
    mainPanel.add(infoPanel);
    mainPanel.layout(1, 1, GridPanel.WEIGHT_EQUALLY, GridPanel.WEIGHT_EQUALLY);
    JButton okButton = new JButton("Ok");
    okButton.addActionListener(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            String accessID = ChangeCredentialWindow.this.accessKeyIDTextField.getText();
            if (!"".equals(accessID)) {
                String secretID = ChangeCredentialWindow.this.secretAccessKeyTextField.getText();
                if (!"".equals(secretID)) {
                    AmazonCredential.getInstance().setAwsAccessKeyId(accessID);
                    AmazonCredential.getInstance().setAwsSecretAccessKey(secretID);
                    hide();
                    return;
                }
            }
            JOptionPane.showMessageDialog(dialog.getDialog(), "SecretKey and AccessKey can not be empty!");
        }
    });
    JButton generateButton = new JButton("Generate Key Pair");
    generateButton.addActionListener(new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            /* String accessID = ChangeCredentialWindow.this.accessKeyIDTextField.getText();
                if (!"".equals(accessID)) {
                    String secretID = ChangeCredentialWindow.this.secretAccessKeyTextField.getText();

                    if (!"".equals(secretID)) {
                        AmazonCredential.getInstance().setAwsAccessKeyId(accessID);
                        AmazonCredential.getInstance().setAwsSecretAccessKey(secretID);

                        File file = new File(System.getProperty("user.home") + "/.ssh/" + EC2Provider.KEY_PAIR_NAME);

                        if (file.exists()) {
                            ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
                                    info(ChangeCredentialWindow.this.dialog.getDialog(),
                                    "Warning", "The file " + file.getAbsolutePath() + " exists.");

                        } else {
                            AWSCredentials credential =
                                    new BasicAWSCredentials(accessID, secretID);
                            AmazonEC2Client ec2client = new AmazonEC2Client(credential);

                            try {
                                EC2ProviderUtil.buildKeyPair(ec2client, EC2Provider.KEY_PAIR_NAME);
                            } catch (NoSuchAlgorithmException e1) {
                                ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
                                        info(ChangeCredentialWindow.this.dialog.getDialog(),
                                        "Warning", e1.getMessage());
                            } catch (InvalidKeySpecException e1) {
                                ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
                                        info(ChangeCredentialWindow.this.dialog.getDialog(),
                                        "Warning", e1.getMessage());
                            } catch (IOException e1) {
                                ChangeCredentialWindow.this.engine.getGUI().getErrorWindow().
                                        info(ChangeCredentialWindow.this.dialog.getDialog(),
                                        "Warning", e1.getMessage());
                            }

                            JOptionPane.showMessageDialog(dialog.getDialog(),"The key " +
                                    file.getAbsolutePath() + " generated.");
                        }

                        hide();
                        return;
                    }
                }*/
            JOptionPane.showMessageDialog(dialog.getDialog(), "SecretKey and AccessKey can not be empty!");
        }
    });
    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(generateButton);
    buttonPanel.add(cancelButton);
    if (this.owner == null) {
        this.dialog = new XBayaDialog(this.engine.getGUI(), "Security Credentials", mainPanel, buttonPanel);
    } else {
        this.dialog = new XBayaDialog(this.owner, "Security Credentials", mainPanel, buttonPanel);
    }
}
Also used : JPanel(javax.swing.JPanel) XBayaDialog(org.apache.airavata.xbaya.ui.dialogs.XBayaDialog) GridPanel(org.apache.airavata.xbaya.ui.widgets.GridPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 28 with XBayaTextField

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

the class WebResigtryWindow method initGUI.

/**
 * Initializes the GUI.
 */
private void initGUI() {
    this.urlTextField = new XBayaTextField();
    XBayaLabel urlLabel = new XBayaLabel("URL", this.urlTextField);
    GridPanel infoPanel = new GridPanel();
    infoPanel.add(urlLabel);
    infoPanel.add(this.urlTextField);
    infoPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            ok();
        }
    });
    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(), "Web Registry", infoPanel, buttonPanel);
    this.dialog.setDefaultButton(okButton);
}
Also used : JPanel(javax.swing.JPanel) XBayaDialog(org.apache.airavata.xbaya.ui.dialogs.XBayaDialog) GridPanel(org.apache.airavata.xbaya.ui.widgets.GridPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 29 with XBayaTextField

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

the class OutputConfigurationDialog method initGui.

/**
 * Initializes the GUI.
 */
private void initGui() {
    this.nameTextField = new XBayaTextField();
    XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
    this.dataTypeField = new XBayaTextField(this.node.getParameterType().toString());
    this.dataTypeField.setEditable(false);
    this.dataTypeLabel = new XBayaLabel("Type", this.dataTypeField);
    this.descriptionTextArea = new XBayaTextArea();
    XBayaLabel descriptionLabel = new XBayaLabel("Description", this.descriptionTextArea);
    GridPanel mainPanel = new GridPanel();
    mainPanel.add(nameLabel);
    mainPanel.add(this.nameTextField);
    mainPanel.add(this.dataTypeLabel);
    mainPanel.add(this.dataTypeField);
    mainPanel.add(descriptionLabel);
    mainPanel.add(this.descriptionTextArea);
    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);
}
Also used : JPanel(javax.swing.JPanel) XBayaDialog(org.apache.airavata.xbaya.ui.dialogs.XBayaDialog) GridPanel(org.apache.airavata.xbaya.ui.widgets.GridPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) XBayaTextArea(org.apache.airavata.xbaya.ui.widgets.XBayaTextArea) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 30 with XBayaTextField

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

the class StreamSourceConfigurationDialog method initGui.

/**
 * Initializes the GUI.
 */
private void initGui() {
    this.wsdlTextField = new XBayaTextField();
    this.wsdlLabel = new XBayaLabel("The EPR of the Stream Source", this.wsdlTextField);
    this.descriptionTextField = new XBayaTextField();
    this.descriptionLabel = new XBayaLabel("Description", this.descriptionTextField);
    this.gridPanel = new GridPanel();
    this.gridPanel.add(wsdlLabel);
    this.gridPanel.add(this.wsdlTextField);
    this.gridPanel.add(descriptionLabel);
    this.gridPanel.add(this.descriptionTextField);
    this.gridPanel.layout(2, 2, 1, 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, "Configure Streaming Data source", this.gridPanel, buttonPanel);
    this.dialog.setDefaultButton(okButton);
}
Also used : JPanel(javax.swing.JPanel) XBayaDialog(org.apache.airavata.xbaya.ui.dialogs.XBayaDialog) GridPanel(org.apache.airavata.xbaya.ui.widgets.GridPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Aggregations

XBayaTextField (org.apache.airavata.xbaya.ui.widgets.XBayaTextField)35 XBayaLabel (org.apache.airavata.xbaya.ui.widgets.XBayaLabel)32 ActionEvent (java.awt.event.ActionEvent)31 GridPanel (org.apache.airavata.xbaya.ui.widgets.GridPanel)31 XBayaDialog (org.apache.airavata.xbaya.ui.dialogs.XBayaDialog)30 AbstractAction (javax.swing.AbstractAction)26 JButton (javax.swing.JButton)26 JPanel (javax.swing.JPanel)25 JSpinner (javax.swing.JSpinner)8 SpinnerNumberModel (javax.swing.SpinnerNumberModel)8 XBayaTextArea (org.apache.airavata.xbaya.ui.widgets.XBayaTextArea)8 JLabel (javax.swing.JLabel)5 AiravataClientException (org.apache.airavata.model.error.AiravataClientException)4 AiravataSystemException (org.apache.airavata.model.error.AiravataSystemException)4 InvalidRequestException (org.apache.airavata.model.error.InvalidRequestException)4 TException (org.apache.thrift.TException)4 ActionListener (java.awt.event.ActionListener)3 XBayaComboBox (org.apache.airavata.xbaya.ui.widgets.XBayaComboBox)3 StringSelection (java.awt.datatransfer.StringSelection)2 URL (java.net.URL)2