public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { JTextComponent textComponent = context.getFieldObject(field, JTextComponent.class); Mutator mutator = Mutator.create(context, bound.to()); Binding binding = bindJTextComponent(mutator, textComponent); if (binding == null) { return ImmutableList.of(); } return ImmutableList.of(binding); }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { Mutator mutator = Mutator.create(context, bound.to()); AbstractButton abstractButton = context.getFieldObject(field, AbstractButton.class); return ImmutableList.of(bindAbstractButton(mutator, abstractButton)); }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { String target = bound.to(); Mutator mutator = Mutator.create(context, target); JSlider slider = context.getFieldObject(field, JSlider.class); return ImmutableList.of(bindJSlider(mutator, slider)); }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { JList list = context.getFieldObject(field, JList.class); Mutator mutator = Mutator.create(context, bound.to()); return ImmutableList.of(bindJList(bound, mutator, list)); }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { JLabel label = context.getFieldObject(field, JLabel.class); Mutator mutator = Mutator.create(context, bound.to()); return ImmutableList.of(bindJLabel(mutator, label)); }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { String target = bound.to(); JComboBox combo = context.getFieldObject(field, JComboBox.class); Mutator mutator = Mutator.create(context, target); final String nullValue = (String)Utilities.getNullValue(context, bound.nullValue()); return ImmutableList.of(bindJComboBox(bound, mutator, combo, nullValue)); }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { String target = bound.to(); JProgressBar bar = context.getFieldObject(field, JProgressBar.class); // ObjectFieldMethod setter = context.findSetter(target); ObjectFieldMethod getter = context.findGetter(target); if (getter == null) { throw new IllegalArgumentException("could not find getter/setter for " + target); } BindableModel model = context.getFieldObject(getter.getField(), BindableModel.class); // verify type parameters return bindJProgressBar(model, bar, getter.getMethod()); }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { String target = bound.to(); Mutator mutator = Mutator.create(context, target); JToggleButton toggle = context.getFieldObject(field, JToggleButton.class); Class<?>[] paramTypes = mutator.getSetter().getMethod().getParameterTypes(); if (paramTypes.length == 1 && paramTypes[0].isEnum()) { Class<?> enumType = paramTypes[0]; String value = bound.value(); return ImmutableList.of(bindJToggleButtonToEnum(value, enumType, mutator, toggle)); } else if (paramTypes.length == 1 && paramTypes[0] == boolean.class) { String value = bound.value(); if (Strings.isNullOrEmpty(value)) { return ImmutableList.of(AbstractButtonWiringHarness.bindAbstractButton(mutator, toggle)); } else { return ImmutableList.of(bindJToggleButtonToBoolean(bound.value(), mutator, toggle)); } } else { throw new BindingException("can only bind JToggleButtons to enums or booleans"); //$NON-NLS-1$ } }
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException { String target = bound.to(); JPasswordField pwdField = context.getFieldObject(field, JPasswordField.class); ObjectFieldMethod setter = context.findSetter(target); ObjectFieldMethod getter = context.findGetter(target); if (setter == null || getter == null) { throw new IllegalArgumentException("could not find getter/setter for " + target); } BindableModel model1 = context.getFieldObject(setter.getField(), BindableModel.class); BindableModel model2 = context.getFieldObject(getter.getField(), BindableModel.class); Preconditions.checkArgument(model1 == model2, "setter not bound to same field as getter"); // verify type parameters return bindJPasswordField(model1, pwdField, getter.getMethod(), setter.getMethod()); }