use of com.qcadoo.view.api.components.LookupComponent 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.LookupComponent 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.LookupComponent in project mes by qcadoo.
the class UserDetailsHooksB method setFieldsEnabledForAdmin.
public void setFieldsEnabledForAdmin(final ViewDefinitionState view) {
if (securityService.hasCurrentUserRole("ROLE_ADMIN")) {
Stream.of(UserFields.STAFF, UserFields.FACTORY).forEach(fieldName -> {
LookupComponent lookupComponent = (LookupComponent) view.getComponentByReference(fieldName);
if (Objects.nonNull(lookupComponent)) {
lookupComponent.setEnabled(true);
lookupComponent.requestComponentUpdateState();
}
});
}
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ParametersHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent parametersForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent companyLookup = (LookupComponent) view.getComponentByReference(ParameterFields.COMPANY);
boolean isSaved = (parametersForm.getEntityId() != null);
boolean isCompany = (companyLookup.getEntity() != null);
changeButtonsState(view, isSaved && isCompany);
}
use of com.qcadoo.view.api.components.LookupComponent 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);
}
Aggregations