Search in sources :

Example 71 with CheckBoxComponent

use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.

the class SupplyParametersListenersPFTD method toggleGenerateIssuesTo.

public void toggleGenerateIssuesTo(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    String value = (String) componentState.getFieldValue();
    if (StringUtils.isNotEmpty(value)) {
        WarehouseIssueProductsSource warehouseIssueProductsSource = WarehouseIssueProductsSource.parseString(value);
        CheckBoxComponent generateWarehouseIssuesToDeliveries = (CheckBoxComponent) view.getComponentByReference(ParameterFieldsPFTD.GENERATE_WAREHOUSE_ISSUES_TO_DELIVERIES);
        CheckBoxComponent generateWarehouseIssuesToOrders = (CheckBoxComponent) view.getComponentByReference(ParameterFieldsPFTD.GENERATE_WAREHOUSE_ISSUES_TO_ORDERS);
        if (WarehouseIssueProductsSource.MANUAL.equals(warehouseIssueProductsSource)) {
            generateWarehouseIssuesToDeliveries.setEnabled(true);
            uncheckAndDisable(generateWarehouseIssuesToOrders);
            lockDeliveriesComponents(view, generateWarehouseIssuesToDeliveries, args);
        } else if (WarehouseIssueProductsSource.ORDER.equals(warehouseIssueProductsSource)) {
            generateWarehouseIssuesToOrders.setEnabled(true);
            uncheckAndDisable(generateWarehouseIssuesToDeliveries);
            onGenerateWarehouseIssuesToOrdersChange(view, generateWarehouseIssuesToOrders, args);
        }
    }
}
Also used : WarehouseIssueProductsSource(com.qcadoo.mes.productFlowThruDivision.constants.WarehouseIssueProductsSource) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 72 with CheckBoxComponent

use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.

the class SupplyParametersListenersPFTD method onGenerateWarehouseIssuesToOrdersChange.

public void onGenerateWarehouseIssuesToOrdersChange(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    CheckBoxComponent generateWarehouseIssues = (CheckBoxComponent) componentState;
    toggleDaysBeforeOrderStart(generateWarehouseIssues.isChecked(), view);
    toggleIssueLocation(generateWarehouseIssues.isChecked(), view);
    toggleAutomaticReleaseAfterGeneration(generateWarehouseIssues.isChecked(), view);
}
Also used : CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 73 with CheckBoxComponent

use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.

the class ProductionPerShiftDetailsHooks method markViewAsInitialized.

private void markViewAsInitialized(final ViewDefinitionState view) {
    Optional<CheckBoxComponent> maybeCheckbox = view.tryFindComponentByReference(VIEW_IS_INITIALIZED_CHECKBOX_REF);
    for (CheckBoxComponent checkbox : maybeCheckbox.asSet()) {
        checkbox.setChecked(true);
        checkbox.requestComponentUpdateState();
    }
}
Also used : CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 74 with CheckBoxComponent

use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.

the class ModifyTechnologyDetailsHooks method configureReplacePart.

private void configureReplacePart(ViewDefinitionState view) {
    CheckBoxComponent replaceCheckBox = (CheckBoxComponent) view.getComponentByReference(ModifyTechnologyHelperFields.REPLACE);
    LookupComponent replaceProductLookup = (LookupComponent) view.getComponentByReference(ModifyTechnologyHelperFields.REPLACE_PRODUCT);
    FieldComponent replaceProductQuantityComponent = (FieldComponent) view.getComponentByReference(ModifyTechnologyHelperFields.REPLACE_PRODUCT_QUANTITY);
    if (replaceCheckBox.isChecked()) {
        replaceProductLookup.setEnabled(true);
        replaceProductQuantityComponent.setEnabled(true);
        FieldComponent replaceProductUnit = (FieldComponent) view.getComponentByReference(L_REPLACE_PRODUCT_UNIT);
        if (Objects.nonNull(replaceProductLookup.getFieldValue())) {
            replaceProductUnit.setFieldValue(replaceProductLookup.getEntity().getStringField(ProductFields.UNIT));
        }
    } else {
        replaceProductLookup.setEnabled(false);
        replaceProductQuantityComponent.setEnabled(false);
    }
}
Also used : LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Example 75 with CheckBoxComponent

use of com.qcadoo.view.api.components.CheckBoxComponent in project mes by qcadoo.

the class OPICDetailsHooks method setProductBySizeGroupsGridEnabledAndClear.

private void setProductBySizeGroupsGridEnabledAndClear(final ViewDefinitionState view) {
    FormComponent operationProductInComponentForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    CheckBoxComponent differentProductsInDifferentSizesCheckBox = (CheckBoxComponent) view.getComponentByReference(OperationProductInComponentFields.DIFFERENT_PRODUCTS_IN_DIFFERENT_SIZES);
    CheckBoxComponent variousQuantitiesInProductsBySize = (CheckBoxComponent) view.getComponentByReference(OperationProductInComponentFields.VARIOUS_QUANTITIES_IN_PRODUCTS_BY_SIZE);
    FieldComponent givenQuantity = (FieldComponent) view.getComponentByReference(OperationProductInComponentFields.GIVEN_QUANTITY);
    FieldComponent givenQuantityUnit = (FieldComponent) view.getComponentByReference(OperationProductInComponentFields.GIVEN_UNIT);
    LookupComponent productLookup = (LookupComponent) view.getComponentByReference(OperationProductInComponentFields.PRODUCT);
    GridComponent productBySizeGroupsGrid = (GridComponent) view.getComponentByReference(OperationProductInComponentFields.PRODUCT_BY_SIZE_GROUPS);
    Entity operationProductInComponent = operationProductInComponentForm.getEntity();
    Entity operationComponent = operationProductInComponent.getBelongsToField(OperationProductInComponentFields.OPERATION_COMPONENT);
    Entity technology = null;
    if (Objects.isNull(operationComponent)) {
        technology = operationProductInComponent.getBelongsToField(OperationProductInComponentFields.TECHNOLOGY);
    } else {
        technology = operationComponent.getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
    }
    Entity product = technology.getBelongsToField(TechnologyFields.PRODUCT);
    String entityType = product.getStringField(ProductFields.ENTITY_TYPE);
    boolean isEnabled = ProductFamilyElementType.PRODUCTS_FAMILY.getStringValue().equals(entityType);
    boolean isChecked = differentProductsInDifferentSizesCheckBox.isChecked();
    if (isChecked) {
        productLookup.setFieldValue(null);
    } else {
        productBySizeGroupsGrid.setEntities(Lists.newArrayList());
    }
    differentProductsInDifferentSizesCheckBox.setEnabled(isEnabled);
    differentProductsInDifferentSizesCheckBox.requestComponentUpdateState();
    productLookup.setEnabled(!isChecked);
    productLookup.requestComponentUpdateState();
    productBySizeGroupsGrid.setEnabled(isChecked);
    String givenQuantityValue = (String) givenQuantity.getFieldValue();
    String givenQuantityUnitValue = (String) givenQuantityUnit.getFieldValue();
    if (!variousQuantitiesInProductsBySize.isChecked() && (StringUtils.isEmpty(givenQuantityValue) || StringUtils.isEmpty(givenQuantityUnitValue))) {
        productBySizeGroupsGrid.setEnabled(false);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Aggregations

CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)100 FormComponent (com.qcadoo.view.api.components.FormComponent)38 Entity (com.qcadoo.model.api.Entity)33 FieldComponent (com.qcadoo.view.api.components.FieldComponent)30 GridComponent (com.qcadoo.view.api.components.GridComponent)19 LookupComponent (com.qcadoo.view.api.components.LookupComponent)11 Date (java.util.Date)7 JSONObject (org.json.JSONObject)7 BigDecimal (java.math.BigDecimal)6 ComponentState (com.qcadoo.view.api.ComponentState)4 WindowComponent (com.qcadoo.view.api.components.WindowComponent)4 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)4 IOException (java.io.IOException)4 MaterialFlowResourcesConstants (com.qcadoo.mes.materialFlowResources.constants.MaterialFlowResourcesConstants)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)2 SearchRestrictions (com.qcadoo.model.api.search.SearchRestrictions)2 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)2 AwesomeDynamicListComponent (com.qcadoo.view.api.components.AwesomeDynamicListComponent)2 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)2