final CalendarData version) {
final Combobox comboParents = new Combobox();
final List<BaseCalendar> listParents = getParentCalendars();
for (BaseCalendar parent : listParents) {
Comboitem comboItem = new Comboitem();
comboItem.setValue(parent);
comboItem.setLabel(parent.getName());
comboItem.setParent(comboParents);
if ((version.getParent()) != null
&& (parent.getId().equals(version.getParent().getId()))) {
comboParents.setSelectedItem(comboItem);
}
}
comboParents.addEventListener(Events.ON_SELECT,
new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
if (comboParents.getSelectedItem() != null) {
BaseCalendar parent = (BaseCalendar) comboParents
.getSelectedItem().getValue();
version.setParent(parent);
}
}
});
Util.bind(comboParents, new Util.Getter<Comboitem>() {
@Override
public Comboitem get() {
return comboParents.getSelectedItem();
}
}, new Util.Setter<Comboitem>() {
@Override
public void set(Comboitem comboItem) {
if (((comboItem != null)) && (comboItem.getValue() != null)
&& (comboItem.getValue() instanceof BaseCalendar)) {
BaseCalendar parent = (BaseCalendar) comboItem
.getValue();
version.setParent(parent);
}
}