AbstractDaoForm objForm = new PersonForm(parentFormModel,
"personDetails", valueHolder, masterList) {
@Override
protected void addTabs() {
TimeFinderPlannerBindingFactory factory = (TimeFinderPlannerBindingFactory) getBindingFactory();
// warning: the methods person.set + getEvents is necessary!
TableFormBuilder builder = createTab(getMessage("events.label"));
final Dao<Event> eventDao = pool.getDao(Event.class);
final ValueHolder eventsHolder = new ValueHolder(
new ArrayList<Event>(eventDao.getAll()));
// TODO SPRING RC the problem of "name" instead null is that duplicate names will be removed!!!
ShuttleList sl = (ShuttleList) builder.add(factory.createBoundShuttleList("events", eventsHolder, null))[1];
sl.setVisibleRowCount(10);
eventDao.addListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (Dao.ATTACH.equals(evt.getPropertyName())
|| Dao.ATTACH_ALL.equals(evt.getPropertyName())
|| Dao.DETACH.equals(evt.getPropertyName())
|| Dao.DETACH_ALL.equals(evt.getPropertyName())) {
eventsHolder.setValue(new ArrayList<Event>(eventDao.getAll()));
}
}
});
builder = createTab(getMessage("planner"));
planner = (TimeFinderPlanner) builder.add(
factory.createBoundPlanner("events", settings))[1];
}
};
objForm.setDao(dao);
return objForm;