SwingBindingFactory factory = (SwingBindingFactory) getBindingFactory();
getFormBuilder().add(factory.createBoundComboBox(
"location", pool.getDao(Location.class).getAll(), "name"));
TableFormBuilder builder = createTab(getMessage("persons.label"));
final Dao<Person> personDao = pool.getDao(Person.class);
/****************************************************************
* WARNING: it is important to wrap the (person) collection in
* another one (here ArrayList). Otherwise the changes
* to the dao will have direct effect to the value in ValueHolder
* and newValue.equals(oldValue) == true for every change!
****************************************************************/
final ValueHolder personHolder = new ValueHolder(new ArrayList<Person>(personDao.getAll()));
//1. persons => Event.set and getPersons are necessary
//2. personDao.getAll() => all available persons
//3. name => prints the name as one list item
ShuttleList sl = (ShuttleList) builder.add(
factory.createBoundShuttleList("persons",
personHolder, "name"))[1];
sl.setVisibleRowCount(10);
TableFormBuilder fBuilder = createTab(getMessage("features.label"));
final Dao<Feature> featureDao = pool.getDao(Feature.class);
final ValueHolder featureHolder = new ValueHolder(new ArrayList<Feature>(featureDao.getAll()));
sl = (ShuttleList) fBuilder.add(factory.createBoundShuttleList("features",
featureHolder, null))[1];
sl.setVisibleRowCount(10);
// now notify ShuttleList when collection change to update the JList
personDao.addListener(new PropertyChangeListener() {