Search in sources :

Example 1 with XulRadio

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");
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) XulRadio(org.pentaho.ui.xul.components.XulRadio) ServiceCache(org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) PushDownOptimizationMeta(org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta) XulTab(org.pentaho.ui.xul.components.XulTab) BindingFactory(org.pentaho.ui.xul.binding.BindingFactory)

Example 2 with XulRadio

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();
    }
}
Also used : Binding(org.pentaho.ui.xul.binding.Binding) XulRadio(org.pentaho.ui.xul.components.XulRadio) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) Matchers.anyString(org.mockito.Matchers.anyString) XulComponent(org.pentaho.ui.xul.XulComponent) BindingConvertor(org.pentaho.ui.xul.binding.BindingConvertor) BindingFactory(org.pentaho.ui.xul.binding.BindingFactory)

Example 3 with XulRadio

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();
}
Also used : XulRadio(org.pentaho.ui.xul.components.XulRadio) XulTextbox(org.pentaho.ui.xul.components.XulTextbox) BaseMessages.getString(org.pentaho.di.i18n.BaseMessages.getString) BindingFactory(org.pentaho.ui.xul.binding.BindingFactory)

Example 4 with XulRadio

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());
}
Also used : XulVbox(org.pentaho.ui.xul.containers.XulVbox) XulRadio(org.pentaho.ui.xul.components.XulRadio) XulListbox(org.pentaho.ui.xul.containers.XulListbox) XulException(org.pentaho.ui.xul.XulException)

Example 5 with XulRadio

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);
    }
}
Also used : XulRadio(org.pentaho.ui.xul.components.XulRadio) IDataServiceClientService(org.pentaho.di.trans.dataservice.client.api.IDataServiceClientService) Query(org.pentaho.di.trans.dataservice.clients.Query) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) AnnotationsQueryService(org.pentaho.di.trans.dataservice.clients.AnnotationsQueryService)

Aggregations

XulRadio (org.pentaho.ui.xul.components.XulRadio)8 XulTextbox (org.pentaho.ui.xul.components.XulTextbox)5 BindingFactory (org.pentaho.ui.xul.binding.BindingFactory)4 XulException (org.pentaho.ui.xul.XulException)2 XulTab (org.pentaho.ui.xul.components.XulTab)2 Request (com.google.gwt.http.client.Request)1 RequestBuilder (com.google.gwt.http.client.RequestBuilder)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 Matchers.anyString (org.mockito.Matchers.anyString)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 BaseMessages.getString (org.pentaho.di.i18n.BaseMessages.getString)1 IDataServiceClientService (org.pentaho.di.trans.dataservice.client.api.IDataServiceClientService)1 AnnotationsQueryService (org.pentaho.di.trans.dataservice.clients.AnnotationsQueryService)1 Query (org.pentaho.di.trans.dataservice.clients.Query)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 ServiceCache (org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache)1 XulComponent (org.pentaho.ui.xul.XulComponent)1 Binding (org.pentaho.ui.xul.binding.Binding)1