use of org.pentaho.ui.xul.components.XulRadio 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.XulRadio 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.XulRadio 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.XulRadio in project data-access by pentaho.
the class MultiTableDatasource method activating.
@Override
public void activating() throws XulException {
this.connectionSelectionStep.activating();
this.tablesSelectionStep.activating();
this.joinDefinitionsStep.activating();
XulVbox queryVbox = (XulVbox) document.getElementById("queryBox");
queryVbox.setVisible(false);
XulVbox metadataVbox = (XulVbox) document.getElementById("metadata");
metadataVbox.setVisible(true);
XulVbox connectionsVbox = (XulVbox) document.getElementById("connectionsLbl");
connectionsVbox.setVisible(true);
XulListbox connections = (XulListbox) document.getElementById("connectionList");
connections.setWidth(568);
connections.setHeight(275);
try {
// RPB: BISERVER-9258.
// conditionally hiding the selection of reporting vs reporting+olap in the case where reporting only makes no
// sense.
// bf.createBinding(wizardModel, "reportingOnlyValid", "metadata", "visible").fireSourceChanged();
// Use a binding to keep the radio buttons in sync
bf.setBindingType(Type.BI_DIRECTIONAL);
XulRadio olapRadio = (XulRadio) document.getElementById("reporting_analysis");
bf.createBinding(olapRadio, "checked", joinGuiModel, "doOlap");
bf.setBindingType(Type.ONE_WAY);
XulRadio reportingRadio = (XulRadio) document.getElementById("reporting");
bf.createBinding(wizardModel, "reportingOnlyValid", reportingRadio, "checked").fireSourceChanged();
} catch (Exception e) {
e.printStackTrace();
}
this.errorDialog = (XulDialog) document.getElementById("errorDialog");
this.errorLabel = (XulLabel) document.getElementById("errorLabel");
this.connectionSelectionStep.setValid(true);
this.setConnection(connectionSelectionStep.getConnection());
}
use of org.pentaho.ui.xul.components.XulRadio in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestController method executeSql.
public void executeSql() throws KettleException {
resetMetrics();
dataServiceExec = getNewDataServiceExecutor(true);
updateOptimizationImpact(dataServiceExec);
updateModel(dataServiceExec);
AnnotationsQueryService annotationsQuery = getAnnotationsQueryService();
Query query;
if (dataService.isStreaming()) {
XulRadio timeBasedRadio = (XulRadio) document.getElementById("time-based-radio");
IDataServiceClientService.StreamingMode windowMode = timeBasedRadio.isSelected() ? IDataServiceClientService.StreamingMode.TIME_BASED : IDataServiceClientService.StreamingMode.ROW_BASED;
model.setWindowMode(windowMode);
query = annotationsQuery.prepareQuery(model.getSql(), model.getWindowMode(), model.getWindowSize(), model.getWindowEvery(), model.getWindowLimit(), ImmutableMap.<String, String>of());
} else {
query = annotationsQuery.prepareQuery(model.getSql(), model.getMaxRows(), ImmutableMap.<String, String>of());
}
if (null != query) {
writeAnnotations(query);
handleCompletion(dataServiceExec);
} else {
callback.onLogChannelUpdate();
dataServiceExec.executeQuery(getDataServiceRowListener());
pollForCompletion(dataServiceExec);
}
}
Aggregations