Search in sources :

Example 1 with AnalysisImportDialogModel

use of org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel 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 AnalysisImportDialogModel

use of org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel in project data-access by pentaho.

the class GwtDatasourceEditorEntryPoint method showAnalysisImportDialog.

private void showAnalysisImportDialog(final JavaScriptObject callback) {
    final DialogListener<AnalysisImportDialogModel> listener = new DialogListener<AnalysisImportDialogModel>() {

        public void onDialogCancel() {
        }

        public void onDialogAccept(final AnalysisImportDialogModel importDialogModel) {
            AnalysisDatasourceServiceGwtImpl service = new AnalysisDatasourceServiceGwtImpl();
            service.importAnalysisDatasource(importDialogModel.getUploadedFile(), importDialogModel.getConnection().getName(), importDialogModel.getParameters(), new XulServiceCallback<String>() {

                @Override
                public void success(String retVal) {
                    notifyDialogCallbackSuccess(callback, retVal);
                }

                @Override
                public void error(String message, Throwable error) {
                    notifyDialogCallbackError(callback, message);
                }
            });
        }

        public void onDialogReady() {
        }

        @Override
        public void onDialogError(String errorMessage) {
        // TODO Auto-generated method stub
        }
    };
    showAnalysisImportDialog(listener);
}
Also used : AnalysisDatasourceServiceGwtImpl(org.pentaho.platform.dataaccess.datasource.wizard.service.impl.AnalysisDatasourceServiceGwtImpl) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) AnalysisImportDialogModel(org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel)

Example 3 with AnalysisImportDialogModel

use of org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel 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)

Aggregations

AnalysisImportDialogModel (org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel)3 DialogListener (org.pentaho.ui.xul.util.DialogController.DialogListener)3 FormPanel (com.google.gwt.user.client.ui.FormPanel)2 SubmitCompleteEvent (com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent)2 SubmitCompleteHandler (com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler)2 AnalysisImportDialogController (org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogController)2 GwtImportDialog (org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog)2 AsyncConstructorListener (org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)2 AnalysisDatasourceServiceGwtImpl (org.pentaho.platform.dataaccess.datasource.wizard.service.impl.AnalysisDatasourceServiceGwtImpl)1