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