Search in sources :

Example 1 with MetadataImportDialogModel

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

the class GwtDatasourceEditorEntryPoint method showMetadataImportDialog.

private void showMetadataImportDialog(final JavaScriptObject callback) {
    final DialogListener<MetadataImportDialogModel> listener = new DialogListener<MetadataImportDialogModel>() {

        public void onDialogCancel() {
        }

        public void onDialogAccept(final MetadataImportDialogModel importDialogModel) {
            MetadataDatasourceServiceGwtImpl service = new MetadataDatasourceServiceGwtImpl();
            service.importMetadataDatasource(importDialogModel.getDomainId(), importDialogModel.getUploadedFile(), importDialogModel.getLocalizedBundleEntries(), 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
        }
    };
    showMetadataImportDialog(listener);
}
Also used : MetadataDatasourceServiceGwtImpl(org.pentaho.platform.dataaccess.datasource.wizard.service.impl.MetadataDatasourceServiceGwtImpl) DialogListener(org.pentaho.ui.xul.util.DialogController.DialogListener) MetadataImportDialogModel(org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogModel)

Example 2 with MetadataImportDialogModel

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

MetadataImportDialogModel (org.pentaho.platform.dataaccess.datasource.ui.importing.MetadataImportDialogModel)2 DialogListener (org.pentaho.ui.xul.util.DialogController.DialogListener)2 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 MetadataDatasourceServiceGwtImpl (org.pentaho.platform.dataaccess.datasource.wizard.service.impl.MetadataDatasourceServiceGwtImpl)1 AsyncConstructorListener (org.pentaho.ui.xul.gwt.util.AsyncConstructorListener)1