use of org.pentaho.ui.xul.util.DialogController.DialogListener 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);
}
use of org.pentaho.ui.xul.util.DialogController.DialogListener in project data-access by pentaho.
the class GwtDatasourceEditorEntryPoint method showWizardEdit.
/**
* edit entry-point from Javascript, responds to provided callback with the following:
* <p>
* onOk(String JSON, String mqlString);
* onCancel();
* onError(String errorMessage);
*
* @param callback
*/
private void showWizardEdit(final String domainId, final String modelId, final String perspective, boolean reportingOnlyValid, final JavaScriptObject callback) {
final DialogListener<Domain> listener = new DialogListener<Domain>() {
public void onDialogCancel() {
modeler.removeDialogListener(this);
if (callback != null) {
notifyCallbackCancel(callback);
}
}
public void onDialogAccept(final Domain domain) {
modeler.removeDialogListener(this);
WAQRTransport transport = WAQRTransport.createFromMetadata(domain);
notifyCallbackSuccess(callback, true, transport);
}
public void onDialogReady() {
if (callback != null) {
notifyCallbackReady(callback);
}
}
@Override
public void onDialogError(String errorMessage) {
notifyCallbackError(callback, errorMessage);
}
};
showWizardEdit(domainId, modelId, perspective, reportingOnlyValid, listener);
}
use of org.pentaho.ui.xul.util.DialogController.DialogListener 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);
}
}
use of org.pentaho.ui.xul.util.DialogController.DialogListener 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);
}
use of org.pentaho.ui.xul.util.DialogController.DialogListener in project data-access by pentaho.
the class ConnectionController method addConnection.
@Bindable
public void addConnection() {
RequestBuilder addConnectionBuilder = new RequestBuilder(RequestBuilder.POST, ConnectionController.getServiceURL("add"));
addConnectionBuilder.setHeader("Content-Type", "application/json");
try {
AutoBean<IDatabaseConnection> bean = createIDatabaseConnectionBean(currentConnection);
addConnectionBuilder.sendRequest(AutoBeanCodex.encode(bean).getPayload(), new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
displayErrorMessage(exception);
}
@Override
public void onResponseReceived(Request request, Response response) {
try {
if (response.getStatusCode() == Response.SC_OK) {
datasourceModel.getGuiStateModel().addConnection(currentConnection);
datasourceModel.setSelectedRelationalConnection(currentConnection);
DialogListener dialogListener = connectionSetter.getOuterListener();
if (dialogListener != null) {
dialogListener.onDialogAccept(currentConnection);
}
} else {
openErrorDialog(MessageHandler.getString("ERROR"), // $NON-NLS-1$
MessageHandler.getString(// $NON-NLS-1$
"ConnectionController.ERROR_0001_UNABLE_TO_ADD_CONNECTION"));
}
} catch (Exception e) {
displayErrorMessage(e);
}
}
});
} catch (RequestException e) {
displayErrorMessage(e);
}
}
Aggregations