Search in sources :

Example 11 with FieldComponent

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);
    }
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) ComponentState(com.qcadoo.view.api.ComponentState)

Example 12 with FieldComponent

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);
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 13 with FieldComponent

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);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) DocumentException(com.lowagie.text.DocumentException) IOException(java.io.IOException) Date(java.util.Date) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent) Transactional(org.springframework.transaction.annotation.Transactional)

Example 14 with FieldComponent

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();
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 15 with FieldComponent

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();
    }
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Aggregations

FieldComponent (com.qcadoo.view.api.components.FieldComponent)443 Entity (com.qcadoo.model.api.Entity)201 FormComponent (com.qcadoo.view.api.components.FormComponent)183 LookupComponent (com.qcadoo.view.api.components.LookupComponent)107 BigDecimal (java.math.BigDecimal)47 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)31 GridComponent (com.qcadoo.view.api.components.GridComponent)31 Date (java.util.Date)30 Optional (com.google.common.base.Optional)18 AwesomeDynamicListComponent (com.qcadoo.view.api.components.AwesomeDynamicListComponent)14 ComponentState (com.qcadoo.view.api.ComponentState)13 FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)13 WindowComponent (com.qcadoo.view.api.components.WindowComponent)12 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)11 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)9 PossibleUnitConversions (com.qcadoo.model.api.units.PossibleUnitConversions)7 SimpleDateFormat (java.text.SimpleDateFormat)7 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)6 QcadooViewConstants (com.qcadoo.view.constants.QcadooViewConstants)6 Collectors (java.util.stream.Collectors)6