Search in sources :

Example 1 with GwtImportDialog

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

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

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

FormPanel (com.google.gwt.user.client.ui.FormPanel)3 GwtImportDialog (org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog)3 AsyncConstructorListener (org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)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 AnalysisImportDialogController (org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogController)2 AnalysisImportDialogModel (org.pentaho.platform.dataaccess.datasource.ui.importing.AnalysisImportDialogModel)2 MetadataImportDialogController (org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogController)1 MetadataImportDialogModel (org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogModel)1