use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class ConnectionController method overwriteCheck.
@Bindable
public void overwriteCheck() {
if (!saveConnectionConfirmationDialog.isHidden()) {
closeSaveConnectionConfirmationDialog();
}
if (!renameConnectionConfirmationDialog.isHidden()) {
closeRenameConnectionConfirmationDialog();
}
if (datasourceModel.isEditing() && previousConnectionName.equals(currentConnection.getName())) {
// if editing and no name change, proceed.
updateConnection();
} else {
// either new connection, or editing involved a name change.
RequestBuilder checkConnectionBuilder = new RequestBuilder(RequestBuilder.GET, getServiceURL("getid", new String[][] { { "name", currentConnection.getName() } }));
checkConnectionBuilder.setHeader("Content-Type", "application/json");
try {
checkConnectionBuilder.sendRequest(null, new RequestCallback() {
public void onResponseReceived(Request request, Response response) {
switch(response.getStatusCode()) {
case Response.SC_OK:
existingConnectionId = response.getText();
showOverwriteConnectionConfirmationDialog();
break;
case Response.SC_NOT_FOUND:
saveConnection();
break;
default:
// TODO: error message
saveConnection();
}
}
public void onError(Request request, Throwable exception) {
displayErrorMessage(exception);
}
});
} catch (Exception e) {
displayErrorMessage(e);
}
}
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class ConnectionController method deleteConnection.
@Bindable
public void deleteConnection() {
removeConfirmationDialog.hide();
RequestBuilder deleteConnectionBuilder = new RequestBuilder(RequestBuilder.DELETE, getServiceURL("deletebyname", new String[][] { { "name", datasourceModel.getSelectedRelationalConnection().getName() } }));
try {
deleteConnectionBuilder.sendRequest(null, 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) {
openSuccesDialog(MessageHandler.getString("SUCCESS"), // $NON-NLS-1$
MessageHandler.getString(// $NON-NLS-1$
"ConnectionController.CONNECTION_DELETED"));
datasourceModel.getGuiStateModel().deleteConnection(datasourceModel.getSelectedRelationalConnection().getName());
List<IDatabaseConnection> connections = datasourceModel.getGuiStateModel().getConnections();
if (connections != null && connections.size() > 0) {
datasourceModel.setSelectedRelationalConnection(connections.get(connections.size() - 1));
} else {
datasourceModel.setSelectedRelationalConnection(null);
}
} else {
openErrorDialog(MessageHandler.getString("ERROR"), // $NON-NLS-1$
MessageHandler.getString(// $NON-NLS-1$
"ConnectionController.ERROR_0002_UNABLE_TO_DELETE_CONNECTION"));
}
} catch (Exception e) {
displayErrorMessage(e);
}
}
});
} catch (RequestException e) {
displayErrorMessage(e);
}
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class ConnectionController method init.
@Bindable
public void init() {
XulServiceCallback<List<IDatabaseType>> callback = new XulServiceCallback<List<IDatabaseType>>() {
public void error(String message, Throwable error) {
error.printStackTrace();
}
public void success(List<IDatabaseType> retVal) {
databaseTypeHelper = new DatabaseTypeHelper(retVal);
}
};
dialectService.getDatabaseTypes(callback);
saveConnectionConfirmationDialog = // $NON-NLS-1$
(XulDialog) document.getElementById("saveConnectionConfirmationDialogConnectionController");
overwriteConnectionConfirmationDialog = (XulDialog) document.getElementById("overwriteConnectionConfirmationDialogConnectionController");
renameConnectionConfirmationDialog = (XulDialog) document.getElementById("renameConnectionConfirmationDialogConnectionController");
// $NON-NLS-1$
errorDialog = (XulDialog) document.getElementById("errorDialog");
// $NON-NLS-1$
errorLabel = (XulLabel) document.getElementById("errorLabel");
// $NON-NLS-1$
successDialog = (XulDialog) document.getElementById("successDialog");
// $NON-NLS-1$
successLabel = (XulLabel) document.getElementById("successLabel");
// $NON-NLS-1$
removeConfirmationDialog = (XulDialog) document.getElementById("removeConfirmationDialogConnectionController");
// $NON-NLS-1$
successDetailsDialog = (XulDialog) document.getElementById("successDetailsDialogConnectionController");
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class MainWizardController method setSelectedDatasource.
@Bindable
public void setSelectedDatasource(IWizardDatasource datasource) {
IWizardDatasource prevSelection = activeDatasource;
activeDatasource = datasource;
if (datasource == null || prevSelection == activeDatasource) {
return;
}
try {
datasource.activating();
if (prevSelection != null) {
steps.removeAll(prevSelection.getSteps());
prevSelection.deactivating();
}
for (int i = 1; i < datasource.getSteps().size(); i++) {
steps.add(datasource.getSteps().get(i));
}
steps.addAll(datasource.getSteps());
wizardModel.setSelectedDatasource(datasource);
activeStep = 0;
updateBindings();
} catch (XulException e) {
// To change body of catch statement use File | Settings | File Templates.
e.printStackTrace();
}
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class DatasourceSelectionDialogController method removeDatasourceAccept.
@Bindable
public void removeDatasourceAccept() {
if (removeDatasourceButton.isDisabled()) {
return;
}
removeDatasourceButton.setDisabled(true);
LogicalModelSummary logicalModelSummary = getDialogResult();
datasourceService.deleteLogicalModel(logicalModelSummary.getDomainId(), logicalModelSummary.getModelId(), new XulServiceCallback<Boolean>() {
public void error(String message, Throwable error) {
// $NON-NLS-1$
showMessagebox("Error", error.getLocalizedMessage());
removeDatasourceButton.setDisabled(false);
}
public void success(Boolean retVal) {
refreshDatasources(null, null);
removeDatasourceConfirmationDialog.hide();
removeDatasourceButton.setDisabled(false);
}
});
}
Aggregations