Search in sources :

Example 6 with XulDialog

use of org.pentaho.ui.xul.containers.XulDialog in project pentaho-kettle by pentaho.

the class DatabaseDialogHarness method showDialog.

private void showDialog() {
    XulDomContainer container = null;
    try {
        DatabaseConnectionDialog dcDialog = new DatabaseConnectionDialog();
        container = dcDialog.getSwtInstance(new Shell(SWT.NONE));
        if (database != null) {
            container.getEventHandler("dataHandler").setData(database);
        }
    } catch (XulException e) {
        e.printStackTrace();
    }
    XulRoot root = (XulRoot) container.getDocumentRoot().getRootElement();
    if (root instanceof XulDialog) {
        ((XulDialog) root).show();
    }
    if (root instanceof XulWindow) {
        ((XulWindow) root).open();
    }
    try {
        database = (DatabaseMeta) container.getEventHandler("dataHandler").getData();
    } catch (Exception e) {
        e.printStackTrace();
    }
    String message = DatabaseDialogHarness.setMessage(database);
    Shell shell = new Shell(SWT.DIALOG_TRIM);
    shell.setLayout(new RowLayout());
    Label label = new Label(shell, SWT.NONE);
    label.setText(message);
    Button button = new Button(shell, SWT.NONE);
    button.setText("Edit Database ...");
    button.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            try {
                showDialog();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!shell.getDisplay().readAndDispatch()) {
            shell.getDisplay().sleep();
        }
    }
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) DatabaseConnectionDialog(org.pentaho.ui.database.DatabaseConnectionDialog) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulException(org.pentaho.ui.xul.XulException) KettleException(org.pentaho.di.core.exception.KettleException) Shell(org.eclipse.swt.widgets.Shell) XulException(org.pentaho.ui.xul.XulException) XulRoot(org.pentaho.ui.xul.containers.XulRoot) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) XulDialog(org.pentaho.ui.xul.containers.XulDialog) SelectionEvent(org.eclipse.swt.events.SelectionEvent) XulWindow(org.pentaho.ui.xul.containers.XulWindow)

Example 7 with XulDialog

use of org.pentaho.ui.xul.containers.XulDialog 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 8 with XulDialog

use of org.pentaho.ui.xul.containers.XulDialog in project data-access by pentaho.

the class MultiTableDatasource method onFinish.

@Override
public void onFinish(final XulServiceCallback<IDatasourceSummary> callback) {
    if (this.validator.allTablesJoined()) {
        String dsName = this.wizardModel.getDatasourceName();
        MultiTableDatasourceDTO dto = this.joinGuiModel.createMultiTableDatasourceDTO(dsName);
        dto.setSelectedConnection(this.connection);
        joinSelectionServiceGwtImpl.serializeJoins(dto, this.connection, new XulServiceCallback<IDatasourceSummary>() {

            public void success(IDatasourceSummary retVal) {
                callback.success(retVal);
            }

            public void error(String message, Throwable error) {
                MessageHandler.getInstance().closeWaitingDialog();
                MessageHandler.getInstance().showErrorDetailsDialog(MessageHandler.getString("ERROR"), MessageHandler.getString("multitable.ERROR_SAVING_MODEL"), error.getLocalizedMessage());
            }
        });
    } else {
        MessageHandler.getInstance().closeWaitingDialog();
        XulDialog wizardDialog = (XulDialog) document.getElementById("main_wizard_window");
        wizardDialog.show();
        this.displayErrors(this.validator.getError());
    }
}
Also used : MultiTableDatasourceDTO(org.pentaho.platform.dataaccess.datasource.wizard.service.impl.MultiTableDatasourceDTO) IDatasourceSummary(org.pentaho.platform.dataaccess.datasource.wizard.IDatasourceSummary) XulDialog(org.pentaho.ui.xul.containers.XulDialog)

Example 9 with XulDialog

use of org.pentaho.ui.xul.containers.XulDialog in project data-access by pentaho.

the class MessageHandler method showErrorDialog.

public void showErrorDialog(String title, String message, boolean showWizardDialog) {
    this.showWizardDialog = showWizardDialog;
    XulDialog errorDialog = (XulDialog) document.getElementById("errorDialog");
    errorDialog.setTitle(title);
    XulLabel errorLabel = (XulLabel) document.getElementById("errorLabel");
    errorLabel.setValue(message);
    errorDialog.show();
}
Also used : XulDialog(org.pentaho.ui.xul.containers.XulDialog) XulLabel(org.pentaho.ui.xul.components.XulLabel)

Example 10 with XulDialog

use of org.pentaho.ui.xul.containers.XulDialog in project data-access by pentaho.

the class MessageHandler method showErrorDetailsDialog.

public void showErrorDetailsDialog(String title, String message, String detailMessage) {
    XulDialog errorDialog = (XulDialog) document.getElementById("errorDetailsDialog");
    errorDialog.setTitle(title);
    XulLabel errorLabel = (XulLabel) document.getElementById("errorDetailsLabel");
    errorLabel.setValue(message);
    XulLabel detailMessageBox = (XulLabel) document.getElementById("error_dialog_details");
    detailMessageBox.setValue(detailMessage);
    errorDialog.show();
}
Also used : XulDialog(org.pentaho.ui.xul.containers.XulDialog) XulLabel(org.pentaho.ui.xul.components.XulLabel)

Aggregations

XulDialog (org.pentaho.ui.xul.containers.XulDialog)16 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)3 XulLabel (org.pentaho.ui.xul.components.XulLabel)3 SwtXulRunner (org.pentaho.ui.xul.swt.SwtXulRunner)3 Shell (org.eclipse.swt.widgets.Shell)2 KettleException (org.pentaho.di.core.exception.KettleException)2 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)2 XulException (org.pentaho.ui.xul.XulException)2 Bindable (org.pentaho.ui.xul.stereotype.Bindable)2 File (java.io.File)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 RowLayout (org.eclipse.swt.layout.RowLayout)1 Button (org.eclipse.swt.widgets.Button)1 Label (org.eclipse.swt.widgets.Label)1 IDatasourceSummary (org.pentaho.platform.dataaccess.datasource.wizard.IDatasourceSummary)1 MultiTableDatasourceDTO (org.pentaho.platform.dataaccess.datasource.wizard.service.impl.MultiTableDatasourceDTO)1 DatabaseConnectionDialog (org.pentaho.ui.database.DatabaseConnectionDialog)1 XulTextbox (org.pentaho.ui.xul.components.XulTextbox)1 XulRoot (org.pentaho.ui.xul.containers.XulRoot)1