use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class TechnologyDetailsHooksPFTD method hideWorkstationsTableForCumulatedProductionRecording.
private void hideWorkstationsTableForCumulatedProductionRecording(final ViewDefinitionState view) {
FieldComponent typeOfProductionRecordingFieldComponent = (FieldComponent) view.getComponentByReference(TechnologyFieldsPC.TYPE_OF_PRODUCTION_RECORDING);
GridComponent workstationsTechnologyOperationComponent = (GridComponent) view.getComponentByReference(WORKSTATIONS_TECHNOLOGY_OPERATION_COMPONENT);
GridComponent workstations = (GridComponent) view.getComponentByReference(WORKSTATIONS);
ComponentState operationWorkstationsDescriptionLabel = view.getComponentByReference(OPERATION_WORKSTATIONS_DESCRIPTION);
if (Objects.nonNull(typeOfProductionRecordingFieldComponent) && TypeOfProductionRecording.FOR_EACH.getStringValue().equals(typeOfProductionRecordingFieldComponent.getFieldValue())) {
workstationsTechnologyOperationComponent.setVisible(true);
workstations.setVisible(true);
operationWorkstationsDescriptionLabel.setVisible(true);
} else {
workstationsTechnologyOperationComponent.setVisible(false);
workstations.setVisible(false);
operationWorkstationsDescriptionLabel.setVisible(false);
}
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class TechnologyDetailsHooksPFTD method hideFlowTableForManyDivision.
private void hideFlowTableForManyDivision(final ViewDefinitionState view) {
FieldComponent rangeField = (FieldComponent) view.getComponentByReference(TechnologyFieldsPFTD.RANGE);
String range = (String) rangeField.getFieldValue();
enableFlowGrids(view, !Range.ONE_DIVISION.getStringValue().equals(range), true);
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class ModelCardDetailsListeners method generateModelCard.
@Transactional
public void generateModelCard(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent productsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
if (productsGrid.getEntities().isEmpty()) {
view.addMessage("productFlowThruDivision.modelCard.generate.failure.noProducts", ComponentState.MessageType.INFO);
return;
}
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
CheckBoxComponent generated = (CheckBoxComponent) view.getComponentByReference(ModelCardFields.GENERATED);
FieldComponent workerField = (FieldComponent) view.getComponentByReference(ModelCardFields.WORKER);
FieldComponent dateField = (FieldComponent) view.getComponentByReference(ModelCardFields.DATE);
workerField.setFieldValue(securityService.getCurrentUserName());
dateField.setFieldValue(DateUtils.toDateTimeString(new Date()));
generated.setChecked(true);
Entity modelCard = form.getEntity();
modelCard = modelCard.getDataDefinition().save(modelCard);
form.setEntity(modelCard);
Entity modelCardWithFileName = fileService.updateReportFileName(modelCard, ModelCardFields.DATE, "productFlowThruDivision.modelCard.report.fileName");
try {
modelCardPdfService.generateDocument(modelCardWithFileName, state.getLocale(), PageSize.A4.rotate());
} catch (IOException | DocumentException e) {
throw new IllegalStateException(e.getMessage(), e);
}
view.addMessage("productFlowThruDivision.modelCard.generate.success", ComponentState.MessageType.SUCCESS);
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class SupplyParametersListenersPFTD method toggleDaysBeforeOrderStart.
private void toggleDaysBeforeOrderStart(final boolean lock, final ViewDefinitionState view) {
FieldComponent daysBeforeOrderStart = (FieldComponent) view.getComponentByReference(ParameterFieldsPFTD.DAYS_BEFORE_ORDER_START);
if (lock) {
daysBeforeOrderStart.setEnabled(true);
} else {
daysBeforeOrderStart.setEnabled(false);
daysBeforeOrderStart.setFieldValue(null);
}
daysBeforeOrderStart.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.FieldComponent in project mes by qcadoo.
the class TechnologyDetailsListenersPFTD method setFieldsVisible.
private void setFieldsVisible(final ViewDefinitionState view, final List<String> references, final boolean isVisible) {
for (String reference : references) {
FieldComponent field = (FieldComponent) view.getComponentByReference(reference);
field.setVisible(isVisible);
field.requestComponentUpdateState();
}
}
Aggregations