use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class TOCDetailsHooksPFTD method setViewDisable.
private void setViewDisable(final ViewDefinitionState view) {
FormComponent tocForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (tocForm.getEntityId() == null) {
return;
}
Entity technology = tocForm.getPersistedEntityWithIncludedFormValues().getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
LookupComponent divisionookupComponent = (LookupComponent) view.getComponentByReference("division");
LookupComponent plLookupComponent = (LookupComponent) view.getComponentByReference("productionLine");
if (Range.ONE_DIVISION.getStringValue().equals(technology.getStringField(TechnologyFieldsPFTD.RANGE))) {
divisionookupComponent.setEnabled(false);
if (technology.getBelongsToField("productionLine") == null) {
plLookupComponent.setEnabled(true);
} else {
plLookupComponent.setEnabled(false);
}
} else {
divisionookupComponent.setEnabled(true);
plLookupComponent.setEnabled(true);
}
}
use of com.qcadoo.view.api.components.LookupComponent 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.LookupComponent 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.LookupComponent 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.LookupComponent in project mes by qcadoo.
the class TOCDetailsHooksPFTD method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
FormComponent tocForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (tocForm.getEntityId() == null) {
return;
}
Entity technology = tocForm.getPersistedEntityWithIncludedFormValues().getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
LookupComponent divisionLookupComponent = (LookupComponent) view.getComponentByReference("division");
divisionLookupComponent.setEnabled(!Range.ONE_DIVISION.getStringValue().equals(technology.getStringField(TechnologyFieldsPFTD.RANGE)));
}
Aggregations