Search in sources :

Example 1 with SwingXulLoader

use of org.pentaho.ui.xul.swing.SwingXulLoader in project pentaho-kettle by pentaho.

the class SwingTest method showDialog.

private void showDialog(final Document doc) {
    XulDomContainer container = null;
    try {
        container = new SwingXulLoader().loadXul(DatabaseConnectionDialog.DIALOG_DEFINITION_FILE, Messages.getBundle());
        if (database != null) {
            container.getEventHandler("dataHandler").setData(database);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    XulDialog dialog = (XulDialog) container.getDocumentRoot().getRootElement();
    container.initialize();
    dialog.show();
    try {
        @SuppressWarnings("unused") Object data = container.getEventHandler("dataHandler").getData();
    } catch (XulException e) {
        System.out.println("Error getting data");
    }
}
Also used : XulException(org.pentaho.ui.xul.XulException) XulDialog(org.pentaho.ui.xul.containers.XulDialog) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) SwingXulLoader(org.pentaho.ui.xul.swing.SwingXulLoader) XulException(org.pentaho.ui.xul.XulException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 2 with SwingXulLoader

use of org.pentaho.ui.xul.swing.SwingXulLoader in project mondrian by pentaho.

the class Workbench method connectionButtonActionPerformed.

private void connectionButtonActionPerformed(ActionEvent evt) {
    if (connectionDialog == null) {
        dbMeta = getDbMeta(null);
        connectionDialogController = new DataHandler();
        connectionDialogController.setName("dataHandler");
        XulDomContainer container = null;
        try {
            XulLoader loader = new SwingXulLoader();
            container = loader.loadXul(DatabaseConnectionDialog.DIALOG_DEFINITION_FILE, Messages.getBundle());
        } catch (XulException e) {
            throw new RuntimeException("Xul failed to initialize", e);
        }
        container.addEventHandler(connectionDialogController);
        connectionDialogController.loadConnectionData();
        connectionDialogController.setData(dbMeta);
        connectionDialog = (XulDialog) container.getDocumentRoot().getRootElement();
    }
    connectionDialog.show();
    dbMeta = (DatabaseMeta) connectionDialogController.getData();
    if (dbMeta.hasChanged()) {
        dbMeta.clearChanged();
        syncToWorkspace(dbMeta);
        // Enforces the JDBC preferences entered throughout all schemas
        // currently opened in the workbench.
        resetWorkbench();
    }
}
Also used : SwingXulLoader(org.pentaho.ui.xul.swing.SwingXulLoader) DataHandler(org.pentaho.ui.database.event.DataHandler) SwingXulLoader(org.pentaho.ui.xul.swing.SwingXulLoader)

Aggregations

SwingXulLoader (org.pentaho.ui.xul.swing.SwingXulLoader)2 KettleException (org.pentaho.di.core.exception.KettleException)1 DataHandler (org.pentaho.ui.database.event.DataHandler)1 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)1 XulException (org.pentaho.ui.xul.XulException)1 XulDialog (org.pentaho.ui.xul.containers.XulDialog)1