Search in sources :

Example 6 with GridPanel

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

the class InputConfigurationDialog method initGui.

/**
 * 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);
    // for string
    this.valueTextField = new XBayaTextField();
    this.valueLabel = new XBayaLabel("Value", this.valueTextField);
    this.dataTypeTextField = new XBayaTextField();
    this.dataTypeTextField.setEditable(false);
    this.dataTypeLabel = new XBayaLabel("Type", this.dataTypeTextField);
    this.gridPanel = new GridPanel();
    this.gridPanel.add(nameLabel);
    this.gridPanel.add(this.nameTextField);
    this.gridPanel.add(this.valueLabel);
    this.gridPanel.add(this.valueTextField);
    this.gridPanel.add(this.dataTypeLabel);
    this.gridPanel.add(this.dataTypeTextField);
    this.gridPanel.add(descriptionLabel);
    this.gridPanel.add(this.descriptionTextArea);
    this.gridPanel.layout(4, 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);
}
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 7 with GridPanel

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

the class ReceiveConfigurationDialog method initGui.

/**
 * 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);
}
Also used : SpinnerNumberModel(javax.swing.SpinnerNumberModel) 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) JSpinner(javax.swing.JSpinner) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 8 with GridPanel

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

the class MonitorConfigurationWindow method initGui.

private void initGui() {
    this.brokerTextField = new XBayaTextField();
    XBayaLabel brokerLabel = new XBayaLabel("Broker URL", this.brokerTextField);
    this.topicTextField = new XBayaTextField();
    XBayaLabel topicLabel = new XBayaLabel("Topic", this.topicTextField);
    this.pullCheckBox = new JCheckBox("Pull Mode");
    JLabel dummyLabel = new JLabel();
    this.messageBoxTextField = new XBayaTextField();
    XBayaLabel msgBoxLabel = new XBayaLabel("Message Box URL", this.messageBoxTextField);
    this.messageBoxTextField.setEnabled(false);
    this.pullCheckBox.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent event) {
            int stateChange = event.getStateChange();
            if (stateChange == ItemEvent.SELECTED) {
                MonitorConfigurationWindow.this.messageBoxTextField.setEnabled(true);
            } else if (stateChange == ItemEvent.DESELECTED) {
                MonitorConfigurationWindow.this.messageBoxTextField.setEnabled(false);
            }
        }
    });
    GridPanel infoPanel = new GridPanel();
    infoPanel.add(brokerLabel);
    infoPanel.add(this.brokerTextField);
    infoPanel.add(topicLabel);
    infoPanel.add(this.topicTextField);
    infoPanel.add(dummyLabel);
    infoPanel.add(this.pullCheckBox);
    infoPanel.add(msgBoxLabel);
    infoPanel.add(this.messageBoxTextField);
    infoPanel.layout(4, 2, SwingUtil.WEIGHT_NONE, 1);
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            setConfiguration();
        }
    });
    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(), "Notification Configuration", infoPanel, buttonPanel);
    this.dialog.setDefaultButton(okButton);
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) ItemEvent(java.awt.event.ItemEvent) 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) JLabel(javax.swing.JLabel) ItemListener(java.awt.event.ItemListener) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 9 with GridPanel

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

the class MonitorWindow method init.

private void init() {
    this.timeTextField = new XBayaTextField();
    this.timeTextField.setEditable(false);
    XBayaLabel timeLabel = new XBayaLabel(EventDataRepository.Column.TIME.getName(), this.timeTextField);
    this.idTextField = new XBayaTextField();
    this.idTextField.setEditable(false);
    XBayaLabel idLabel = new XBayaLabel(EventDataRepository.Column.ID.getName(), this.idTextField);
    this.statusTextField = new XBayaTextField();
    this.statusTextField.setEditable(false);
    XBayaLabel statusLabel = new XBayaLabel(EventDataRepository.Column.STATUS.getName(), this.statusTextField);
    this.messageTextArea = new JEditorPane(XmlConstants.CONTENT_TYPE_HTML, "");
    this.messageTextArea.setSize(500, 500);
    this.messageTextArea.setEditable(false);
    messageTextArea.setBackground(Color.WHITE);
    messageTextArea.addHyperlinkListener(new HyperlinkListener() {

        public void hyperlinkUpdate(HyperlinkEvent event) {
            if (event.getEventType() == EventType.ACTIVATED) {
                URL url = event.getURL();
                try {
                    BrowserLauncher.openURL(url.toString());
                } catch (Exception e) {
                    MonitorWindow.this.xbayaGUI.getErrorWindow().error(MonitorWindow.this.dialog.getDialog(), e.getMessage(), e);
                }
            }
        }
    });
    JScrollPane pane = new JScrollPane(messageTextArea);
    pane.setSize(500, 500);
    XBayaLabel messageLabel = new XBayaLabel(EventDataRepository.Column.MESSAGE.getName(), pane);
    GridPanel infoPanel = new GridPanel();
    infoPanel.add(timeLabel);
    infoPanel.add(this.timeTextField);
    infoPanel.add(idLabel);
    infoPanel.add(this.idTextField);
    infoPanel.add(statusLabel);
    infoPanel.add(this.statusTextField);
    infoPanel.add(messageLabel);
    infoPanel.add(pane);
    infoPanel.layout(4, 2, 3, 1);
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            hide();
        }
    });
    JButton copyButton = new JButton("Copy to Clipboard");
    copyButton.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(messageText), null);
        }
    });
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(okButton);
    buttonPanel.add(copyButton);
    this.dialog = new XBayaDialog(this.xbayaGUI, "Notification", infoPanel, buttonPanel);
    this.dialog.setDefaultButton(okButton);
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) XBayaDialog(org.apache.airavata.xbaya.ui.dialogs.XBayaDialog) ActionEvent(java.awt.event.ActionEvent) URL(java.net.URL) StringSelection(java.awt.datatransfer.StringSelection) HyperlinkListener(javax.swing.event.HyperlinkListener) GridPanel(org.apache.airavata.xbaya.ui.widgets.GridPanel) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Example 10 with GridPanel

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

the class InstanceConfigurationDialog method initGui.

/**
 * Initializes the GUI.
 */
private void initGui() {
    /*
         * Name
         */
    this.nameTextField = new XBayaTextField();
    XBayaLabel nameLabel = new XBayaLabel("Name", this.nameTextField);
    this.nameTextField.setEditable(false);
    /*
         * Radio button
         */
    this.amiButton = new JRadioButton("Start new instance");
    this.amiButton.setSelected(true);
    this.amiButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent paramActionEvent) {
            InstanceConfigurationDialog.this.instanceTypeComboBox.getJComboBox().setEnabled(true);
        }
    });
    this.instanceTypeComboBox = new XBayaComboBox(new DefaultComboBoxModel(AmazonUtil.INSTANCE_TYPE));
    this.instanceTypeComboBox.setSelectedItem(AmazonUtil.INSTANCE_TYPE[1]);
    GridPanel amiPanel = new GridPanel();
    amiPanel.add(this.amiButton);
    amiPanel.add(this.instanceTypeComboBox);
    amiPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
    this.idButton = new JRadioButton("Use existing instance");
    this.idButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent paramActionEvent) {
            InstanceConfigurationDialog.this.instanceTypeComboBox.getJComboBox().setEnabled(false);
        }
    });
    ButtonGroup serviceTypeButtonGroup = new ButtonGroup();
    serviceTypeButtonGroup.add(this.amiButton);
    serviceTypeButtonGroup.add(this.idButton);
    XBayaLabel radioLabel = new XBayaLabel("Options", this.amiButton);
    /*
         * AMI/Instance ID
         */
    this.idTextField = new XBayaTextField();
    XBayaLabel idLabel = new XBayaLabel("AMI/Instance ID", this.amiButton);
    /*
         * Username
         */
    this.usernameTextField = new XBayaTextField();
    XBayaLabel usernameLabel = new XBayaLabel("Username", this.amiButton);
    GridPanel gridPanel = new GridPanel();
    gridPanel.add(nameLabel);
    gridPanel.add(this.nameTextField);
    gridPanel.add(radioLabel);
    gridPanel.add(amiPanel);
    gridPanel.add(new JPanel());
    gridPanel.add(this.idButton);
    gridPanel.add(idLabel);
    gridPanel.add(this.idTextField);
    gridPanel.add(usernameLabel);
    gridPanel.add(this.usernameTextField);
    gridPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            if (InstanceConfigurationDialog.this.idTextField.getText() == null || InstanceConfigurationDialog.this.idTextField.getText().isEmpty()) {
                InstanceConfigurationDialog.this.xbayaGUI.getErrorWindow().error("Please input AMI ID or Instance ID");
                return;
            }
            if (InstanceConfigurationDialog.this.usernameTextField.getText() == null || InstanceConfigurationDialog.this.usernameTextField.getText().isEmpty()) {
                InstanceConfigurationDialog.this.xbayaGUI.getErrorWindow().error("Please input username to access instance");
                return;
            }
            InstanceConfigurationDialog.this.node.setStartNewInstance(InstanceConfigurationDialog.this.amiButton.isSelected());
            if (InstanceConfigurationDialog.this.amiButton.isSelected()) {
                InstanceConfigurationDialog.this.node.setAmiId(InstanceConfigurationDialog.this.idTextField.getText());
                InstanceConfigurationDialog.this.node.setInstanceType(InstanceConfigurationDialog.this.instanceTypeComboBox.getText());
            } else {
                InstanceConfigurationDialog.this.node.setInstanceId(InstanceConfigurationDialog.this.idTextField.getText());
                InstanceConfigurationDialog.this.node.setInstanceType(null);
            }
            InstanceConfigurationDialog.this.node.setUsername(InstanceConfigurationDialog.this.usernameTextField.getText());
            hide();
        }
    });
    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, "Instance Configuration", gridPanel, buttonPanel);
    this.dialog.setDefaultButton(okButton);
}
Also used : JPanel(javax.swing.JPanel) XBayaComboBox(org.apache.airavata.xbaya.ui.widgets.XBayaComboBox) JRadioButton(javax.swing.JRadioButton) XBayaDialog(org.apache.airavata.xbaya.ui.dialogs.XBayaDialog) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) GridPanel(org.apache.airavata.xbaya.ui.widgets.GridPanel) XBayaTextField(org.apache.airavata.xbaya.ui.widgets.XBayaTextField) AbstractAction(javax.swing.AbstractAction) XBayaLabel(org.apache.airavata.xbaya.ui.widgets.XBayaLabel)

Aggregations

ActionEvent (java.awt.event.ActionEvent)36 GridPanel (org.apache.airavata.xbaya.ui.widgets.GridPanel)36 XBayaDialog (org.apache.airavata.xbaya.ui.dialogs.XBayaDialog)33 XBayaLabel (org.apache.airavata.xbaya.ui.widgets.XBayaLabel)31 XBayaTextField (org.apache.airavata.xbaya.ui.widgets.XBayaTextField)31 AbstractAction (javax.swing.AbstractAction)30 JButton (javax.swing.JButton)30 JPanel (javax.swing.JPanel)28 XBayaTextArea (org.apache.airavata.xbaya.ui.widgets.XBayaTextArea)11 JSpinner (javax.swing.JSpinner)8 SpinnerNumberModel (javax.swing.SpinnerNumberModel)8 JLabel (javax.swing.JLabel)5 TitledBorder (javax.swing.border.TitledBorder)4 ActionListener (java.awt.event.ActionListener)3 EtchedBorder (javax.swing.border.EtchedBorder)3 XBayaComboBox (org.apache.airavata.xbaya.ui.widgets.XBayaComboBox)3 StringSelection (java.awt.datatransfer.StringSelection)2 URL (java.net.URL)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 JCheckBox (javax.swing.JCheckBox)2