Search in sources :

Example 76 with FieldComponent

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

the class TechnologyOperCompDetailsListenersTNFO method changeNextOperationAfterProducedTypeNorm.

public void changeNextOperationAfterProducedTypeNorm(final ViewDefinitionState viewDefinitionState, final ComponentState state, final String[] args) {
    FieldComponent nextOperationAfterProducedType = (FieldComponent) viewDefinitionState.getComponentByReference(NEXT_OPERATION_AFTER_PRODUCED_TYPE);
    FieldComponent nextOperationAfterProducedQuantity = (FieldComponent) viewDefinitionState.getComponentByReference(NEXT_OPERATION_AFTER_PRODUCED_QUANTITY);
    FieldComponent nextOperationAfterProducedQuantityUNIT = (FieldComponent) viewDefinitionState.getComponentByReference(TechnologyOperationComponentFieldsTNFO.NEXT_OPERATION_AFTER_PRODUCED_QUANTITY_UNIT);
    boolean visibilityValue = "02specified".equals(nextOperationAfterProducedType.getFieldValue());
    nextOperationAfterProducedQuantity.setVisible(visibilityValue);
    nextOperationAfterProducedQuantity.setEnabled(visibilityValue);
    nextOperationAfterProducedQuantityUNIT.setVisible(visibilityValue);
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 77 with FieldComponent

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

the class StaffDetailsHooks method fillFieldAboutWageGroup.

public void fillFieldAboutWageGroup(final ViewDefinitionState view) {
    LookupComponent lookup = (LookupComponent) view.getComponentByReference("wageGroup");
    Entity wageGroup = lookup.getEntity();
    FieldComponent laborCostFromWageGroups = (FieldComponent) view.getComponentByReference("laborCostFromWageGroups");
    FieldComponent superiorWageGroups = (FieldComponent) view.getComponentByReference("superiorWageGroups");
    if (wageGroup != null) {
        laborCostFromWageGroups.setFieldValue(wageGroup.getField(LABOR_HOURLY_COST));
        superiorWageGroups.setFieldValue(wageGroup.getStringField(SUPERIOR_WAGE_GROUP));
    } else {
        laborCostFromWageGroups.setFieldValue(null);
        superiorWageGroups.setFieldValue(null);
    }
}
Also used : Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 78 with FieldComponent

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

the class OperationDetailsHooksTNFO method updateFieldsStateOnWindowLoad.

public void updateFieldsStateOnWindowLoad(final ViewDefinitionState viewDefinitionState) {
    FieldComponent nextOperationAfterProducedType = (FieldComponent) viewDefinitionState.getComponentByReference(NEXT_OPERATION_AFTER_PRODUCED_TYPE);
    FieldComponent nextOperationAfterProducedQuantity = (FieldComponent) viewDefinitionState.getComponentByReference(NEXT_OPERATION_AFTER_PRODUCED_QUANTITY);
    FieldComponent nextOperationAfterProducedQuantityUNIT = (FieldComponent) viewDefinitionState.getComponentByReference(NEXT_OPERATION_AFTER_PRODUCED_QUANTITY_UNIT);
    FieldComponent areProductQuantitiesDivisible = (FieldComponent) viewDefinitionState.getComponentByReference("areProductQuantitiesDivisible");
    FieldComponent isTjDivisible = (FieldComponent) viewDefinitionState.getComponentByReference("isTjDivisible");
    nextOperationAfterProducedType.setRequired(true);
    if (nextOperationAfterProducedType.getFieldValue().equals("02specified")) {
        nextOperationAfterProducedQuantity.setVisible(true);
        nextOperationAfterProducedQuantity.setEnabled(true);
        nextOperationAfterProducedQuantityUNIT.setVisible(true);
        nextOperationAfterProducedQuantityUNIT.setEnabled(true);
    } else {
        nextOperationAfterProducedQuantity.setVisible(false);
        nextOperationAfterProducedQuantityUNIT.setVisible(false);
    }
    nextOperationAfterProducedQuantity.requestComponentUpdateState();
    if ("1".equals(areProductQuantitiesDivisible.getFieldValue())) {
        isTjDivisible.setEnabled(true);
    }
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 79 with FieldComponent

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

the class OperationDetailsHooksWP method setOperationDefaultValues.

public final void setOperationDefaultValues(final ViewDefinitionState view) {
    FormComponent operationForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (operationForm.getEntityId() == null) {
        for (String fieldName : Lists.newArrayList(ParameterFieldsWP.IMAGE_URL_IN_WORK_PLAN)) {
            FieldComponent fieldComponent = (FieldComponent) view.getComponentByReference(fieldName);
            fieldComponent.setFieldValue(getParameterField(fieldName));
        }
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 80 with FieldComponent

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

the class ProductionCountingAttributeValueDetailsHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    setValueBold(view);
    setFilters(view);
    LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ProductionCountingAttributeValueFields.ATTRIBUTE);
    LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProductionCountingAttributeValueFields.ATTRIBUTE_VALUE);
    FieldComponent valueField = (FieldComponent) view.getComponentByReference(ProductionCountingAttributeValueFields.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