mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-04 20:28:00 +08:00
PL-1202 Разработать механизм работы с динамическими атрибутами
support required attributes #PL-1202
This commit is contained in:
parent
12bd06bf57
commit
d8a1c18f47
@ -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
|
||||
|
@ -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%");
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user