Search in sources :

Example 41 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class MasterOrderProductAttrValueDetailsHooks method setFilters.

private void setFilters(ViewDefinitionState view) {
    LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(MasterOrderProductAttrValueFields.ATTRIBUTE);
    LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(MasterOrderProductAttrValueFields.ATTRIBUTE_VALUE);
    FilterValueHolder attributeValueLookupFilters = attributeValueLookup.getFilterValue();
    if (Objects.nonNull(attributeLookup.getEntity())) {
        attributeValueLookupFilters.put(L_ATTRIBUTE_ID, attributeLookup.getEntity().getId());
    } else if (attributeValueLookupFilters.has(L_ATTRIBUTE_ID)) {
        attributeValueLookupFilters.remove(L_ATTRIBUTE_ID);
    }
    attributeValueLookup.setFilterValue(attributeValueLookupFilters);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 42 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class OrderCriteriaModifier method putMasterOrderNumberFilter.

public void putMasterOrderNumberFilter(final LookupComponent lookupComponent, final String masterOrderNumber) {
    FilterValueHolder valueHolder = lookupComponent.getFilterValue();
    valueHolder.put(MASTER_ORDER_NUMBER_FILTER_VALUE, masterOrderNumber);
    lookupComponent.setFilterValue(valueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 43 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class OrderCriteriaModifier method clearMasterOrderNumberFilter.

public void clearMasterOrderNumberFilter(LookupComponent lookupComponent) {
    FilterValueHolder valueHolder = lookupComponent.getFilterValue();
    valueHolder.remove(MASTER_ORDER_NUMBER_FILTER_VALUE);
    lookupComponent.setFilterValue(valueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Example 44 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class SalesPlanUseOtherTechnologyHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) throws JSONException {
    String oldTechnologyId = view.getJsonContext().get("window.mainTab.salesPlanProduct.gridLayout.oldTechnologyId").toString();
    Entity technology = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY).get(Long.parseLong(oldTechnologyId));
    Entity product = technology.getBelongsToField(TechnologyFields.PRODUCT);
    FieldComponent oldTechnologyField = (FieldComponent) view.getComponentByReference("oldTechnology");
    oldTechnologyField.setFieldValue(technology.getStringField(TechnologyFields.NUMBER));
    LookupComponent technologyLookup = (LookupComponent) view.getComponentByReference(SalesPlanProductFields.TECHNOLOGY);
    FilterValueHolder technologyFilterValueHolder = technologyLookup.getFilterValue();
    technologyFilterValueHolder.put(TechnologyCriteriaModifiersO.PRODUCT_PARAMETER, product.getId());
    technologyLookup.setFilterValue(technologyFilterValueHolder);
    technologyLookup.setRequired(true);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 45 with FilterValueHolder

use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.

the class ResourceAttributeValueDetailsHooks method setFilters.

private void setFilters(ViewDefinitionState view) {
    LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ResourceAttributeValueFields.ATTRIBUTE);
    LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ResourceAttributeValueFields.ATTRIBUTE_VALUE);
    FilterValueHolder attributeValueLookupFilters = attributeValueLookup.getFilterValue();
    if (Objects.nonNull(attributeLookup.getEntity())) {
        attributeValueLookupFilters.put(L_ATTRIBUTE_ID, attributeLookup.getEntity().getId());
    } else if (attributeValueLookupFilters.has(L_ATTRIBUTE_ID)) {
        attributeValueLookupFilters.remove(L_ATTRIBUTE_ID);
    }
    attributeValueLookup.setFilterValue(attributeValueLookupFilters);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Aggregations

FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)119 LookupComponent (com.qcadoo.view.api.components.LookupComponent)69 Entity (com.qcadoo.model.api.Entity)64 FormComponent (com.qcadoo.view.api.components.FormComponent)45 GridComponent (com.qcadoo.view.api.components.GridComponent)26 FieldComponent (com.qcadoo.view.api.components.FieldComponent)13 Collectors (java.util.stream.Collectors)11 Autowired (org.springframework.beans.factory.annotation.Autowired)11 Service (org.springframework.stereotype.Service)11 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)10 SearchCriteriaBuilder (com.qcadoo.model.api.search.SearchCriteriaBuilder)10 SearchRestrictions (com.qcadoo.model.api.search.SearchRestrictions)10 Objects (java.util.Objects)10 DataDefinition (com.qcadoo.model.api.DataDefinition)9 JSONObject (org.json.JSONObject)9 UserFieldsMF (com.qcadoo.mes.materialFlow.constants.UserFieldsMF)8 UserLocationFields (com.qcadoo.mes.materialFlow.constants.UserLocationFields)8 EntityList (com.qcadoo.model.api.EntityList)8 SecurityService (com.qcadoo.security.api.SecurityService)8 QcadooSecurityConstants (com.qcadoo.security.constants.QcadooSecurityConstants)8