use of org.pentaho.ui.xul.components.XulTextbox in project pdi-dataservice-server-plugin by pentaho.
the class ServiceCacheController method initBindings.
public void initBindings(DataServiceModel model) {
PushDownOptimizationMeta meta = locateServiceCacheMeta(model);
ServiceCache serviceCache = (ServiceCache) meta.getType();
BindingFactory bindingFactory = getBindingFactory();
XulRadio normalModeRadio = getElementById("regular-type-radio");
XulTab serviceCacheTab = getElementById("service-cache-tab");
XulCheckbox serviceCacheCheckBox = getElementById("service-cache-checkbox");
XulTextbox serviceCacheTextBox = getElementById("service-cache-ttl");
bindingFactory.setBindingType(Binding.Type.ONE_WAY);
serviceCacheCheckBox.setChecked(meta.isEnabled());
serviceCacheTab.setVisible(!model.isStreaming());
try {
serviceCacheTextBox.setValue(serviceCache.getConfiguredTimeToLive());
} catch (Exception e) {
getLogChannel().logError("Unable to set default TTL", e);
}
bindingFactory.createBinding(serviceCacheTextBox, "value", serviceCache, "timeToLive");
bindingFactory.createBinding(serviceCacheCheckBox, "checked", meta, "enabled");
bindingFactory.createBinding(serviceCacheCheckBox, "checked", serviceCacheTextBox, "disabled", not());
bindingFactory.createBinding(normalModeRadio, "selected", serviceCacheTab, "visible");
}
use of org.pentaho.ui.xul.components.XulTextbox in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceDialogControllerTest method testBindingsAux.
private void testBindingsAux() throws Exception {
final BindingFactory bindingFactory = mock(BindingFactory.class);
final XulTextbox serviceName = mock(XulTextbox.class);
final XulMenuList<String> steps = mock(XulMenuList.class);
final XulRadio streamingModeRadio = mock(XulRadio.class);
final XulRadio regularModeRadio = mock(XulRadio.class);
when(document.getElementById("service-name")).thenReturn(serviceName);
when(document.getElementById("trans-steps")).thenReturn(steps);
when(document.getElementById("streaming-type-radio")).thenReturn(streamingModeRadio);
when(document.getElementById("regular-type-radio")).thenReturn(regularModeRadio);
controller.setBindingFactory(bindingFactory);
final List<Binding> bindings = Lists.newArrayList();
when(bindingFactory.createBinding(same(model), anyString(), any(XulComponent.class), anyString())).thenAnswer(invocationOnMock -> {
Binding binding = mock(Binding.class);
bindings.add(binding);
return binding;
});
when(bindingFactory.createBinding(same(model), anyString(), any(XulComponent.class), anyString(), any(BindingConvertor.class))).thenAnswer(invocationOnMock -> {
Binding binding = mock(Binding.class);
bindings.add(binding);
return binding;
});
controller.init();
verify(steps).setElements(eq(ImmutableList.of(STEP_ONE_NAME, STEP_TWO_NAME)));
for (Binding binding : bindings) {
verify(binding).fireSourceChanged();
}
}
use of org.pentaho.ui.xul.components.XulTextbox in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceDialogController method init.
public void init() throws InvocationTargetException, XulException {
BindingFactory bindingFactory = getBindingFactory();
XulTextbox serviceName = getElementById("service-name");
XulMenuList<String> steps = getElementById("trans-steps");
XulRadio streamingModeRadio = getElementById("streaming-type-radio");
XulRadio normalModeRadio = getElementById("regular-type-radio");
steps.setElements(ImmutableList.copyOf(model.getTransMeta().getStepNames()));
bindingFactory.setBindingType(Binding.Type.BI_DIRECTIONAL);
bindingFactory.createBinding(model, "serviceStep", steps, "selectedItem").fireSourceChanged();
bindingFactory.createBinding(model, "serviceName", serviceName, "value").fireSourceChanged();
bindingFactory.createBinding(model, "streaming", streamingModeRadio, "selected").fireSourceChanged();
bindingFactory.createBinding(model, "!streaming", normalModeRadio, "selected").fireSourceChanged();
}
use of org.pentaho.ui.xul.components.XulTextbox in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestController method bindSqlText.
private void bindSqlText(BindingFactory bindingFactory) {
XulTextbox sqlTextBox = (XulTextbox) document.getElementById("sql-textbox");
String initSql = getDefaultSql();
model.setSql(initSql);
sqlTextBox.setValue(initSql);
bindingFactory.setBindingType(Binding.Type.BI_DIRECTIONAL);
bindingFactory.createBinding(model, "sql", sqlTextBox, "value");
}
use of org.pentaho.ui.xul.components.XulTextbox in project data-access by pentaho.
the class EmbeddedWizard method showDialog.
/**
* Specified by <code>DialogController</code>.
*/
public void showDialog() {
this.modelerDialogListener = null;
if (connectionController != null) {
connectionController.reloadConnections();
}
if (datasourceModel.getGuiStateModel().getConnections() == null || datasourceModel.getGuiStateModel().getConnections().size() <= 0) {
checkInitialized();
}
wizardModel.setEditing(false);
wizardController.setActiveStep(0);
wizardModel.reset();
wizardController.resetSelectedDatasource();
wizardModel.setReportingOnlyValid(this.reportingOnlyValid);
/*
* BISERVER-5153: Work around where XulGwtButton is getting its disabled state and style confused. The only way to
* get the train on the track is to flip-flop it.
*/
XulButton nextButton = // $NON-NLS-1$
(XulButton) mainWizardContainer.getDocumentRoot().getElementById("main_wizard_window_extra2");
nextButton.setDisabled(false);
nextButton.setDisabled(true);
/* end of work around */
dialog.show();
// BISERVER-6473
// $NON-NLS-1$
XulTextbox datasourceName = (XulTextbox) mainWizardContainer.getDocumentRoot().getElementById("datasourceName");
datasourceName.setFocus();
}
Aggregations