use of com.qcadoo.view.api.ComponentState in project qcadoo by qcadoo.
the class ViewDefinitionStateImpl method getComponentByPath.
private ComponentState getComponentByPath(final String path) {
ComponentState componentState = this;
String[] pathParts = path.split("\\.");
for (int i = 0; i < pathParts.length; i++) {
ContainerState container = (ContainerState) componentState;
componentState = container.getChild(pathParts[i]);
if (componentState == null) {
return null;
}
}
return componentState;
}
use of com.qcadoo.view.api.ComponentState in project mes by qcadoo.
the class WarehouseIssueDetailHooks method hideComponents.
private void hideComponents(final ViewDefinitionState view, final String... names) {
for (String name : names) {
ComponentState component = view.getComponentByReference(name);
component.setVisible(false);
}
}
use of com.qcadoo.view.api.ComponentState in project mes by qcadoo.
the class TechnologyDetailsHooksPFTD method showHideDivisionField.
public void showHideDivisionField(final ViewDefinitionState view) {
FieldComponent rangeField = (FieldComponent) view.getComponentByReference(TechnologyFieldsPFTD.RANGE);
FieldComponent divisionField = (FieldComponent) view.getComponentByReference(TechnologyFieldsPFTD.DIVISION);
String range = (String) rangeField.getFieldValue();
GridComponent rangeTechnologyOperationComponent = (GridComponent) view.getComponentByReference(RANGE_TECHNOLOGY_OPERATION_COMPONENT);
ComponentState operationRangeDescriptionLabel = view.getComponentByReference(OPERATION_RANGE_DESCRIPTION);
if (Range.ONE_DIVISION.getStringValue().equals(range)) {
showField(divisionField, true);
rangeTechnologyOperationComponent.setVisible(false);
operationRangeDescriptionLabel.setVisible(false);
} else {
showField(divisionField, false);
rangeTechnologyOperationComponent.setVisible(true);
operationRangeDescriptionLabel.setVisible(true);
}
}
use of com.qcadoo.view.api.ComponentState in project mes by qcadoo.
the class TechnologyDetailsHooksPFTD method hideWorkstationsTableForCumulatedProductionRecording.
private void hideWorkstationsTableForCumulatedProductionRecording(final ViewDefinitionState view) {
FieldComponent typeOfProductionRecordingFieldComponent = (FieldComponent) view.getComponentByReference(TechnologyFieldsPC.TYPE_OF_PRODUCTION_RECORDING);
GridComponent workstationsTechnologyOperationComponent = (GridComponent) view.getComponentByReference(WORKSTATIONS_TECHNOLOGY_OPERATION_COMPONENT);
GridComponent workstations = (GridComponent) view.getComponentByReference(WORKSTATIONS);
ComponentState operationWorkstationsDescriptionLabel = view.getComponentByReference(OPERATION_WORKSTATIONS_DESCRIPTION);
if (Objects.nonNull(typeOfProductionRecordingFieldComponent) && TypeOfProductionRecording.FOR_EACH.getStringValue().equals(typeOfProductionRecordingFieldComponent.getFieldValue())) {
workstationsTechnologyOperationComponent.setVisible(true);
workstations.setVisible(true);
operationWorkstationsDescriptionLabel.setVisible(true);
} else {
workstationsTechnologyOperationComponent.setVisible(false);
workstations.setVisible(false);
operationWorkstationsDescriptionLabel.setVisible(false);
}
}
use of com.qcadoo.view.api.ComponentState in project mes by qcadoo.
the class ProductionTrackingServiceImpl method changeProducedQuantityFieldState.
@Override
public void changeProducedQuantityFieldState(final ViewDefinitionState viewDefinitionState) {
final FormComponent form = (FormComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_FORM);
Entity order = null;
if (form.getEntityId() != null) {
order = dataDefinitionService.get(OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER).get(form.getEntityId());
}
FieldComponent typeOfProductionRecording = (FieldComponent) viewDefinitionState.getComponentByReference(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING);
ComponentState doneQuantity = viewDefinitionState.getComponentByReference(L_DONE_QUANTITY);
ComponentState amountOfPP = viewDefinitionState.getComponentByReference(L_AMOUNT_OF_PRODUCT_PRODUCED);
if (order == null || order.getStringField(OrderFields.STATE).equals(OrderState.PENDING.getStringValue()) || order.getStringField(OrderFields.STATE).equals(OrderState.ACCEPTED.getStringValue())) {
doneQuantity.setEnabled(false);
amountOfPP.setEnabled(false);
} else if ("".equals(typeOfProductionRecording.getFieldValue()) || TypeOfProductionRecording.BASIC.getStringValue().equals(typeOfProductionRecording.getFieldValue())) {
doneQuantity.setEnabled(true);
amountOfPP.setEnabled(true);
} else {
doneQuantity.setEnabled(false);
amountOfPP.setEnabled(false);
}
}
Aggregations