OptionsGroup's setValue() doesn't work #PL-2061

This commit is contained in:
Yuriy Artamonov 2013-04-24 13:51:32 +00:00
parent a59a6b0d72
commit f767c555f8

View File

@ -12,6 +12,7 @@ package com.haulmont.cuba.web.gui.components;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.gui.components.OptionsGroup;
import com.haulmont.cuba.gui.data.Datasource;
import com.haulmont.cuba.web.toolkit.ui.OptionGroup;
import com.vaadin.data.Property;
import com.vaadin.data.util.converter.Converter;
@ -131,7 +132,16 @@ public class WebOptionsGroup
protected Object getKey(Object o) {
Object t;
if (o instanceof Entity) {
t = ((Entity) o).getId();
if (optionsDatasource != null) {
if (Datasource.State.INVALID == optionsDatasource.getState()) {
optionsDatasource.refresh();
}
return ((Entity) o).getId();
} else {
if ((optionsList != null) || (optionsMap != null))
return o;
return ((Entity) o).getId();
}
} else if (o instanceof Enum) {
t = o;
} else {