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)); }
private static Collection<Binding> wire(BoundSelection bound, BindingContext context, Field field) throws IntrospectionException { String target = bound.to(); Mutator mutator = Mutator.create(context, target); if (JList.class.isAssignableFrom(field.getType())) { final JList list = context.getFieldObject(field, JList.class); return bindJList(bound, mutator, list); } else if (JComboBox.class.isAssignableFrom(field.getType())) { final JComboBox combo = context.getFieldObject(field, JComboBox.class); final String nullValue = (String)Bound.Utilities.getNullValue(context, bound.nullValue()); return bindJComboBox(bound, mutator, combo, nullValue); } else { throw new IllegalArgumentException("don't know how to wire up @BoundSelection field: " + field.getName()); } }
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(); 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$ } }