use of io.jmix.ui.entity.PropertyFilterCondition in project jmix by jmix-framework.
the class LogicalFilterConditionEdit method updatePropertyConditionLocalizedCaption.
protected void updatePropertyConditionLocalizedCaption(FilterCondition condition) {
if (condition instanceof PropertyFilterCondition && Strings.isNullOrEmpty(condition.getCaption())) {
PropertyFilterCondition propertyFilterCondition = (PropertyFilterCondition) condition;
MetaClass metaClass = currentConfiguration.getOwner().getDataLoader().getContainer().getEntityMetaClass();
String property = propertyFilterCondition.getProperty();
PropertyFilter.Operation operation = propertyFilterCondition.getOperation();
boolean operationCaptionVisible = propertyFilterCondition.getOperationCaptionVisible() && !propertyFilterCondition.getOperationEditable();
String localizedCaption = propertyFilterSupport.getPropertyFilterCaption(metaClass, property, operation, operationCaptionVisible);
propertyFilterCondition.setLocalizedCaption(localizedCaption);
}
}
use of io.jmix.ui.entity.PropertyFilterCondition in project jmix by jmix-framework.
the class PropertyConditionBuilder method createFilterConditionByPath.
protected FilterCondition createFilterConditionByPath(MetaPropertyPath metaPropertyPath) {
Class modelClass = filterComponents.getModelClass(PropertyFilter.class);
FilterCondition filterCondition = (FilterCondition) metadata.create(modelClass);
MetaClass metaClass = metaPropertyPath.getMetaClass();
if (PropertyFilterCondition.class.isAssignableFrom(modelClass)) {
String property = metaPropertyPath.toPathString();
((PropertyFilterCondition) filterCondition).setProperty(property);
((PropertyFilterCondition) filterCondition).setParameterName(PropertyConditionUtils.generateParameterName(property));
((PropertyFilterCondition) filterCondition).setCaptionPosition(SupportsCaptionPosition.CaptionPosition.LEFT);
String localizedCaption = messageTools.getPropertyCaption(metaClass, property);
filterCondition.setLocalizedCaption(localizedCaption);
String propertyFilterPrefix = propertyFilterSupport.getPropertyFilterPrefix(null, property);
filterCondition.setComponentId(propertyFilterPrefix.substring(0, propertyFilterPrefix.length() - 1));
PropertyFilter.Operation operation = propertyFilterSupport.getDefaultOperation(metaClass, property);
((PropertyFilterCondition) filterCondition).setOperation(operation);
FilterValueComponent modelValueComponent = metadata.create(FilterValueComponent.class);
HasValue valueComponent = singleFilterSupport.generateValueComponent(metaClass, property, operation);
modelValueComponent.setComponentId(valueComponent.getId());
modelValueComponent.setComponentName(singleFilterSupport.getValueComponentName(valueComponent));
((PropertyFilterCondition) filterCondition).setValueComponent(modelValueComponent);
}
return filterCondition;
}
use of io.jmix.ui.entity.PropertyFilterCondition in project jmix by jmix-framework.
the class PropertyFilterConverter method convertToModel.
@Override
public PropertyFilterCondition convertToModel(PropertyFilter propertyFilter) {
PropertyFilterCondition condition = super.convertToModel(propertyFilter);
condition.setCaption(propertyFilter.getCaption());
condition.setLocalizedCaption(getLocalizedModelCaption(propertyFilter));
condition.setCaptionPosition(propertyFilter.getCaptionPosition());
condition.setRequired(propertyFilter.isRequired());
condition.setProperty(propertyFilter.getProperty());
condition.setOperation(propertyFilter.getOperation());
condition.setOperationEditable(propertyFilter.isOperationEditable());
condition.setOperationCaptionVisible(propertyFilter.isOperationCaptionVisible());
condition.setParameterName(propertyFilter.getParameterName());
FilterValueComponent valueComponent = convertValueComponentToModel(propertyFilter);
String modelDefaultValue = convertDefaultValueToModel(propertyFilter);
valueComponent.setDefaultValue(modelDefaultValue);
condition.setValueComponent(valueComponent);
return condition;
}
Aggregations