Search in sources :

Example 1 with WAQRTransport

use of org.pentaho.platform.dataaccess.datasource.wizard.jsni.WAQRTransport in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showWizardEdit.

/**
 * edit entry-point from Javascript, responds to provided callback with the following:
 * <p>
 * onOk(String JSON, String mqlString);
 * onCancel();
 * onError(String errorMessage);
 *
 * @param callback
 */
private void showWizardEdit(final String domainId, final String modelId, final String perspective, boolean reportingOnlyValid, final JavaScriptObject callback) {
    final DialogListener<Domain> listener = new DialogListener<Domain>() {

        public void onDialogCancel() {
            modeler.removeDialogListener(this);
            if (callback != null) {
                notifyCallbackCancel(callback);
            }
        }

        public void onDialogAccept(final Domain domain) {
            modeler.removeDialogListener(this);
            WAQRTransport transport = WAQRTransport.createFromMetadata(domain);
            notifyCallbackSuccess(callback, true, transport);
        }

        public void onDialogReady() {
            if (callback != null) {
                notifyCallbackReady(callback);
            }
        }

        @Override
        public void onDialogError(String errorMessage) {
            notifyCallbackError(callback, errorMessage);
        }
    };
    showWizardEdit(domainId, modelId, perspective, reportingOnlyValid, listener);
}
Also used : WAQRTransport(org.pentaho.platform.dataaccess.datasource.wizard.jsni.WAQRTransport) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) Domain(org.pentaho.metadata.model.Domain)

Example 2 with WAQRTransport

use of org.pentaho.platform.dataaccess.datasource.wizard.jsni.WAQRTransport in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showWizard.

/**
 * Entry-point from Javascript, responds to provided callback with the following:
 * <p>
 * onOk(String JSON, String mqlString);
 * onCancel();
 * onError(String errorMessage);
 *
 * @param callback
 */
private void showWizard(final boolean reportingOnlyValid, final JavaScriptObject callback) {
    final DialogListener<Domain> listener = new DialogListener<Domain>() {

        public void onDialogCancel() {
            wizard.removeDialogListener(this);
            if (callback != null) {
                notifyCallbackCancel(callback);
            }
        }

        public void onDialogAccept(final Domain domain) {
            MessageHandler.getInstance().closeWaitingDialog();
            wizard.removeDialogListener(this);
            WAQRTransport transport = WAQRTransport.createFromMetadata(domain);
            notifyCallbackSuccess(callback, true, transport);
            notifyDialogCallbackSuccess(callback, domain.getId());
        }

        public void onDialogReady() {
            if (callback != null) {
                notifyCallbackReady(callback);
            }
        }

        @Override
        public void onDialogError(String errorMessage) {
            notifyCallbackError(callback, errorMessage);
        }
    };
    showWizard(reportingOnlyValid, listener);
}
Also used : WAQRTransport(org.pentaho.platform.dataaccess.datasource.wizard.jsni.WAQRTransport) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) Domain(org.pentaho.metadata.model.Domain)

Aggregations

Domain (org.pentaho.metadata.model.Domain)2 WAQRTransport (org.pentaho.platform.dataaccess.datasource.wizard.jsni.WAQRTransport)2 DialogListener (org.pentaho.ui.xul.util.DialogController.DialogListener)2