Search in sources :

Example 1 with MaintenanceEventState

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);
    }
}
Also used : MaintenanceEventState(com.qcadoo.mes.cmmsMachineParts.states.constants.MaintenanceEventState) FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Aggregations

MaintenanceEventState (com.qcadoo.mes.cmmsMachineParts.states.constants.MaintenanceEventState)1 Entity (com.qcadoo.model.api.Entity)1 FormComponent (com.qcadoo.view.api.components.FormComponent)1 GridComponent (com.qcadoo.view.api.components.GridComponent)1