use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class FileImportController method init.
@Bindable
public void init() {
bf = new GwtBindingFactory(document);
// $NON-NLS-1$
fileUpload = (XulFileUpload) document.getElementById("fileUpload");
// $NON-NLS-1$
datasourceDialog = (XulDialog) document.getElementById("fileImportEditorWindow");
// $NON-NLS-1$
errorLabel = (XulLabel) document.getElementById("errorLabel");
// $NON-NLS-1$
errorDialog = (XulDialog) document.getElementById("errorDialog");
BindingConvertor<String, Boolean> isDisabledConvertor = new BindingConvertor<String, Boolean>() {
@Override
public Boolean sourceToTarget(String aValue) {
return (aValue == null || "".equals(aValue));
}
@Override
public String targetToSource(Boolean aValue) {
return null;
}
};
bf.createBinding("fileUpload", "selectedFile", "okButton", "disabled", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
isDisabledConvertor);
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class MainWizardController method finish.
@Bindable
public // TODO: migrate to CSV datasource
void finish() {
if (finishButton.isDisabled()) {
return;
}
finishButton.setDisabled(true);
final String datasourceName = this.wizardModel.getDatasourceName();
// Validating whether the datasource name contains any illegal characters
if (isDatasourceNameValid(datasourceName)) {
UIDatasourceServiceManager manager = UIDatasourceServiceManager.getInstance();
manager.getIds(new XulServiceCallback<List<IDatasourceInfo>>() {
@Override
public void success(List<IDatasourceInfo> datasourceInfos) {
finishButton.setDisabled(false);
boolean isEditing = wizardModel.isEditing();
List<String> datasourceNames = new ArrayList<String>();
for (IDatasourceInfo datasourceInfo : datasourceInfos) {
if (datasourceInfo.getType().equals("Data Source Wizard") || datasourceInfo.getType().equals("Analysis")) {
datasourceNames.add(datasourceInfo.getName());
}
}
if (datasourceNames.contains(datasourceName) && !isEditing) {
showWarningDialog();
} else {
setFinished();
}
}
@Override
public void error(String s, Throwable throwable) {
finishButton.setDisabled(false);
throwable.printStackTrace();
MessageHandler.getInstance().showErrorDialog(throwable.getMessage());
}
});
} else {
finishButton.setDisabled(false);
MessageHandler.getInstance().showErrorDialog("Error", // $NON-NLS-1$
MessageHandler.getString("DatasourceEditor.ERROR_0005_INVALID_DATASOURCE_NAME", NameUtils.reservedCharListForDisplay(" ")), // $NON-NLS-1$
true);
}
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class DatasourceSelectionDialogController method removeDatasourceConfirm.
@Bindable
public void removeDatasourceConfirm() {
if (messageBundle != null) {
XulLabel removeDatasourceConfirmationDialogLabel = (XulLabel) removeDatasourceConfirmationDialog.getElementById("removeDatasourceConfirmationDialogLabel");
LogicalModelSummary logicalModelSummary = getDialogResult();
if (removeDatasourceConfirmationDialogLabel != null && logicalModelSummary != null) {
removeDatasourceConfirmationDialogLabel.setValue(messageBundle.getString(REMOVE_DS_MSG_ID, logicalModelSummary.getModelName()));
}
}
removeDatasourceConfirmationDialog.show();
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class DatasourceSelectionDialogController method init.
// ~ Methods =========================================================================================================
/**
* Sets up bindings.
*/
@Bindable
public void init() {
internalInit();
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "plugin/data-access/api/permissions/hasDataAccess";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
builder.setHeader("accept", "application/json");
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
// $NON-NLS-1$
showMessagebox("Error", exception.getLocalizedMessage());
}
public void onResponseReceived(Request request, Response response) {
boolean hasDataAccess = new Boolean(response.getText());
DatasourceSelectionDialogController.this.administrator = hasDataAccess;
addDatasourceButton.setVisible(hasDataAccess);
editDatasourceButton.setVisible(hasDataAccess);
removeDatasourceButton.setVisible(hasDataAccess);
try {
removeDatasourceButtonBinding.fireSourceChanged();
editDatasourceButtonBinding.fireSourceChanged();
} catch (Exception e) {
// $NON-NLS-1$
showMessagebox("Error", e.getLocalizedMessage());
}
}
});
} catch (RequestException e) {
// Do Nothing
}
}
use of org.pentaho.ui.xul.stereotype.Bindable in project data-access by pentaho.
the class ColumnInfo method getAvailableDataTypes.
@Bindable
public static List<DataType> getAvailableDataTypes() {
if (availableDataTypes == null || availableDataTypes.size() == 0) {
ArrayList<DataType> types = new ArrayList<DataType>();
DataType[] dt = DataType.values();
for (DataType dataType : dt) {
// don't support url, binary, unknown, or image in csv
switch(dataType) {
case URL:
case BINARY:
case IMAGE:
case UNKNOWN:
break;
default:
// types.add(dataType.getDescription());
types.add(dataType);
break;
}
}
availableDataTypes = types;
}
return availableDataTypes;
}
Aggregations