diff --git a/modules/web/src/com/haulmont/cuba/web/gui/data/EnumerationContainer.java b/modules/web/src/com/haulmont/cuba/web/gui/data/EnumerationContainer.java index 3f47ddb8c9..4027afc082 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/data/EnumerationContainer.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/data/EnumerationContainer.java @@ -11,11 +11,14 @@ package com.haulmont.cuba.web.gui.data; import com.itmill.toolkit.data.Item; import com.itmill.toolkit.data.Property; +import com.haulmont.cuba.core.global.MessageProvider; import java.util.List; import java.util.Collection; import java.util.Collections; +import org.apache.commons.lang.StringUtils; + public class EnumerationContainer implements com.itmill.toolkit.data.Container { private List values; @@ -77,9 +80,14 @@ public class EnumerationContainer implements com.itmill.toolkit.data.Container { private static class EnumerationItem implements Item { private Object item; + private String name; public EnumerationItem(Object itemId) { this.item = itemId; + String nameKey = item.getClass().getSimpleName() + "." + item.toString(); + + name = MessageProvider.getMessage(item.getClass(), nameKey); + if (StringUtils.isEmpty(name)) name = item.toString(); } public Property getItemProperty(Object id) { @@ -100,7 +108,7 @@ public class EnumerationContainer implements com.itmill.toolkit.data.Container { @Override public String toString() { - return item.toString(); + return name; } } }