Search in sources :

Example 1 with Binding

use of org.pentaho.ui.xul.binding.Binding in project pentaho-kettle by pentaho.

the class AuthProviderController method bind.

private void bind() {
    try {
        this.bf.setBindingType(Binding.Type.ONE_WAY);
        // Loads the authorization types into the "Method" combobox
        bf.createBinding(this, "possibleTypes", "method_list", "elements").fireSourceChanged();
        // Manage enabling/disabling layout based on item availability in the main authProvider list.
        bf.createBinding(model.getModelObjects(), "children", "remove_button", "disabled", itemCountBinding).fireSourceChanged();
        bf.createBinding(model.getModelObjects(), "children", "name", "disabled", itemCountBinding).fireSourceChanged();
        bf.createBinding(model.getModelObjects(), "children", "method_list", "disabled", itemCountBinding).fireSourceChanged();
        // Manage enabling/disabling layout based on selection in the main authProvider list.
        bf.createBinding("auth_list", "selectedItem", "name", "!disabled", BindingConvertor.object2Boolean()).fireSourceChanged();
        bf.createBinding("auth_list", "selectedItem", "method_list", "!disabled", BindingConvertor.object2Boolean()).fireSourceChanged();
        bf.createBinding("auth_list", "selectedItem", "remove_button", "!disabled", BindingConvertor.object2Boolean()).fireSourceChanged();
        bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
        // When an authorization entry is selected, select entry in model
        bf.createBinding("auth_list", "selectedItem", this.model, "selectedItem");
        // Syncs elements in the model and lists them in the authorization entry list
        Binding listBinding = this.bf.createBinding(this.model.getModelObjects(), "children", "auth_list", "elements");
        listBinding.fireSourceChanged();
        // Update the entry name textbox when a new entry is selected in the authorization entry list
        bf.createBinding(this.model, "selectedItem", "name", "value", selectedItemsNameBinding).fireSourceChanged();
        // Change the overlay when the user changes the "Method" in the method combobox
        bf.createBinding(this, "newOverlay", "method_list", "selectedItem").fireSourceChanged();
        // Update the method combobox with the appropriate selection for the selected authorization entry
        bf.createBinding(this.model, "selectedItem", "method_list", "selectedItem", selectedItemsItemBinding).fireSourceChanged();
        // Because the programmatic selection of the item in the combobox does not fire events, we need
        // to bind the main authProvider selection to the changing of the overlay
        bf.createBinding(this.model, "selectedItem", this, "newOverlay", selectedItemsItemBinding);
    } catch (XulException e) {
        log.logError(resourceBundle.getString("error.on_bind"), e);
    } catch (InvocationTargetException e) {
        log.logError(resourceBundle.getString("error.on_execution"), e);
    }
}
Also used : Binding(org.pentaho.ui.xul.binding.Binding) XulException(org.pentaho.ui.xul.XulException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 2 with Binding

use of org.pentaho.ui.xul.binding.Binding in project pentaho-kettle by pentaho.

the class AbstractAuthProvider method bind.

@Override
public void bind() throws BindingException, XulException, InvocationTargetException {
    unbind();
    elementBindings = new ArrayList<Binding>();
    Binding b = bf.createBinding(this, "principal", "principal", "value");
    b.setBindingType(Binding.Type.BI_DIRECTIONAL);
    elementBindings.add(b);
    addBindings(elementBindings, bf);
    fireBindingsChanged();
}
Also used : Binding(org.pentaho.ui.xul.binding.Binding)

Example 3 with Binding

use of org.pentaho.ui.xul.binding.Binding in project pentaho-kettle by pentaho.

the class KerberosAuthProvider method addBindings.

@Override
protected void addBindings(List<Binding> bindings, BindingFactory bf) {
    super.addBindings(bindings, bf);
    Binding b = bf.createBinding(this, "keytabFile", "keytab", "value");
    b.setBindingType(Binding.Type.BI_DIRECTIONAL);
    bindings.add(b);
    b = bf.createBinding(this, "useKeytab", "useKeytab", "checked");
    b.setBindingType(Binding.Type.BI_DIRECTIONAL);
    bindings.add(b);
    b = bf.createBinding("useKeytab", "checked", "keytab", "!disabled");
    b.setBindingType(Binding.Type.ONE_WAY);
    bindings.add(b);
    b = bf.createBinding("useKeytab", "checked", "browse", "!disabled");
    b.setBindingType(Binding.Type.ONE_WAY);
    bindings.add(b);
    b = bf.createBinding("useKeytab", "checked", "password", "disabled");
    b.setBindingType(Binding.Type.ONE_WAY);
    bindings.add(b);
    b = bf.createBinding("useKeytab", "checked", "principal", "disabled");
    b.setBindingType(Binding.Type.ONE_WAY);
    bindings.add(b);
}
Also used : Binding(org.pentaho.ui.xul.binding.Binding)

Example 4 with Binding

use of org.pentaho.ui.xul.binding.Binding 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 5 with Binding

use of org.pentaho.ui.xul.binding.Binding in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceTestController method bindButton.

/**
 * Binds the button to the executing prop of model, such that the button will be
 * disabled for the duration of a query execution.
 */
private void bindButton(BindingFactory bindingFactory, XulButton button) throws XulException, InvocationTargetException {
    bindingFactory.setBindingType(Binding.Type.ONE_WAY);
    Binding binding = bindingFactory.createBinding(model, "executing", button, "disabled");
    binding.initialize();
    binding.fireSourceChanged();
}
Also used : Binding(org.pentaho.ui.xul.binding.Binding)

Aggregations

Binding (org.pentaho.ui.xul.binding.Binding)16 BindingConvertor (org.pentaho.ui.xul.binding.BindingConvertor)6 XulException (org.pentaho.ui.xul.XulException)5 RequestException (com.google.gwt.http.client.RequestException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 ArrayList (java.util.ArrayList)2 IDatabaseConnection (org.pentaho.database.model.IDatabaseConnection)2 XulTextbox (org.pentaho.ui.xul.components.XulTextbox)2 Bindable (org.pentaho.ui.xul.stereotype.Bindable)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 List (java.util.List)1 Matchers.anyString (org.mockito.Matchers.anyString)1 KettleException (org.pentaho.di.core.exception.KettleException)1 LogLevel (org.pentaho.di.core.logging.LogLevel)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 IRevisionObject (org.pentaho.di.ui.repository.pur.repositoryexplorer.IRevisionObject)1 UIRepositoryObjectRevisions (org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectRevisions)1 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)1 UIRepositoryContent (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryContent)1