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);
}
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);
}
}
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);
}
}
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));
}
}
}
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);
}
}
Aggregations