use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class TechnologyDetailsListenersPFTD method setWorkstationsLookup.
public void setWorkstationsLookup(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
if (!(componentState instanceof GridComponent)) {
return;
}
GridComponent grid = (GridComponent) componentState;
if (grid.getSelectedEntities().isEmpty()) {
return;
}
LookupComponent workstationLookup = (LookupComponent) view.getComponentByReference("workstationsForTOClookup");
Entity productionLine = grid.getSelectedEntities().get(0).getBelongsToField("productionLine");
FilterValueHolder filter = workstationLookup.getFilterValue();
if (Objects.nonNull(productionLine)) {
filter.put(OperationFields.PRODUCTION_LINE, productionLine.getId());
} else {
filter.remove(OperationFields.PRODUCTION_LINE);
}
workstationLookup.setFilterValue(filter);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class OperationDetailsHooks method setProductionLineCriteriaModifiers.
private void setProductionLineCriteriaModifiers(final ViewDefinitionState view) {
LookupComponent productionLineLookup = (LookupComponent) view.getComponentByReference(OperationFields.PRODUCTION_LINE);
LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(OperationFields.DIVISION);
Entity division = divisionLookup.getEntity();
FilterValueHolder filter = productionLineLookup.getFilterValue();
if (division != null) {
filter.put(OperationFields.DIVISION, division.getId());
} else {
filter.remove(OperationFields.DIVISION);
}
productionLineLookup.setFilterValue(filter);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class TOCDetailsHooks method setProductionLineCriteriaModifiers.
private void setProductionLineCriteriaModifiers(final ViewDefinitionState view) {
LookupComponent productionLineLookup = (LookupComponent) view.getComponentByReference(TechnologyOperationComponentFields.PRODUCTION_LINE);
LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(TechnologyOperationComponentFields.DIVISION);
Entity division = divisionLookup.getEntity();
FilterValueHolder filter = productionLineLookup.getFilterValue();
if (division != null) {
filter.put(TechnologyOperationComponentFields.DIVISION, division.getId());
} else {
filter.remove(TechnologyOperationComponentFields.DIVISION);
}
productionLineLookup.setFilterValue(filter);
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class WarehouseIssueDetailHooks method setCriteriaModifierParameters.
public void setCriteriaModifierParameters(final ViewDefinitionState view, final Entity order) {
LookupComponent technologyOperationComponentLookup = (LookupComponent) view.getComponentByReference(WarehouseIssueFields.TECHNOLOGY_OPERATION_COMPONENT);
LookupComponent divisionLookup = (LookupComponent) view.getComponentByReference(WarehouseIssueFields.DIVISION);
if (Objects.nonNull(order)) {
Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY);
if (Objects.nonNull(technology)) {
FilterValueHolder filterValueHolder = technologyOperationComponentLookup.getFilterValue();
filterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
technologyOperationComponentLookup.setFilterValue(filterValueHolder);
FilterValueHolder divisionFilterValueHolder = divisionLookup.getFilterValue();
divisionFilterValueHolder.put(OrderFields.TECHNOLOGY, technology.getId());
divisionLookup.setFilterValue(divisionFilterValueHolder);
}
}
}
use of com.qcadoo.view.api.components.lookup.FilterValueHolder in project mes by qcadoo.
the class TechnologyProductionLineDetailsHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent productionLineLookup = (LookupComponent) view.getComponentByReference(TechnologyProductionLineFields.PRODUCTION_LINE);
Entity entity = form.getEntity();
Entity technology = entity.getBelongsToField(TechnologyProductionLineFields.TECHNOLOGY);
Entity division = technology.getBelongsToField(TechnologyFieldsPFTD.DIVISION);
FilterValueHolder filterValueHolder = productionLineLookup.getFilterValue();
Long technologyId = technology.getId();
if (Objects.isNull(technologyId)) {
filterValueHolder.remove(TechnologyProductionLineCriteriaModifiers.L_TECHNOLOGY_ID);
} else {
filterValueHolder.put(TechnologyProductionLineCriteriaModifiers.L_TECHNOLOGY_ID, technologyId);
}
if (Objects.nonNull(division)) {
filterValueHolder.put(TechnologyProductionLineCriteriaModifiers.L_DIVISION_ID, division.getId());
} else if (filterValueHolder.has(TechnologyProductionLineCriteriaModifiers.L_DIVISION_ID)) {
filterValueHolder.remove(TechnologyProductionLineCriteriaModifiers.L_DIVISION_ID);
}
productionLineLookup.setFilterValue(filterValueHolder);
}
Aggregations