use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class SkillStaffDetails method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity opSkill = form.getEntity();
FieldComponent maxSkillLevelField = (FieldComponent) view.getComponentByReference(MAX_LEVEL);
maxSkillLevelField.setFieldValue(opSkill.getBelongsToField(StaffSkillsFields.SKILL).getIntegerField(SkillFields.MAXIMUM_LEVEL));
LookupComponent staffLookup = (LookupComponent) view.getComponentByReference(StaffSkillsFields.STAFF);
FilterValueHolder filterValueHolder = staffLookup.getFilterValue();
Long skillId = opSkill.getBelongsToField(StaffSkillsFields.SKILL).getId();
if (Objects.isNull(skillId)) {
filterValueHolder.remove(L_SKILL_ID);
} else {
filterValueHolder.put(L_SKILL_ID, skillId);
}
staffLookup.setFilterValue(filterValueHolder);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class StaffSkillDetailsHooks method filterSkillLookup.
private void filterSkillLookup(final LookupComponent skillLookup, final Entity staff) {
FilterValueHolder filterValueHolder = skillLookup.getFilterValue();
Long staffId = staff.getId();
if (Objects.isNull(staffId)) {
filterValueHolder.remove(L_STAFF_ID);
} else {
filterValueHolder.put(L_STAFF_ID, staffId);
}
skillLookup.setFilterValue(filterValueHolder);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class ProductAttributeValueDetailsHooks method setFilters.
private void setFilters(ViewDefinitionState view) {
LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ProductAttributeValueFields.ATTRIBUTE);
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProductAttributeValueFields.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 BaseAttributeValueDetailsHooks method setFilters.
private void setFilters(ViewDefinitionState view) {
LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ATTRIBUTE);
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(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 ModelDetailsHooks method fillCriteriaModifiers.
private void fillCriteriaModifiers(final ViewDefinitionState view) {
FormComponent modelForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent assortmentLookup = (LookupComponent) view.getComponentByReference(ModelFields.ASSORTMENT);
LookupComponent productLookup = (LookupComponent) view.getComponentByReference("productLookup");
Long modelId = modelForm.getEntityId();
Entity assortment = assortmentLookup.getEntity();
FilterValueHolder filterValueHolder = productLookup.getFilterValue();
if (Objects.nonNull(modelId)) {
filterValueHolder.put(ProductCriteriaModifiers.L_MODEL_ID, modelId);
}
if (Objects.isNull(assortment)) {
if (filterValueHolder.has(ProductCriteriaModifiers.L_ASSORTMENT_ID)) {
filterValueHolder.remove(ProductCriteriaModifiers.L_ASSORTMENT_ID);
}
} else {
filterValueHolder.put(ProductCriteriaModifiers.L_ASSORTMENT_ID, assortment.getId());
}
productLookup.setFilterValue(filterValueHolder);
}
Aggregations