Search in sources :

Example 71 with FieldComponent

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

the class OperationDetailsListeners method setWorkstationsTabFields.

public void setWorkstationsTabFields(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    operationDetailsHooks.setWorkstationsTabFields(view);
    FieldComponent assignedToOperation = (FieldComponent) view.getComponentByReference(OperationFields.ASSIGNED_TO_OPERATION);
    String assignedToOperationValue = (String) assignedToOperation.getFieldValue();
    if (AssignedToOperation.WORKSTATIONS.getStringValue().equals(assignedToOperationValue)) {
        operationDetailsHooks.clearLookupField(view, OperationFields.WORKSTATION_TYPE);
        operationDetailsHooks.clearLookupField(view, OperationFields.DIVISION);
    } else if (AssignedToOperation.WORKSTATIONS_TYPE.getStringValue().equals(assignedToOperationValue)) {
        operationDetailsHooks.clearWorkstationsField(view);
        operationDetailsHooks.clearLookupField(view, OperationFields.DIVISION);
    }
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 72 with FieldComponent

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

the class GenerateTimeGapsViewHooks method setLowerTimeBoundOnEntry.

private void setLowerTimeBoundOnEntry(final ViewDefinitionState viewState) {
    FieldComponent dateFromField = (FieldComponent) viewState.getComponentByReference("fromDate");
    dateFromField.setFieldValue(DateUtils.toDateTimeString(new Date()));
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent) Date(java.util.Date)

Example 73 with FieldComponent

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

the class WarehouseMinimumStateDetailsHooks method fillUnits.

private void fillUnits(final ViewDefinitionState view, final Entity productEntity) {
    if (productEntity == null) {
        return;
    }
    String unit = productEntity.getStringField(ProductFields.UNIT);
    for (String componentReferenceName : UNIT_COMPONENT_REFERENCES) {
        FieldComponent unitComponent = (FieldComponent) view.getComponentByReference(componentReferenceName);
        if (unitComponent != null && StringUtils.isEmpty((String) unitComponent.getFieldValue())) {
            unitComponent.setFieldValue(unit);
            unitComponent.requestComponentUpdateState();
        }
    }
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 74 with FieldComponent

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

the class TechnologyOperationComponentDetailsHooks method updateNextOperationAfterProducedQuantityFieldStateonWindowLoad.

public void updateNextOperationAfterProducedQuantityFieldStateonWindowLoad(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);
    if ("02specified".equals(nextOperationAfterProducedType.getFieldValue())) {
        nextOperationAfterProducedQuantity.setVisible(true);
        nextOperationAfterProducedQuantity.setEnabled(true);
        nextOperationAfterProducedQuantityUNIT.setVisible(true);
        nextOperationAfterProducedQuantityUNIT.setEnabled(true);
    } else {
        nextOperationAfterProducedQuantity.setVisible(false);
        nextOperationAfterProducedQuantityUNIT.setVisible(false);
    }
}
Also used : FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 75 with FieldComponent

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

the class TechnologyOperCompDetailsListenersTNFO method applyTimeNormsFromGivenSource.

void applyTimeNormsFromGivenSource(final ViewDefinitionState view, final Entity source, final Iterable<String> fields) {
    checkArgument(source != null, "source entity is null");
    FieldComponent component = null;
    for (String fieldName : fields) {
        component = (FieldComponent) view.getComponentByReference(fieldName);
        component.setFieldValue(source.getField(fieldName));
    }
    if (source.getField(NEXT_OPERATION_AFTER_PRODUCED_TYPE) == null) {
        view.getComponentByReference(NEXT_OPERATION_AFTER_PRODUCED_TYPE).setFieldValue("01all");
    }
    if (source.getField(PRODUCTION_IN_ONE_CYCLE) == null) {
        view.getComponentByReference(PRODUCTION_IN_ONE_CYCLE).setFieldValue("1");
    }
    if (source.getField(NEXT_OPERATION_AFTER_PRODUCED_QUANTITY) == null) {
        view.getComponentByReference(NEXT_OPERATION_AFTER_PRODUCED_QUANTITY).setFieldValue("0");
    }
}
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