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