use of io.jmix.ui.entity.FilterValueComponent in project jmix by jmix-framework.
the class FullTextFilterConverter method convertValueComponentToComponent.
protected HasValue<String> convertValueComponentToComponent(FullTextFilterCondition model) {
HasValue<String> valueComponent = uiComponents.create(TextField.TYPE_STRING);
FilterValueComponent filterValueComponent = model.getValueComponent();
if (filterValueComponent != null) {
valueComponent.setId(filterValueComponent.getComponentId());
valueComponent.setStyleName(filterValueComponent.getStyleName());
}
return valueComponent;
}
use of io.jmix.ui.entity.FilterValueComponent in project jmix by jmix-framework.
the class AddConditionScreen method createFilterCondition.
protected FilterCondition createFilterCondition(Class<? extends FilterCondition> modelClass) {
FilterCondition newCondition = metadata.create(modelClass);
if (newCondition instanceof AbstractSingleFilterCondition) {
FilterValueComponent filterValueComponent = metadata.create(FilterValueComponent.class);
((AbstractSingleFilterCondition) newCondition).setValueComponent(filterValueComponent);
}
return newCondition;
}
use of io.jmix.ui.entity.FilterValueComponent in project jmix by jmix-framework.
the class JpqlFilterConditionEdit method onBeforeCommitChanges.
@SuppressWarnings("rawtypes")
@Subscribe
protected void onBeforeCommitChanges(BeforeCommitChangesEvent event) {
if (defaultValueField != null && getEditedEntity().getParameterClass() != null && getEditedEntity().getValueComponent() != null) {
Class parameterClass = classManager.loadClass(getEditedEntity().getParameterClass());
String modelDefaultValue = jpqlFilterSupport.formatDefaultValue(parameterClass, getEditedEntity().getHasInExpression(), defaultValueField.getValue());
FilterValueComponent valueComponent = getEditedEntity().getValueComponent();
valueComponent.setDefaultValue(modelDefaultValue);
valueComponent.setComponentName(singleFilterSupport.getValueComponentName(defaultValueField));
}
String caption = getEditedEntity().getCaption();
if (!Strings.isNullOrEmpty(caption)) {
getEditedEntity().setLocalizedCaption(caption);
}
}
use of io.jmix.ui.entity.FilterValueComponent in project jmix by jmix-framework.
the class JpqlFilterConverter method convertValueComponentToComponent.
protected HasValue convertValueComponentToComponent(JpqlFilter component, JpqlFilterCondition model) {
HasValue valueComponent = generateValueComponent(component, model);
FilterValueComponent filterValueComponent = model.getValueComponent();
if (filterValueComponent != null) {
String componentName = filterValueComponent.getComponentName();
if (componentName != null) {
String defaultName = singleFilterSupport.getValueComponentName(valueComponent);
if (!Objects.equals(defaultName, componentName)) {
valueComponent = uiComponents.create(componentName);
}
}
valueComponent.setId(filterValueComponent.getComponentId());
valueComponent.setStyleName(filterValueComponent.getStyleName());
}
return valueComponent;
}
use of io.jmix.ui.entity.FilterValueComponent in project jmix by jmix-framework.
the class JpqlFilterConverter method convertToModel.
@Override
public JpqlFilterCondition convertToModel(JpqlFilter jpqlFilter) {
JpqlFilterCondition condition = super.convertToModel(jpqlFilter);
condition.setCaption(jpqlFilter.getCaption());
condition.setLocalizedCaption(getLocalizedModelCaption(jpqlFilter));
condition.setCaptionPosition(jpqlFilter.getCaptionPosition());
condition.setRequired(jpqlFilter.isRequired());
condition.setParameterName(jpqlFilter.getParameterName());
condition.setParameterClass(jpqlFilter.getParameterClass().getName());
condition.setWhere(jpqlFilter.getWhere());
condition.setJoin(jpqlFilter.getJoin());
condition.setHasInExpression(jpqlFilter.hasInExpression());
FilterValueComponent valueComponent = convertValueComponentToModel(jpqlFilter);
String modelDefaultValue = convertDefaultValueToModel(jpqlFilter);
valueComponent.setDefaultValue(modelDefaultValue);
condition.setValueComponent(valueComponent);
return condition;
}
Aggregations