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