use of org.apache.airavata.xbaya.ui.widgets.XBayaLabel 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.widgets.XBayaLabel 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.widgets.XBayaLabel 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();
}
use of org.apache.airavata.xbaya.ui.widgets.XBayaLabel 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.widgets.XBayaLabel 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);
}
Aggregations