use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.
the class TechnologyListenersTN method checkOperationOutputQuantities.
public void checkOperationOutputQuantities(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
FormComponent technologyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (technologyForm.getEntityId() == null) {
return;
}
Entity technology = technologyForm.getEntity();
if (!TechnologyState.DRAFT.getStringValue().equals(technology.getStringField(TechnologyFields.STATE))) {
return;
}
technology = technology.getDataDefinition().get(technology.getId());
List<String> messages = normService.checkOperationOutputQuantities(technology);
if (!messages.isEmpty()) {
StringBuilder builder = new StringBuilder();
for (String message : messages) {
builder.append(message);
builder.append(", ");
}
technologyForm.addMessage("technologies.technology.validate.error.invalidQuantity", MessageType.INFO, false, builder.toString());
}
}
use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.
the class WorkPlanDetailsHooks method disableFormForGeneratedWorkPlan.
final void disableFormForGeneratedWorkPlan(final ViewDefinitionState view) {
FormComponent workPlanForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
CheckBoxComponent generatedCheckbox = (CheckBoxComponent) view.getComponentByReference(WorkPlanFields.GENERATED);
if (workPlanForm == null) {
return;
}
if (workPlanForm.getEntityId() == null) {
view.getComponentByReference(WorkPlanFields.ORDERS).setEnabled(false);
view.getComponentByReference(WorkPlanFields.WORK_PLAN_ORDER_COLUMNS).setEnabled(false);
} else {
boolean isEnabled = !generatedCheckbox.isChecked();
view.getComponentByReference(WorkPlanFields.NAME).setEnabled(isEnabled);
view.getComponentByReference(WorkPlanFields.TYPE).setEnabled(isEnabled);
view.getComponentByReference(WorkPlanFields.DONT_PRINT_ORDERS_IN_WORK_PLANS).setEnabled(isEnabled);
view.getComponentByReference(WorkPlanFields.ORDERS).setEnabled(isEnabled);
view.getComponentByReference(WorkPlanFields.WORK_PLAN_ORDER_COLUMNS).setEnabled(isEnabled);
view.getComponentByReference(WorkPlanFields.INPUT_PRODUCT_COLUMN_TO_SORT_BY).setEnabled(isEnabled);
view.getComponentByReference(WorkPlanFields.ORDER_SORTING).setEnabled(isEnabled);
}
}
use of com.qcadoo.view.api.components.FormComponent 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.FormComponent in project mes by qcadoo.
the class BasicProductionCountingDetailsHooks method setFieldEditableDependsOfOrderState.
private void setFieldEditableDependsOfOrderState(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
GridComponent grid = (GridComponent) view.getComponentByReference(L_GRID);
Long formId = form.getEntityId();
if (formId == null) {
return;
}
Entity basicProductionCounting = form.getEntity();
if (disableGrid(orderService.getOrder(basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER).getId()))) {
grid.setEnabled(false);
} else {
boolean isLocked = progressModifyLockHelper.isLocked(orderService.getOrder(basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER).getId()));
grid.setEnabled(!isLocked);
}
}
use of com.qcadoo.view.api.components.FormComponent in project mes by qcadoo.
the class DetailedProductionCountingAndProgressListHooks method setGridEditableDependsOfOrderState.
public void setGridEditableDependsOfOrderState(final ViewDefinitionState view) {
FormComponent orderForm = (FormComponent) view.getComponentByReference(L_ORDER);
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
Long orderId = orderForm.getEntityId();
if (orderId == null) {
return;
}
if (disable(orderService.getOrder(orderId))) {
grid.setEnabled(false);
} else {
boolean isLocked = progressModifyLockHelper.isLocked(orderService.getOrder(orderId));
grid.setEnabled(!isLocked);
}
}
Aggregations