use of org.apache.airavata.xbaya.XBayaConfiguration in project airavata by apache.
the class RegistryWindow method ok.
private void ok() {
setServerName(this.serverTextField.getText());
setPreviousServerName(this.serverTextField.getText());
setGatewayId(this.gatewayIdTextField.getText());
setUsername(new String(this.usernameTextField.getText()));
setServerPort(this.portTextField.getText());
setServiceType((ThriftServiceType) serviceTypeModel.getSelectedItem());
try {
validateData();
XBayaConfiguration configuration = this.engine.getConfiguration();
configuration.addThriftClientData(new ThriftClientData(getServiceType(), serverName, Integer.parseInt(serverPort), gatewayId, username));
hide();
} catch (Exception e) {
this.engine.getGUI().getErrorWindow().error(e.getMessage());
}
}
use of org.apache.airavata.xbaya.XBayaConfiguration in project airavata by apache.
the class XBayaGUI method createFrame.
/**
* Creates a frame.
*/
private void createFrame() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
// OK. The default will be used.
logger.error(e.getMessage(), e);
}
JFrame.setDefaultLookAndFeelDecorated(false);
this.frame = new JFrame();
// Adjust the size
XBayaConfiguration config = this.engine.getConfiguration();
int width = config.getWidth();
int height = config.getHeight();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
final int inset = 50;
this.frame.setLocation(inset, inset);
Dimension size = new Dimension(screenSize.width - inset * 2, screenSize.height - inset * 2);
if (width != 0) {
size.width = width;
}
if (height != 0) {
size.height = height;
}
// This controls the size when you open in a huge screen
if (size.width > 1280 && size.height > 800) {
size.width = 1280;
size.height = 800;
}
this.frame.setPreferredSize(size);
this.frame.setTitle(XBayaConstants.APPLICATION_NAME);
this.frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
this.frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent event) {
int result = JOptionPane.showConfirmDialog(frame, "Are you sure you want to exit?", "Exit XBaya", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.NO_OPTION || (!closeAllGraphCanvas())) {
return;
}
logger.debug(event.toString());
XBayaGUI.this.frame.setVisible(false);
try {
XBayaGUI.this.engine.dispose();
} catch (WorkflowException e) {
// Ignore the error.
logger.error(e.getMessage(), e);
} catch (RuntimeException e) {
// Ignore the error.
logger.error(e.getMessage(), e);
}
if (XBayaGUI.this.engine.getConfiguration().isCloseOnExit()) {
System.exit(0);
}
}
@Override
public void windowClosed(WindowEvent e) {
logger.debug(e.toString());
try {
XBayaGUI.this.engine.getMonitor().stop();
} catch (MonitorException e1) {
logger.error(e1.getMessage(), e1);
}
// Dispose only when it can be disposed to prevent infinite loop
if (XBayaGUI.this.frame.isDisplayable()) {
XBayaGUI.this.frame.dispose();
}
}
});
this.frame.setIconImage(SwingUtil.createImage("airavata-2.png"));
}
use of org.apache.airavata.xbaya.XBayaConfiguration in project airavata by apache.
the class ComponentRegistryLoader method update.
@Override
public void update(Observable observable, Object o) {
if ((observable instanceof XBayaConfiguration) && (o instanceof ComponentRegistry)) {
ComponentRegistry componentRegistry = (ComponentRegistry) o;
load(componentRegistry);
}
}
Aggregations