use of org.apache.airavata.xbaya.ui.dialogs.XBayaDialog in project airavata by apache.
the class RegistryWindow method initGUI.
/**
* Initializes the GUI.
*/
private void initGUI() {
this.serverTextField = new XBayaTextField();
this.portTextField = new XBayaTextField();
this.gatewayIdTextField = new XBayaTextField();
this.usernameTextField = new XBayaTextField();
this.serverTextField.setText("localhost");
this.portTextField.setText("8930");
this.gatewayIdTextField.setText("sample");
this.usernameTextField.setText("airavata");
ThriftClientData thriftClientData = engine.getConfiguration().getThriftClientData(ThriftServiceType.API_SERVICE);
if (thriftClientData != null) {
this.serverTextField.setText(thriftClientData.getServerAddress());
this.gatewayIdTextField.setText(thriftClientData.getGatewayId());
this.portTextField.setText(String.valueOf(thriftClientData.getServerPort()));
this.usernameTextField.setText(thriftClientData.getUsername());
}
try {
ClientSettings.initializeTrustStore();
} catch (ApplicationSettingsException e) {
throw new RuntimeException("An error occurred while initializing client configurations");
}
XBayaLabel serverAddressLabel = new XBayaLabel("Server Address", this.serverTextField);
XBayaLabel serverPortLabel = new XBayaLabel("Server Port", this.portTextField);
XBayaLabel gatewayNameLabel = new XBayaLabel("Gateway ID", this.gatewayIdTextField);
XBayaLabel gatewayUserLabel = new XBayaLabel("Gateway User", this.usernameTextField);
serviceTypeModel = new DefaultComboBoxModel(ThriftServiceType.values());
serviceTypeModel.setSelectedItem(getServiceType());
this.serviceTypeCombo = new XBayaComboBox(serviceTypeModel);
JLabel serviceTypeLabel = new JLabel("Airavata Service");
// serviceTypeCombo.addActionListener(new AbstractAction() {
// public void actionPerformed(ActionEvent e) {
// // createNewUser();
// }
// });
GridPanel infoPanel = new GridPanel();
infoPanel.add(serviceTypeLabel);
infoPanel.add(this.serviceTypeCombo);
infoPanel.add(serverAddressLabel);
infoPanel.add(this.serverTextField);
infoPanel.add(serverPortLabel);
infoPanel.add(this.portTextField);
infoPanel.add(gatewayNameLabel);
infoPanel.add(this.gatewayIdTextField);
infoPanel.add(gatewayUserLabel);
infoPanel.add(this.usernameTextField);
infoPanel.layout(5, 2, GridPanel.WEIGHT_NONE, 1);
// infoPanel.layout(2, 2, GridPanel.WEIGHT_NONE, 1);
infoPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
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();
}
});
GridPanel buttonPanel = new GridPanel();
buttonPanel.add(okButton);
buttonPanel.add(cancelButton);
buttonPanel.getSwingComponent().setBorder(BorderFactory.createEtchedBorder());
this.dialog = new XBayaDialog(this.engine.getGUI(), "Configure Airavata Thrift Service", infoPanel, buttonPanel);
this.dialog.setDefaultButton(okButton);
}
use of org.apache.airavata.xbaya.ui.dialogs.XBayaDialog in project airavata by apache.
the class ParameterPropertyWindow method initGui.
private void initGui() {
this.inputPanel = new ParameterPropertyPanel("Inputs");
this.outputPanel = new ParameterPropertyPanel("Outputs");
JPanel mainPanel = new JPanel();
// To have the same size.
mainPanel.setLayout(new GridLayout(1, 2));
mainPanel.add(this.inputPanel.getSwingComponent());
mainPanel.add(this.outputPanel.getSwingComponent());
JPanel buttonPanel = new JPanel();
this.okButton = new JButton("OK");
this.okButton.setDefaultCapable(true);
this.okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
ok();
}
});
buttonPanel.add(this.okButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent e) {
hide();
}
});
buttonPanel.add(cancelButton);
this.dialog = new XBayaDialog(this.engine.getGUI(), "Workflow Paremeter Properties", mainPanel, buttonPanel);
this.dialog.setDefaultButton(this.okButton);
}
use of org.apache.airavata.xbaya.ui.dialogs.XBayaDialog in project airavata by apache.
the class LaunchApplicationWindow method initGUI.
private void initGUI() {
this.parameterPanel = new GridPanel(true);
this.instanceNameTextField = new XBayaTextField();
XBayaLabel instanceNameLabel = new XBayaLabel("Experiment name", this.instanceNameTextField);
GridPanel infoPanel = new GridPanel();
infoPanel.add(instanceNameLabel);
infoPanel.add(this.instanceNameTextField);
infoPanel.layout(1, 2, GridPanel.WEIGHT_NONE, 1);
GridPanel mainPanel = new GridPanel();
mainPanel.getContentPanel().setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
mainPanel.add(infoPanel);
mainPanel.add(this.parameterPanel);
mainPanel.layout(2, 1, 0, 0);
JButton okButton = new JButton("Run");
okButton.addActionListener(new AbstractAction() {
public void actionPerformed(ActionEvent event) {
try {
execute();
} catch (AiravataClientConnectException e) {
logger.error(e.getMessage(), e);
} 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);
}
}
});
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);
buttonPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
this.dialog = new XBayaDialog(this.engine.getGUI(), "Launch workflow", mainPanel, buttonPanel);
this.dialog.setDefaultButton(okButton);
}
use of org.apache.airavata.xbaya.ui.dialogs.XBayaDialog 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);
}
}
use of org.apache.airavata.xbaya.ui.dialogs.XBayaDialog in project airavata by apache.
the class EC2InstancesManagementWindow method initGUI.
private void initGUI() {
this.list = new XbayaEnhancedList<EC2InstanceResult>();
GridPanel mainPanel = new GridPanel();
TitledBorder border = new TitledBorder(new EtchedBorder(), "My Instances");
mainPanel.getSwingComponent().setBorder(border);
mainPanel.add(this.list);
mainPanel.layout(1, 1, 0, 0);
/* Connect/Refresh Button */
JButton refreshButton = new JButton("Refresh");
refreshButton.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
/* Check if Credential is already set or not */
if (credentialSet()) {
InstancesLoader instancesLoader = new InstancesLoader(EC2InstancesManagementWindow.this.engine, EC2InstancesManagementWindow.this.dialog.getDialog());
instancesLoader.load(EC2InstancesManagementWindow.this.list);
}
}
});
/* Launch Instance Button */
JButton launchButton = new JButton("Launch");
launchButton.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
if (credentialSet()) {
EC2LaunchWindow ec2LaunchWindow = new EC2LaunchWindow(EC2InstancesManagementWindow.this.engine);
ec2LaunchWindow.show();
}
}
});
/* Terminate Instance */
JButton terminateButton = new JButton("Terminate");
terminateButton.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
List<EC2InstanceResult> selected = EC2InstancesManagementWindow.this.list.getSelectedValues();
if (selected.size() == 0) {
EC2InstancesManagementWindow.this.engine.getGUI().getErrorWindow().info(EC2InstancesManagementWindow.this.dialog.getDialog(), "Warning", "No instances selected");
return;
}
String text = "";
List<String> requestIds = new ArrayList<String>();
for (EC2InstanceResult ec2InstancesResult : selected) {
requestIds.add(ec2InstancesResult.getInstance().getInstanceId());
text += ec2InstancesResult.getInstance().getInstanceId() + ",";
}
// confirm from user
int n = JOptionPane.showConfirmDialog(EC2InstancesManagementWindow.this.dialog.getDialog(), "Are you want to terminate instances:\n" + text, "Terminate Instances", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
if (n == JOptionPane.YES_OPTION) {
// terminate
AmazonUtil.terminateInstances(requestIds);
// reload
InstancesLoader instancesLoader = new InstancesLoader(EC2InstancesManagementWindow.this.engine, EC2InstancesManagementWindow.this.dialog.getDialog());
instancesLoader.load(EC2InstancesManagementWindow.this.list);
}
}
});
/* Close Button */
JButton closeButton = new JButton("Close");
closeButton.addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
EC2InstancesManagementWindow.this.hide();
}
});
JPanel buttonPanel = new JPanel();
buttonPanel.add(refreshButton);
buttonPanel.add(launchButton);
buttonPanel.add(terminateButton);
buttonPanel.add(closeButton);
this.dialog = new XBayaDialog(this.engine.getGUI(), "Amazon EC2 Management Console", mainPanel, buttonPanel);
int width = 800;
int height = 500;
this.dialog.getDialog().setPreferredSize(new Dimension(width, height));
this.dialog.setDefaultButton(closeButton);
}
Aggregations