Search in sources :

Example 1 with XulTextbox

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");
}
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 XulTextbox

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();
    }
}
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 XulTextbox

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();
}
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 XulTextbox

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");
}
Also used : XulTextbox(org.pentaho.ui.xul.components.XulTextbox) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 5 with XulTextbox

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();
}
Also used : XulTextbox(org.pentaho.ui.xul.components.XulTextbox) XulButton(org.pentaho.ui.xul.components.XulButton)

Aggregations

XulTextbox (org.pentaho.ui.xul.components.XulTextbox)13 XulRadio (org.pentaho.ui.xul.components.XulRadio)5 BindingFactory (org.pentaho.ui.xul.binding.BindingFactory)4 DatabaseInterface (org.pentaho.di.core.database.DatabaseInterface)2 XulComponent (org.pentaho.ui.xul.XulComponent)2 XulException (org.pentaho.ui.xul.XulException)2 Binding (org.pentaho.ui.xul.binding.Binding)2 XulLabel (org.pentaho.ui.xul.components.XulLabel)2 XulTab (org.pentaho.ui.xul.components.XulTab)2 File (java.io.File)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1 DatabasePluginType (org.pentaho.di.core.plugins.DatabasePluginType)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 BaseMessages.getString (org.pentaho.di.i18n.BaseMessages.getString)1 PushDownOptimizationMeta (org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationMeta)1 ServiceCache (org.pentaho.di.trans.dataservice.optimization.cache.ServiceCache)1 ExtMenuList (org.pentaho.di.ui.core.database.dialog.tags.ExtMenuList)1 ExtTextbox (org.pentaho.di.ui.core.database.dialog.tags.ExtTextbox)1 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)1