use of org.pentaho.ui.xul.binding.Binding in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestController method bindSelectedMaxRows.
private void bindSelectedMaxRows(BindingFactory bindingFactory) throws InvocationTargetException, XulException {
Binding binding = bindingFactory.createBinding(model, "maxRows", maxRows, "selectedItem");
binding.setBindingType(Binding.Type.BI_DIRECTIONAL);
BindingConvertor maxRowsConverter = new BindingConvertor<Integer, Integer>() {
@Override
public Integer sourceToTarget(Integer value) {
return DataServiceTestModel.MAXROWS_CHOICES.indexOf(value);
}
@Override
public Integer targetToSource(Integer value) {
return DataServiceTestModel.MAXROWS_CHOICES.indexOf(value);
}
};
binding.setConversion(maxRowsConverter);
binding.initialize();
binding.fireSourceChanged();
}
use of org.pentaho.ui.xul.binding.Binding in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestController method bindErrorAlert.
private void bindErrorAlert(BindingFactory bindingFactory) throws InvocationTargetException, XulException {
XulLabel errorAlert = (XulLabel) document.getElementById("error-alert");
model.setAlertMessage("");
bindingFactory.setBindingType(Binding.Type.ONE_WAY);
Binding binding = bindingFactory.createBinding(model, "alertMessage", errorAlert, "value");
binding.initialize();
binding.fireSourceChanged();
}
use of org.pentaho.ui.xul.binding.Binding in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestController method bindOptImpactInfo.
private void bindOptImpactInfo(BindingFactory bindingFactory) {
XulTextbox maxRows = (XulTextbox) document.getElementById("optimization-impact-info");
bindingFactory.setBindingType(Binding.Type.ONE_WAY);
Binding binding = bindingFactory.createBinding(model, "optimizationImpactDescription", maxRows, "value");
binding.initialize();
}
use of org.pentaho.ui.xul.binding.Binding in project data-access by pentaho.
the class WizardRelationalDatasourceController method init.
@Bindable
public void init(final DatasourceModel datasourceModel) {
this.datasourceModel = datasourceModel;
bf = new GwtBindingFactory(document);
// $NON-NLS-1$
sampleDataTree = (XulTree) document.getElementById("relationalSampleDataTable");
// $NON-NLS-1$
aggregationEditorDialog = (XulDialog) document.getElementById("relationalAggregationEditorDialog");
// $NON-NLS-1$
sampleDataDialog = (XulDialog) document.getElementById("relationalSampleDataDialog");
// $NON-NLS-1$
errorDialog = (XulDialog) document.getElementById("errorDialog");
// $NON-NLS-1$
errorLabel = (XulLabel) document.getElementById("errorLabel");
// $NON-NLS-1$
applyQueryConfirmationDialog = (XulDialog) document.getElementById("applyQueryConfirmationDialog");
// $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$
datasourceName = (XulTextbox) document.getElementById("datasourceName");
// $NON-NLS-1$
connections = (XulListbox) document.getElementById("connectionList");
// $NON-NLS-1$
query = (XulTextbox) document.getElementById("query");
// $NON-NLS-1$
connectionDialog = (XulDialog) document.getElementById("connectionDialog");
// $NON-NLS-1$
previewResultsDialog = (XulDialog) document.getElementById("previewResultsDialog");
// $NON-NLS-1$
previewResultsTable = (XulTree) document.getElementById("previewResultsTable");
// $NON-NLS-1$
previewResultsTreeCols = (XulTreeCols) document.getElementById("previewResultsTreeCols");
// $NON-NLS-1$
previewLimit = (XulTextbox) document.getElementById("previewLimit");
// $NON-NLS-1$
editConnectionButton = (XulButton) document.getElementById("editConnection");
// $NON-NLS-1$
removeConnectionButton = (XulButton) document.getElementById("removeConnection");
// $NON-NLS-1$
editQueryButton = (XulButton) document.getElementById("editQuery");
// $NON-NLS-1$
previewButton = (XulButton) document.getElementById("preview");
bf.setBindingType(Binding.Type.ONE_WAY);
bf.createBinding(datasourceModel.getGuiStateModel(), "relationalPreviewValidated", previewButton, // $NON-NLS-1$ //$NON-NLS-2$
"!disabled");
List<Binding> bindingsThatNeedInitialized = new ArrayList<Binding>();
BindingConvertor<IDatabaseConnection, Boolean> buttonConvertor = new BindingConvertor<IDatabaseConnection, Boolean>() {
@Override
public Boolean sourceToTarget(IDatabaseConnection value) {
return !(value == null);
}
@Override
public IDatabaseConnection targetToSource(Boolean value) {
return null;
}
};
bf.setBindingType(Binding.Type.ONE_WAY);
final Binding domainBinding = bf.createBinding(datasourceModel.getGuiStateModel(), "connections", this, // $NON-NLS-1$ //$NON-NLS-2$
"relationalConnections");
// $NON-NLS-1$
bf.createBinding(this, connectionNamesListProp, connections, "elements");
bf.createBinding(datasourceModel, "selectedRelationalConnection", editConnectionButton, "!disabled", // $NON-NLS-1$ //$NON-NLS-2$
buttonConvertor);
bf.createBinding(datasourceModel, "selectedRelationalConnection", removeConnectionButton, "!disabled", // $NON-NLS-1$ //$NON-NLS-2$
buttonConvertor);
bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
bf.createBinding(datasourceModel, "selectedRelationalConnection", connections, "selectedIndex", new // $NON-NLS-1$ //$NON-NLS-2$
BindingConvertor<IDatabaseConnection, Integer>() {
@Override
public Integer sourceToTarget(IDatabaseConnection connection) {
if (connection != null) {
return datasourceModel.getGuiStateModel().getConnectionIndex(connection);
}
return -1;
}
@Override
public IDatabaseConnection targetToSource(Integer value) {
if (value >= 0) {
return datasourceModel.getGuiStateModel().getConnections().get(value);
}
return null;
}
});
bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
bf.createBinding(datasourceModel.getGuiStateModel(), "previewLimit", previewLimit, // $NON-NLS-1$ //$NON-NLS-2$
"value");
// $NON-NLS-1$ //$NON-NLS-2$
bf.createBinding(datasourceModel, "query", query, "value");
try {
// Fires the population of the model listbox. This cascades down to the categories and columns. In essence, this
// call initializes the entire UI.
domainBinding.fireSourceChanged();
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
for (Binding b : bindingsThatNeedInitialized) {
try {
b.fireSourceChanged();
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
use of org.pentaho.ui.xul.binding.Binding in project data-access by pentaho.
the class AnalysisImportDialogController method init.
public void init() {
try {
connectionAutoBeanFactory = GWT.create(IConnectionAutoBeanFactory.class);
resBundle = (ResourceBundle) super.getXulDomContainer().getResourceBundles().get(0);
// connectionService = new ConnectionServiceGwtImpl();
importDialogModel = new AnalysisImportDialogModel();
connectionList = (XulMenuList) document.getElementById("connectionList");
analysisParametersTree = (XulTree) document.getElementById("analysisParametersTree");
importDialog = (XulDialog) document.getElementById("importDialog");
analysisParametersDialog = (XulDialog) document.getElementById("analysisParametersDialog");
paramNameTextBox = (XulTextbox) document.getElementById("paramNameTextBox");
paramNameTextBox.addPropertyChangeListener(new ParametersChangeListener());
paramValueTextBox = (XulTextbox) document.getElementById("paramValueTextBox");
paramValueTextBox.addPropertyChangeListener(new ParametersChangeListener());
analysisPreferencesDeck = (XulDeck) document.getElementById("analysisPreferencesDeck");
availableRadio = (XulRadio) document.getElementById("availableRadio");
manualRadio = (XulRadio) document.getElementById("manualRadio");
hiddenArea = (XulVbox) document.getElementById("analysisImportCard");
schemaNameLabel = (XulLabel) document.getElementById("schemaNameLabel");
analysisFileLabel = (XulLabel) document.getElementById("analysisFileLabel");
uploadAnalysisButton = (XulButton) document.getElementById("uploadAnalysisButton");
acceptButton = (XulButton) document.getElementById("importDialog_accept");
acceptButton.setDisabled(true);
parametersAcceptButton = (XulButton) document.getElementById("analysisParametersDialog_accept");
parametersAcceptButton.setDisabled(true);
bf.setBindingType(Binding.Type.ONE_WAY);
bf.createBinding(connectionList, "selectedIndex", importDialogModel, "connection", new BindingConvertor<Integer, IDatabaseConnection>() {
@Override
public Integer targetToSource(IDatabaseConnection connection) {
return -1;
}
@Override
public IDatabaseConnection sourceToTarget(Integer value) {
if (value >= 0) {
return importDialogModel.getConnectionList().get(value);
}
return null;
}
});
bf.createBinding(manualRadio, "checked", this, "preference", new PreferencesBindingConvertor());
bf.createBinding(this, "connectionNames", connectionList, "elements");
Binding domainBinding = bf.createBinding(importDialogModel, "connectionList", this, "relationalConnections");
Binding analysisParametersBinding = bf.createBinding(importDialogModel, "analysisParameters", analysisParametersTree, "elements");
domainBinding.fireSourceChanged();
analysisParametersBinding.fireSourceChanged();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations