use of io.jmix.ui.component.filter.configuration.RunTimeConfiguration in project jmix by jmix-framework.
the class FilterConfigurationConverter method toConfiguration.
public Filter.Configuration toConfiguration(FilterConfiguration configurationModel, Filter filter) {
String id = configurationModel.getConfigurationId();
LogicalFilterCondition rootCondition = configurationModel.getRootCondition();
FilterConverter converter = filterComponents.getConverterByModelClass(rootCondition.getClass(), filter);
LogicalFilterComponent logicalFilterComponent = (LogicalFilterComponent) converter.convertToComponent(rootCondition);
Filter.Configuration configuration = new RunTimeConfiguration(id, logicalFilterComponent, filter);
configuration.setName(configurationModel.getName());
for (FilterComponent filterComponent : logicalFilterComponent.getFilterComponents()) {
if (filterComponent instanceof SingleFilterComponent) {
configuration.setFilterComponentDefaultValue(((SingleFilterComponent<?>) filterComponent).getParameterName(), ((SingleFilterComponent<?>) filterComponent).getValue());
}
}
return configuration;
}
use of io.jmix.ui.component.filter.configuration.RunTimeConfiguration in project jmix by jmix-framework.
the class FilterSaveAsAction method copyConfiguration.
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Filter.Configuration copyConfiguration(String newId, Filter.Configuration existingConfiguration) {
LogicalFilterComponent rootLogicalFilterComponent = existingConfiguration.getRootLogicalFilterComponent();
FilterConverter converter = filterComponents.getConverterByComponentClass(rootLogicalFilterComponent.getClass(), filter);
Map<String, Object> valuesMap = filterSupport.initConfigurationValuesMap(existingConfiguration);
LogicalFilterCondition logicalFilterCondition = (LogicalFilterCondition) converter.convertToModel(rootLogicalFilterComponent);
filterSupport.resetConfigurationValuesMap(existingConfiguration, valuesMap);
LogicalFilterComponent logicalFilterComponent = (LogicalFilterComponent) converter.convertToComponent(logicalFilterCondition);
Filter.Configuration newConfiguration = new RunTimeConfiguration(newId, logicalFilterComponent, existingConfiguration.getOwner());
filterSupport.refreshConfigurationDefaultValues(newConfiguration);
filterSupport.resetConfigurationValuesMap(newConfiguration, valuesMap);
return newConfiguration;
}
use of io.jmix.ui.component.filter.configuration.RunTimeConfiguration in project jmix by jmix-framework.
the class FilterSupport method initFilterConfiguration.
protected Filter.Configuration initFilterConfiguration(String id, String name, Filter.Configuration existedConfiguration, boolean isNewConfiguration, LogicalFilterComponent rootFilterComponent) {
Filter.Configuration resultConfiguration;
if (isNewConfiguration) {
resultConfiguration = new RunTimeConfiguration(id, rootFilterComponent, existedConfiguration.getOwner());
} else if (!existedConfiguration.getId().equals(id)) {
Filter owner = existedConfiguration.getOwner();
resultConfiguration = new RunTimeConfiguration(id, rootFilterComponent, owner);
owner.removeConfiguration(existedConfiguration);
} else {
resultConfiguration = existedConfiguration;
resultConfiguration.setRootLogicalFilterComponent(rootFilterComponent);
}
resultConfiguration.setName(name);
return resultConfiguration;
}
use of io.jmix.ui.component.filter.configuration.RunTimeConfiguration in project jmix by jmix-framework.
the class FilterImpl method initEmptyConfiguration.
protected void initEmptyConfiguration() {
LogicalFilterComponent configurationLogicalComponent = createConfigurationRootLogicalFilterComponent(LogicalFilterComponent.Operation.AND);
emptyConfiguration = new RunTimeConfiguration("empty_configuration", configurationLogicalComponent, this);
String emptyConfigurationName = StringUtils.isNotEmpty(getCaption()) ? getCaption() : messages.getMessage("filter.emptyConfiguration.name");
emptyConfiguration.setName(emptyConfigurationName);
setCurrentConfiguration(emptyConfiguration);
}
Aggregations