Search in sources :

Example 1 with AsyncConstructorListener

use of org.pentaho.ui.xul.gwt.util.AsyncConstructorListener in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showAnalysisImportDialog.

public void showAnalysisImportDialog(final DialogListener listener) {
    final DialogListener<AnalysisImportDialogModel> importDialoglistener = new DialogListener<AnalysisImportDialogModel>() {

        public void onDialogCancel() {
            final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
        }

        public void onDialogAccept(final AnalysisImportDialogModel importDialogModel) {
            final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
            analysisDataFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

                @Override
                public void onSubmitComplete(SubmitCompleteEvent event) {
                    String results = event.getResults();
                    String message = controller.convertToNLSMessage(results, controller.getFileName());
                    if (!SUCCESS_3.equals(results)) {
                        if (OVERWRITE_8.equals(results) || OVERWRITE__CATALOG_7.equals(results)) {
                            overwriteFileDialog(analysisDataFormPanel, message, controller);
                        } else {
                            listener.onDialogError(message);
                        }
                    } else {
                        analysisDataFormPanel.removeFromParent();
                        listener.onDialogAccept(null);
                    }
                }
            });
            analysisDataFormPanel.submit();
        }

        public void onDialogReady() {
        }

        @Override
        public void onDialogError(String errorMessage) {
            listener.onDialogError(errorMessage);
        }
    };
    final AsyncConstructorListener<GwtImportDialog> constructorListener = new AsyncConstructorListener<GwtImportDialog>() {

        public void asyncConstructorDone(GwtImportDialog dialog) {
            dialog.showAnalysisImportDialog(importDialoglistener);
        }
    };
    if (importDialog == null) {
        importDialog = new GwtImportDialog(constructorListener);
    } else {
        importDialog.showAnalysisImportDialog(importDialoglistener);
    }
}
Also used : AnalysisImportDialogController(org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogController) FormPanel(com.google.gwt.user.client.ui.FormPanel) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) SubmitCompleteEvent(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent) SubmitCompleteHandler(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler) GwtImportDialog(org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog) AsyncConstructorListener(org.pentaho.ui.xul.gwt.util.AsyncConstructorListener) AnalysisImportDialogModel(org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel)

Example 2 with AsyncConstructorListener

use of org.pentaho.ui.xul.gwt.util.AsyncConstructorListener 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 3 with AsyncConstructorListener

use of org.pentaho.ui.xul.gwt.util.AsyncConstructorListener 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)

Example 4 with AsyncConstructorListener

use of org.pentaho.ui.xul.gwt.util.AsyncConstructorListener in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showEditAnalysisDialog.

public void showEditAnalysisDialog(final DialogListener listener, final IDatasourceInfo datasourceInfo) {
    final DialogListener<AnalysisImportDialogModel> importDialoglistener = new DialogListener<AnalysisImportDialogModel>() {

        public void onDialogCancel() {
            final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
        }

        public void onDialogAccept(final AnalysisImportDialogModel importDialogModel) {
            final AnalysisImportDialogController controller = importDialog.getAnalysisImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters(true);
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
            analysisDataFormPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() {

                @Override
                public void onSubmitComplete(SubmitCompleteEvent event) {
                    String results = event.getResults();
                    String message = controller.convertToNLSMessage(results, controller.getFileName());
                    if (!SUCCESS_3.equals(results)) {
                        if (OVERWRITE_8.equals(results) || OVERWRITE__CATALOG_7.equals(results)) {
                            overwriteFileDialog(analysisDataFormPanel, message, controller);
                        } else {
                            listener.onDialogError(message);
                        }
                    } else {
                        analysisDataFormPanel.removeFromParent();
                        listener.onDialogAccept(null);
                    }
                }
            });
            analysisDataFormPanel.submit();
        }

        public void onDialogReady() {
        }

        public void onDialogError(String errorMessage) {
            listener.onDialogError(errorMessage);
        }
    };
    final AsyncConstructorListener<GwtImportDialog> constructorListener = new AsyncConstructorListener<GwtImportDialog>() {

        public void asyncConstructorDone(GwtImportDialog dialog) {
            dialog.showAnalysisImportDialog(importDialoglistener, datasourceInfo);
        }
    };
    if (importDialog == null) {
        importDialog = new GwtImportDialog(constructorListener);
    } else {
        importDialog.showAnalysisImportDialog(importDialoglistener, datasourceInfo);
    }
}
Also used : AnalysisImportDialogController(org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogController) FormPanel(com.google.gwt.user.client.ui.FormPanel) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) SubmitCompleteEvent(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent) SubmitCompleteHandler(com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler) GwtImportDialog(org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog) AsyncConstructorListener(org.pentaho.ui.xul.gwt.util.AsyncConstructorListener) AnalysisImportDialogModel(org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel)

Example 5 with AsyncConstructorListener

use of org.pentaho.ui.xul.gwt.util.AsyncConstructorListener in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showMetadataImportDialog.

public void showMetadataImportDialog(final DialogListener listener) {
    final DialogListener<MetadataImportDialogModel> importDialoglistener = new DialogListener<MetadataImportDialogModel>() {

        public void onDialogCancel() {
            final MetadataImportDialogController controller = importDialog.getMetadataImportDialogController();
            final FormPanel analysisDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            analysisDataFormPanel.removeFromParent();
            RootPanel.get().add(analysisDataFormPanel);
        }

        public void onDialogAccept(final MetadataImportDialogModel importDialogModel) {
            final MetadataImportDialogController controller = importDialog.getMetadataImportDialogController();
            final FormPanel metaDataFormPanel = controller.getFormPanel();
            controller.removeHiddenPanels();
            controller.buildAndSetParameters();
            metaDataFormPanel.removeFromParent();
            RootPanel.get().add(metaDataFormPanel);
            controller.setImportCompleteCallback(new MetadataImportDialogController.ImportCompleteCallback() {

                @Override
                public void onImportSuccess() {
                    listener.onDialogAccept(null);
                }

                @Override
                public void onImportCancel() {
                    listener.onDialogCancel();
                }
            });
            metaDataFormPanel.submit();
        }

        public void onDialogReady() {
        }

        @Override
        public void onDialogError(String errorMessage) {
            listener.onDialogError(errorMessage);
        }
    };
    final AsyncConstructorListener<GwtImportDialog> constructorListener = new AsyncConstructorListener<GwtImportDialog>() {

        public void asyncConstructorDone(GwtImportDialog dialog) {
            dialog.showMetadataImportDialog(importDialoglistener);
        }
    };
    if (importDialog == null) {
        importDialog = new GwtImportDialog(constructorListener);
    } else {
        importDialog.showMetadataImportDialog(importDialoglistener);
    }
}
Also used : FormPanel(com.google.gwt.user.client.ui.FormPanel) MetadataImportDialogController(org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogController) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) MetadataImportDialogModel(org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogModel) GwtImportDialog(org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog) AsyncConstructorListener(org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)

Aggregations

AsyncConstructorListener (org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)5 FormPanel (com.google.gwt.user.client.ui.FormPanel)3 GwtImportDialog (org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog)3 DialogListener (org.pentaho.ui.xul.util.DialogController.DialogListener)3 SubmitCompleteEvent (com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent)2 SubmitCompleteHandler (com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler)2 ModelerDialog (org.pentaho.platform.dataaccess.datasource.modeler.ModelerDialog)2 AnalysisImportDialogController (org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogController)2 AnalysisImportDialogModel (org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel)2 ModelerPerspective (org.pentaho.agilebi.modeler.ModelerPerspective)1 GwtModelerServiceImpl (org.pentaho.agilebi.modeler.services.impl.GwtModelerServiceImpl)1 Domain (org.pentaho.metadata.model.Domain)1 MetadataImportDialogController (org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogController)1 MetadataImportDialogModel (org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogModel)1 Bindable (org.pentaho.ui.xul.stereotype.Bindable)1