use of com.haulmont.chile.core.model.MetaPropertyPath in project cuba by cuba-platform.
the class DynamicAttributesMetaClass method getPropertyPath.
@Override
public MetaPropertyPath getPropertyPath(String propertyPath) {
MetaProperty currentProperty;
currentProperty = this.getProperty(propertyPath);
if (currentProperty == null)
return null;
return new MetaPropertyPath(this, currentProperty);
}
use of com.haulmont.chile.core.model.MetaPropertyPath in project cuba by cuba-platform.
the class RuntimePropertiesFrame method loadEditable.
protected void loadEditable(FieldGroup fieldGroup, FieldGroup.FieldConfig field) {
if (fieldGroup.isEditable()) {
MetaClass metaClass = rds.resolveCategorizedEntityClass();
MetaPropertyPath propertyPath = DynamicAttributesUtils.getMetaPropertyPath(metaClass, field.getProperty());
checkNotNullArgument(propertyPath, "Could not resolve property path '%s' in '%s'", field.getId(), metaClass);
boolean editableFromPermissions = security.isEntityAttrUpdatePermitted(metaClass, propertyPath.toString());
if (!editableFromPermissions) {
field.setEditable(false);
}
boolean visibleFromPermissions = security.isEntityAttrReadPermitted(metaClass, propertyPath.toString());
if (!visibleFromPermissions) {
field.setVisible(false);
}
}
}
use of com.haulmont.chile.core.model.MetaPropertyPath in project cuba by cuba-platform.
the class RuntimePropertiesFrame method loadValidators.
protected void loadValidators(FieldGroup fieldGroup, FieldGroup.FieldConfig field) {
MetaPropertyPath metaPropertyPath = rds.getMetaClass().getPropertyPath(field.getProperty());
if (metaPropertyPath != null) {
MetaProperty metaProperty = metaPropertyPath.getMetaProperty();
Field.Validator validator = getValidator(metaProperty);
if (validator != null) {
field.addValidator(validator);
}
}
}
use of com.haulmont.chile.core.model.MetaPropertyPath in project cuba by cuba-platform.
the class TableModelAdapter method setValueAt.
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
Table.Column column = columns.get(columnIndex);
if (!column.isEditable())
return;
if (generatedColumns.contains(column))
return;
Object id = getItemId(rowIndex);
Entity item = datasource.getItem(id);
if (column.getId() instanceof MetaPropertyPath) {
String property = column.getId().toString();
item.setValueEx(property, aValue);
}
}
use of com.haulmont.chile.core.model.MetaPropertyPath in project cuba by cuba-platform.
the class TableModelAdapter method getValueAt.
@SuppressWarnings("unchecked")
public Object getValueAt(Entity item, int columnIndex) {
Table.Column column = columns.get(columnIndex);
if (column.getId() instanceof MetaPropertyPath) {
String property = column.getId().toString();
Object value;
if (ignoreUnfetchedAttributes) {
value = getValueExIgnoreUnfetched(item, InstanceUtils.parseValuePath(property));
} else {
value = item.getValueEx(property);
}
if (column.getFormatter() != null) {
return column.getFormatter().format(value);
}
MetaPropertyPath metaProperty = ((MetaPropertyPath) column.getId());
boolean isDataType = (metaProperty.getRange().isDatatype());
if (isDataType && hasDefaultFormatting(metaProperty.getRangeJavaClass())) {
if (value != null)
return value;
else
return getDefaultValue(metaProperty.getRangeJavaClass());
} else {
if (value == null)
return null;
return metadataTools.format(value, ((MetaPropertyPath) column.getId()).getMetaProperty());
}
} else {
return null;
}
}
Aggregations