Search in sources :

Example 1 with MetadataImportDialogController

use of org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogController 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)1 GwtImportDialog (org.pentaho.platform.dataaccess.datasource.ui.importing.GwtImportDialog)1 MetadataImportDialogController (org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogController)1 MetadataImportDialogModel (org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogModel)1 AsyncConstructorListener (org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)1 DialogListener (org.pentaho.ui.xul.util.DialogController.DialogListener)1