diff --git a/modules/global/src/com/haulmont/cuba/core/app/dynamicattributes/DynamicAttributesMetaProperty.java b/modules/global/src/com/haulmont/cuba/core/app/dynamicattributes/DynamicAttributesMetaProperty.java index 8b95e45057..6c02e628ed 100644 --- a/modules/global/src/com/haulmont/cuba/core/app/dynamicattributes/DynamicAttributesMetaProperty.java +++ b/modules/global/src/com/haulmont/cuba/core/app/dynamicattributes/DynamicAttributesMetaProperty.java @@ -31,6 +31,7 @@ public class DynamicAttributesMetaProperty extends MetadataObjectImpl implements private MetaClass metaClass; private transient Range range; private Class javaClass; + private Boolean mandatory; private AnnotatedElement annotatedElement = new FakeAnnotatedElement(); @@ -38,6 +39,7 @@ public class DynamicAttributesMetaProperty extends MetadataObjectImpl implements this.javaClass = DynamicAttributesUtils.getAttributeClass(attribute); this.metaClass = metaClass; this.name = DynamicAttributesUtils.encodeAttributeCode(attribute.getCode()); + this.mandatory = attribute.getRequired(); Metadata metadata = AppBeans.get(Metadata.NAME); Session metadataSession = metadata.getSession(); if (SetValueEntity.class.isAssignableFrom(javaClass)) { @@ -72,7 +74,7 @@ public class DynamicAttributesMetaProperty extends MetadataObjectImpl implements @Override public boolean isMandatory() { - return false; + return Boolean.TRUE.equals(mandatory); } @Override diff --git a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FieldGroupLoader.java b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FieldGroupLoader.java index 8d4e23b710..50cf8c9aad 100644 --- a/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FieldGroupLoader.java +++ b/modules/gui/src/com/haulmont/cuba/gui/xml/layout/loaders/FieldGroupLoader.java @@ -186,6 +186,7 @@ public class FieldGroupLoader extends AbstractFieldLoader { field.setType(metaPropertyPath.getRangeJavaClass()); field.setCaption(attribute.getName()); field.setDatasource(ds); + field.setRequired(attribute.getRequired()); if (fieldGroup.getWidth() > 0) { field.setWidth("100%"); diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/WebAbstractField.java b/modules/web/src/com/haulmont/cuba/web/gui/components/WebAbstractField.java index 3f86348efe..1f7dbb8aa1 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/WebAbstractField.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/WebAbstractField.java @@ -18,7 +18,6 @@ import com.haulmont.cuba.gui.components.ValidationException; import com.haulmont.cuba.gui.data.Datasource; import com.haulmont.cuba.gui.data.ValueChangingListener; import com.haulmont.cuba.gui.data.ValueListener; -import com.haulmont.cuba.gui.dynamicattributes.DynamicAttributesGuiTools; import com.haulmont.cuba.web.gui.data.ItemWrapper; import com.vaadin.data.Property; import com.vaadin.ui.AbstractComponent;