Search in sources :

Example 36 with FieldComponent

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

the class ProductionCountingQuantitySetDetailsListeners method fillUnitFields.

public void fillUnitFields(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    Entity product = ((LookupComponent) state).getEntity();
    String unit = "";
    if (product != null) {
        unit = product.getStringField(ProductFields.UNIT);
    }
    FieldComponent field = (FieldComponent) view.getComponentByReference(L_PRODUCT_UNIT);
    field.setFieldValue(unit);
    field.requestComponentUpdateState();
}
Also used : Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 37 with FieldComponent

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

the class ProductionTrackingDetailsListeners method clearFields.

public void clearFields(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    FieldComponent technologyOperationComponentField = (FieldComponent) view.getComponentByReference(ProductionTrackingFields.TECHNOLOGY_OPERATION_COMPONENT);
    technologyOperationComponentField.setFieldValue("");
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (Objects.isNull(form.getEntityId())) {
        return;
    }
    GridComponent trackingOperationProductInComponentsGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.TRACKING_OPERATION_PRODUCT_IN_COMPONENTS);
    GridComponent trackingOperationProductOutComponentsGrid = (GridComponent) view.getComponentByReference(ProductionTrackingFields.TRACKING_OPERATION_PRODUCT_OUT_COMPONENTS);
    trackingOperationProductInComponentsGrid.setEntities(Lists.newArrayList());
    trackingOperationProductOutComponentsGrid.setEntities(Lists.newArrayList());
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 38 with FieldComponent

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

the class AnomalyDetailsHooks method fillFields.

private void fillFields(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity anomaly = form.getEntity().getDataDefinition().get(form.getEntityId());
    FieldComponent productionTrackingNumberField = (FieldComponent) view.getComponentByReference("productionTrackingNumber");
    FieldComponent createDateField = (FieldComponent) view.getComponentByReference("createDate");
    createDateField.setEnabled(false);
    FieldComponent orderNumberField = (FieldComponent) view.getComponentByReference("orderNumber");
    FieldComponent masterProductNumberField = (FieldComponent) view.getComponentByReference("masterProductNumber");
    FieldComponent productionLineNumberField = (FieldComponent) view.getComponentByReference("productionLineNumber");
    FieldComponent productNumberField = (FieldComponent) view.getComponentByReference("productNumber");
    FieldComponent reasonsField = (FieldComponent) view.getComponentByReference("reasons");
    FieldComponent unitField = (FieldComponent) view.getComponentByReference("unit");
    FieldComponent locationField = (FieldComponent) view.getComponentByReference("location");
    Entity productionTracking = anomaly.getBelongsToField("productionTracking");
    productionTrackingNumberField.setFieldValue(productionTracking.getStringField(ProductionTrackingFields.NUMBER));
    orderNumberField.setFieldValue(productionTracking.getBelongsToField(ProductionTrackingFields.ORDER).getStringField(OrderFields.NUMBER));
    productionLineNumberField.setFieldValue(productionTracking.getBelongsToField(ProductionTrackingFields.ORDER).getBelongsToField(OrderFields.PRODUCTION_LINE).getStringField(ProductionLineFields.NUMBER));
    masterProductNumberField.setFieldValue(anomaly.getBelongsToField("masterProduct").getStringField(ProductFields.NUMBER));
    productNumberField.setFieldValue(anomaly.getBelongsToField("product").getStringField(ProductFields.NUMBER));
    unitField.setFieldValue(anomaly.getBelongsToField("product").getStringField(ProductFields.UNIT));
    reasonsField.setFieldValue(anomaly.getHasManyField("anomalyReasons").stream().map(a -> a.getStringField("name")).collect(Collectors.joining(", ")));
    if (Objects.nonNull(anomaly.getBelongsToField(AnomalyFields.LOCATION))) {
        locationField.setFieldValue(anomaly.getBelongsToField(AnomalyFields.LOCATION).getStringField("number"));
        locationField.requestComponentUpdateState();
    }
    if (anomaly.getStringField(AnomalyFields.STATE).equals("03completed")) {
        view.getComponentByReference("anomalyExplanations").setEnabled(false);
    }
    productionTrackingNumberField.requestComponentUpdateState();
    orderNumberField.requestComponentUpdateState();
    productionLineNumberField.requestComponentUpdateState();
    masterProductNumberField.requestComponentUpdateState();
    productNumberField.requestComponentUpdateState();
    unitField.requestComponentUpdateState();
    reasonsField.requestComponentUpdateState();
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 39 with FieldComponent

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

the class OrderDetailsHooksPC method setRegisterPieceworkEnabledAndValue.

private void setRegisterPieceworkEnabledAndValue(final ViewDefinitionState view, final boolean isEnabled, final boolean value) {
    FieldComponent fieldComponent = (FieldComponent) view.getComponentByReference(OrderFieldsPC.REGISTER_PIECEWORK);
    fieldComponent.setEnabled(isEnabled);
    fieldComponent.setFieldValue(value);
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 40 with FieldComponent

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

the class ProdOutResourceAttrValDetailsHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    setValueBold(view);
    setFilters(view);
    LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ProdOutResourceAttrValFields.ATTRIBUTE);
    LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProdOutResourceAttrValFields.ATTRIBUTE_VALUE);
    FieldComponent valueField = (FieldComponent) view.getComponentByReference(ProdOutResourceAttrValFields.VALUE);
    if (Objects.nonNull(attributeLookup.getEntity())) {
        Entity attribute = attributeLookup.getEntity();
        FieldComponent unitField = (FieldComponent) view.getComponentByReference(L_UNIT);
        unitField.setFieldValue(attribute.getStringField(AttributeFields.UNIT));
        unitField.requestComponentUpdateState();
        if (AttributeDataType.CONTINUOUS.getStringValue().equals(attribute.getStringField(AttributeFields.DATA_TYPE))) {
            valueField.setVisible(true);
            attributeValueLookup.setVisible(false);
        } else {
            valueField.setVisible(false);
            attributeValueLookup.setVisible(true);
        }
    } else {
        valueField.setVisible(false);
        attributeValueLookup.setVisible(false);
    }
}
Also used : Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) 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