use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class OperationSkillDetailsHooks method filterSkillLookup.
private void filterSkillLookup(final LookupComponent skillLookup, final Entity operation) {
FilterValueHolder filterValueHolder = skillLookup.getFilterValue();
Long operationId = operation.getId();
if (Objects.isNull(operationId)) {
filterValueHolder.remove(L_OPERATION_ID);
} else {
filterValueHolder.put(L_OPERATION_ID, operationId);
}
skillLookup.setFilterValue(filterValueHolder);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class ProductToProductGroupTechnologyDetailsHooks method setCriteriaModifierParameters.
public void setCriteriaModifierParameters(LookupComponent productFamilyLookup, LookupComponent orderProductLookup) {
Entity productFamily = productFamilyLookup.getEntity();
Entity orderProduct = orderProductLookup.getEntity();
FilterValueHolder filterValueHolder = orderProductLookup.getFilterValue();
if (productFamily == null) {
filterValueHolder.remove(OrderProductCriteriaModifiers.L_PRODUCT_FAMILY_ID);
orderProductLookup.setFieldValue(null);
} else {
Long productFamilyId = productFamily.getId();
filterValueHolder.put(OrderProductCriteriaModifiers.L_PRODUCT_FAMILY_ID, productFamilyId);
if (orderProduct != null && !productFamilyId.equals(orderProduct.getBelongsToField(ProductFields.PARENT).getId())) {
orderProductLookup.setFieldValue(null);
}
}
orderProductLookup.setFilterValue(filterValueHolder);
orderProductLookup.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class TOCDetailsHooks method setWorkstationsCriteriaModifiers.
private void setWorkstationsCriteriaModifiers(final ViewDefinitionState view) {
LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(TechnologyOperationComponentFields.DIVISION);
LookupComponent workstationLookup = (LookupComponent) view.getComponentByReference(L_WORKSTATION_LOOKUP);
GridComponent workstations = (GridComponent) view.getComponentByReference(TechnologyOperationComponentFields.WORKSTATIONS);
Entity division = divisionLookup.getEntity();
FilterValueHolder filter = workstationLookup.getFilterValue();
if (division != null) {
filter.put(TechnologyOperationComponentFields.DIVISION, division.getId());
workstations.setEditable(true);
} else {
filter.remove(TechnologyOperationComponentFields.DIVISION);
workstations.setEditable(false);
}
workstationLookup.setFilterValue(filter);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class TechnologicalProcessDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
CheckBoxComponent extendedTimeForSizeGroupField = (CheckBoxComponent) view.getComponentByReference(EXTENDED_TIME_FOR_SIZE_GROUP);
FieldComponent increasePercentField = (FieldComponent) view.getComponentByReference(INCREASE_PERCENT);
LookupComponent sizeGroupLookup = (LookupComponent) view.getComponentByReference(SIZE_GROUP);
if (extendedTimeForSizeGroupField.isChecked()) {
increasePercentField.setEnabled(true);
increasePercentField.setRequired(true);
sizeGroupLookup.setEnabled(true);
sizeGroupLookup.setRequired(true);
} else {
increasePercentField.setEnabled(false);
increasePercentField.setFieldValue(null);
increasePercentField.setRequired(false);
sizeGroupLookup.setEnabled(false);
sizeGroupLookup.setFieldValue(null);
sizeGroupLookup.setRequired(false);
}
increasePercentField.requestComponentUpdateState();
sizeGroupLookup.requestComponentUpdateState();
LookupComponent workstationLookup = (LookupComponent) view.getComponentByReference(WORKSTATION);
LookupComponent workstationTypeLookup = (LookupComponent) view.getComponentByReference(WORKSTATION_TYPE);
FilterValueHolder filterValueHolder = workstationLookup.getFilterValue();
if (workstationTypeLookup.getFieldValue() != null) {
filterValueHolder.put(WorkstationFields.WORKSTATION_TYPE, workstationTypeLookup.getEntity().getId());
} else {
filterValueHolder.remove(WorkstationFields.WORKSTATION_TYPE);
}
workstationLookup.setFilterValue(filterValueHolder);
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Long technologicalProcessId = form.getEntityId();
if (Objects.nonNull(technologicalProcessId)) {
Entity workstationType = workstationTypeLookup.getEntity();
Entity workstationTypeFromDB = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGICAL_PROCESS).get(technologicalProcessId).getBelongsToField(WORKSTATION_TYPE);
if (workstationType == null && workstationTypeFromDB != null || workstationType != null && workstationTypeFromDB == null || workstationType != null && !workstationType.getId().equals(workstationTypeFromDB.getId())) {
workstationLookup.setFieldValue(null);
workstationLookup.requestComponentUpdateState();
}
}
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class AddProcessesHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
Long technologicalProcessListId = ((FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM)).getEntityId();
GridComponent technologicalProcesses = (GridComponent) view.getComponentByReference(L_TECHNOLOGICAL_PROCESSES);
FilterValueHolder gridFilterValueHolder = technologicalProcesses.getFilterValue();
gridFilterValueHolder.put(TechnologicalProcessListDetailsCriteriaModifiers.L_TECHNOLOGICAL_PROCESS_LIST_ID, technologicalProcessListId);
technologicalProcesses.setFilterValue(gridFilterValueHolder);
}
Aggregations