use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class ProductionCountingAttributeValueDetailsHooks method setFilters.
private void setFilters(ViewDefinitionState view) {
LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ProductionCountingAttributeValueFields.ATTRIBUTE);
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProductionCountingAttributeValueFields.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);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class ProductionCountingQuantityAdvancedDetailsHooks method setCriteriaModifierParameters.
private void setCriteriaModifierParameters(final ViewDefinitionState view) {
FormComponent productionCountingQuantityForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent technologyOperationComponentLookup = (LookupComponent) view.getComponentByReference(ProductionCountingQuantityFields.TECHNOLOGY_OPERATION_COMPONENT);
Entity productionCountingQuantity = productionCountingQuantityForm.getEntity();
Entity order = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.ORDER);
Entity basicProductionCounting = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.BASIC_PRODUCTION_COUNTING);
if (order != null) {
Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY);
if (technology != null) {
FilterValueHolder filterValueHolder = technologyOperationComponentLookup.getFilterValue();
filterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
technologyOperationComponentLookup.setFilterValue(filterValueHolder);
return;
}
}
if (basicProductionCounting != null) {
Entity basicProductionCountingOrder = basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER);
if (basicProductionCountingOrder != null) {
Entity technology = basicProductionCountingOrder.getBelongsToField(OrderFields.TECHNOLOGY);
if (technology != null) {
FilterValueHolder filterValueHolder = technologyOperationComponentLookup.getFilterValue();
filterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
technologyOperationComponentLookup.setFilterValue(filterValueHolder);
}
}
}
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class ProductDetailsHooks method setCriteriaModifierParameters.
private void setCriteriaModifierParameters(final ViewDefinitionState view) {
LookupComponent assortmentLookup = (LookupComponent) view.getComponentByReference(ProductFields.ASSORTMENT);
LookupComponent modelLookup = (LookupComponent) view.getComponentByReference(ProductFields.MODEL);
Entity assortment = assortmentLookup.getEntity();
FilterValueHolder filterValueHolder = modelLookup.getFilterValue();
if (Objects.isNull(assortment)) {
if (filterValueHolder.has(ModelCriteriaModifiers.L_ASSORTMENT_ID)) {
filterValueHolder.remove(ModelCriteriaModifiers.L_ASSORTMENT_ID);
}
} else {
filterValueHolder.put(ModelCriteriaModifiers.L_ASSORTMENT_ID, assortment.getId());
}
modelLookup.setFilterValue(filterValueHolder);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class ProductFamilySizesHooks method addOnBeforeRender.
public void addOnBeforeRender(final ViewDefinitionState view) throws JSONException {
JSONObject obj = view.getJsonContext();
if (obj.has("window.mainTab.product.productId")) {
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
FilterValueHolder holder = grid.getFilterValue();
holder.put(ProductFamilySizesCriteriaModifiers.L_PRODUCT_ID, obj.getLong("window.mainTab.product.productId"));
grid.setFilterValue(holder);
}
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class ProductReplacementsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) throws JSONException {
JSONObject obj = view.getJsonContext();
if (obj.has("window.mainTab.product.productId")) {
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
FilterValueHolder holder = grid.getFilterValue();
holder.put("PRODUCT_ID", obj.getLong("window.mainTab.product.productId"));
grid.setFilterValue(holder);
}
}
Aggregations