Search in sources :

Example 1 with HasValue

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);
}
Also used : HasValue(io.jmix.ui.component.HasValue)

Example 2 with HasValue

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;
}
Also used : JpqlFilter(io.jmix.ui.component.JpqlFilter) MetaClass(io.jmix.core.metamodel.model.MetaClass) HasValue(io.jmix.ui.component.HasValue)

Example 3 with HasValue

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;
}
Also used : FilterValueComponent(io.jmix.ui.entity.FilterValueComponent) HasValue(io.jmix.ui.component.HasValue)

Example 4 with HasValue

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;
}
Also used : JpqlFilter(io.jmix.ui.component.JpqlFilter) HasValue(io.jmix.ui.component.HasValue)

Example 5 with HasValue

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);
}
Also used : GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) SingleFilterComponent(io.jmix.ui.component.SingleFilterComponent) Component(io.jmix.ui.component.Component) HasValue(io.jmix.ui.component.HasValue)

Aggregations

HasValue (io.jmix.ui.component.HasValue)9 MetaClass (io.jmix.core.metamodel.model.MetaClass)3 FilterValueComponent (io.jmix.ui.entity.FilterValueComponent)3 JpqlFilter (io.jmix.ui.component.JpqlFilter)2 PropertyFilter (io.jmix.ui.component.PropertyFilter)2 GuiDevelopmentException (io.jmix.ui.GuiDevelopmentException)1 Component (io.jmix.ui.component.Component)1 SingleFilterComponent (io.jmix.ui.component.SingleFilterComponent)1 FilterCondition (io.jmix.ui.entity.FilterCondition)1 HeaderFilterCondition (io.jmix.ui.entity.HeaderFilterCondition)1 PropertyFilterCondition (io.jmix.ui.entity.PropertyFilterCondition)1