Search in sources :

Example 1 with XBayaConfiguration

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());
    }
}
Also used : XBayaConfiguration(org.apache.airavata.xbaya.XBayaConfiguration) ThriftClientData(org.apache.airavata.xbaya.ThriftClientData) AiravataClientConnectException(org.apache.airavata.model.error.AiravataClientConnectException) ApplicationSettingsException(org.apache.airavata.common.exception.ApplicationSettingsException)

Example 2 with XBayaConfiguration

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"));
}
Also used : XBayaConfiguration(org.apache.airavata.xbaya.XBayaConfiguration) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) JFrame(javax.swing.JFrame) WindowEvent(java.awt.event.WindowEvent) WorkflowException(org.apache.airavata.workflow.model.exceptions.WorkflowException) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) InvocationTargetException(java.lang.reflect.InvocationTargetException) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) MonitorException(org.apache.airavata.xbaya.messaging.MonitorException) WorkflowException(org.apache.airavata.workflow.model.exceptions.WorkflowException) MonitorException(org.apache.airavata.xbaya.messaging.MonitorException)

Example 3 with XBayaConfiguration

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);
    }
}
Also used : XBayaConfiguration(org.apache.airavata.xbaya.XBayaConfiguration) ComponentRegistry(org.apache.airavata.workflow.model.component.ComponentRegistry)

Aggregations

XBayaConfiguration (org.apache.airavata.xbaya.XBayaConfiguration)3 Dimension (java.awt.Dimension)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 JFrame (javax.swing.JFrame)1 ApplicationSettingsException (org.apache.airavata.common.exception.ApplicationSettingsException)1 AiravataClientConnectException (org.apache.airavata.model.error.AiravataClientConnectException)1 ComponentRegistry (org.apache.airavata.workflow.model.component.ComponentRegistry)1 WorkflowException (org.apache.airavata.workflow.model.exceptions.WorkflowException)1 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)1 ThriftClientData (org.apache.airavata.xbaya.ThriftClientData)1 MonitorException (org.apache.airavata.xbaya.messaging.MonitorException)1