use of com.qcadoo.mes.cmmsMachineParts.states.constants.MaintenanceEventState in project mes by qcadoo.
the class EventHooks method disableFieldsForState.
private void disableFieldsForState(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity event = form.getPersistedEntityWithIncludedFormValues();
MaintenanceEventState state = MaintenanceEventState.of(event);
if (state.compareTo(MaintenanceEventState.CLOSED) == 0 || state.compareTo(MaintenanceEventState.REVOKED) == 0 || state.compareTo(MaintenanceEventState.PLANNED) == 0) {
form.setFormEnabled(false);
GridComponent staffWorkTimes = (GridComponent) view.getComponentByReference(MaintenanceEventFields.STAFF_WORK_TIMES);
GridComponent machineParts = (GridComponent) view.getComponentByReference(MaintenanceEventFields.MACHINE_PARTS_FOR_EVENT);
staffWorkTimes.setEnabled(false);
machineParts.setEnabled(false);
}
}
Aggregations