use of io.jmix.ui.component.HasValue in project jmix-sneferu by mariodavid.
the class SetValueInteraction method execute.
@Override
public void execute(ScreenTestAPI screenTestAPI) {
HasValue hasValue = (HasValue) screenTestAPI.component(componentDescriptor).rawComponent();
hasValue.setValue(value);
}
use of io.jmix.ui.component.HasValue in project jmix by jmix-framework.
the class RelatedEntitiesSupportImpl method createJpqlFilter.
protected JpqlFilter createJpqlFilter(DataLoader dataLoader, MetaProperty metaProperty, MetaClass parentMetaClass, Collection selectedParentEntities) {
JpqlFilter jpqlFilter = uiComponents.create(JpqlFilter.NAME);
jpqlFilter.setDataLoader(dataLoader);
jpqlFilter.setHasInExpression(true);
jpqlFilter.setVisible(false);
Class parameterClass = parentMetaClass.getJavaClass();
jpqlFilter.setParameterClass(parameterClass);
jpqlFilter.setParameterName(jpqlFilterSupport.generateParameterName(null, parameterClass.getSimpleName()));
String where = getWhereExpression(metaProperty, parentMetaClass);
jpqlFilter.setCondition(where, null);
HasValue valueComponent = singleFilterSupport.generateValueComponent(metaProperty.getDomain(), true, parameterClass);
jpqlFilter.setValueComponent(valueComponent);
jpqlFilter.setValue(selectedParentEntities);
return jpqlFilter;
}
use of io.jmix.ui.component.HasValue 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.component.HasValue in project jmix by jmix-framework.
the class JpqlFilterConverter method convertToComponent.
@SuppressWarnings("unchecked")
@Override
public JpqlFilter<?> convertToComponent(JpqlFilterCondition model) {
JpqlFilter jpqlFilter = super.convertToComponent(model);
jpqlFilter.setCaption(model.getCaption());
jpqlFilter.setCaptionPosition(model.getCaptionPosition());
jpqlFilter.setRequired(model.getRequired());
jpqlFilter.setParameterName(model.getParameterName());
if (model.getParameterClass() != null) {
jpqlFilter.setParameterClass(classManager.loadClass(model.getParameterClass()));
}
jpqlFilter.setCondition(model.getWhere(), model.getJoin());
jpqlFilter.setHasInExpression(model.getHasInExpression());
HasValue valueComponent = convertValueComponentToComponent(jpqlFilter, model);
Object defaultValue = convertDefaultValueToComponent(jpqlFilter, model);
jpqlFilter.setValueComponent(valueComponent);
jpqlFilter.setValue(defaultValue);
return jpqlFilter;
}
use of io.jmix.ui.component.HasValue in project jmix by jmix-framework.
the class AbstractSingleFilterComponentLoader method loadValueComponent.
@SuppressWarnings("unchecked")
protected void loadValueComponent(C resultComponent, Element element) {
Component valueComponent;
if (!element.elements().isEmpty()) {
valueComponent = createValueComponent(element.elements());
} else {
valueComponent = generateValueComponent();
}
if (!(valueComponent instanceof HasValue)) {
throw new GuiDevelopmentException("Value component of the PropertyFilter must implement HasValue", getComponentContext().getCurrentFrameId());
}
resultComponent.setValueComponent((HasValue) valueComponent);
}
Aggregations