Search in sources :

Example 1 with ModelerDialog

use of org.pentaho.platform.dataaccess.datasource.modeler.ModelerDialog in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showWizardEdit.

public void showWizardEdit(final String domainId, final String modelId, final String perspective, boolean reportingOnlyValid, final DialogListener<Domain> listener) {
    final String modelPerspective;
    if (perspective == null) {
        modelPerspective = ModelerPerspective.ANALYSIS.name();
    } else {
        modelPerspective = perspective;
    }
    modeler = ModelerDialog.getInstance(wizard, new AsyncConstructorListener<ModelerDialog>() {

        public void asyncConstructorDone(ModelerDialog dialog) {
            ModelerPerspective modelerPerspective;
            try {
                modelerPerspective = ModelerPerspective.valueOf(modelPerspective);
            } catch (IllegalArgumentException e) {
                modelerPerspective = ModelerPerspective.ANALYSIS;
            }
            dialog.addDialogListener(listener);
            dialog.showDialog(domainId, modelId, modelerPerspective);
        }
    });
}
Also used : ModelerDialog(org.pentaho.platform.dataaccess.datasource.modeler.ModelerDialog) ModelerPerspective(org.pentaho.agilebi.modeler.ModelerPerspective) AsyncConstructorListener(org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)

Example 2 with ModelerDialog

use of org.pentaho.platform.dataaccess.datasource.modeler.ModelerDialog in project data-access by pentaho.

the class EmbeddedWizard method showModelEditor.

@Bindable
public void showModelEditor() {
    // open up the modeler
    final DialogListener<Domain> listener = new DialogListener<Domain>() {

        public void onDialogCancel() {
            EmbeddedWizard.this.onDialogAccept();
            wizardController.resetSelectedDatasource();
        }

        public void onDialogAccept(final Domain domain) {
            EmbeddedWizard.this.onDialogAccept();
            wizardController.resetSelectedDatasource();
        }

        public void onDialogReady() {
        }

        @Override
        public void onDialogError(String errorMessage) {
            wizardController.resetSelectedDatasource();
        }
    };
    final String domainId = summary.getDomain().getId();
    final EmbeddedWizard wizard = this;
    // reload model for synchronize between GWT model and backend model http://jira.pentaho.com/browse/BISERVER-10399
    GwtModelerServiceImpl ssd = new GwtModelerServiceImpl();
    ssd.loadDomain(domainId, new XulServiceCallback<Domain>() {

        @Override
        public void error(String arg0, Throwable arg1) {
            // js console log
            arg1.printStackTrace();
            wizardController.resetSelectedDatasource();
            MessageHandler.getInstance().closeWaitingDialog();
            // user error dialog
            MessageHandler.getInstance().showErrorDialog(// $NON-NLS-1$
            datasourceMessages.getString("DatasourceEditor.ERROR"), // $NON-NLS-1$ );
            datasourceMessages.getString("DatasourceEditor.ERROR_0002_UNABLE_TO_SHOW_DIALOG", arg1.getLocalizedMessage()));
        }

        @Override
        public void success(Domain arg0) {
            summary.setDomain(arg0);
            final Domain domain = summary.getDomain();
            ModelerDialog.getInstance(wizard, new AsyncConstructorListener<ModelerDialog>() {

                public void asyncConstructorDone(ModelerDialog dialog) {
                    dialog.addDialogListener(listener);
                    MessageHandler.getInstance().closeWaitingDialog();
                    dialog.showDialog(domain);
                }
            });
        }
    });
}
Also used : GwtModelerServiceImpl(org.pentaho.agilebi.modeler.services.impl.GwtModelerServiceImpl) ModelerDialog(org.pentaho.platform.dataaccess.datasource.modeler.ModelerDialog) Domain(org.pentaho.metadata.model.Domain) AsyncConstructorListener(org.pentaho.ui.xul.gwt.util.AsyncConstructorListener) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Aggregations

ModelerDialog (org.pentaho.platform.dataaccess.datasource.modeler.ModelerDialog)2 AsyncConstructorListener (org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)2 ModelerPerspective (org.pentaho.agilebi.modeler.ModelerPerspective)1 GwtModelerServiceImpl (org.pentaho.agilebi.modeler.services.impl.GwtModelerServiceImpl)1 Domain (org.pentaho.metadata.model.Domain)1 Bindable (org.pentaho.ui.xul.stereotype.Bindable)1