Search in sources :

Example 1 with FieldsForType

use of com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType in project mes by qcadoo.

the class PlannedEventDetailsHooks method toggleActionsFieldsVisible.

public void toggleActionsFieldsVisible(final ViewDefinitionState view) {
    FormComponent plannedEventForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity plannedEvent = plannedEventForm.getPersistedEntityWithIncludedFormValues();
    PlannedEventType type = PlannedEventType.from(plannedEvent);
    FieldsForType fieldsForType = eventFieldsForTypeFactory.createFieldsForType(type);
    if (fieldsForType == null) {
        return;
    }
    toggleAddMultipleActions(view, fieldsForType, plannedEvent);
}
Also used : Entity(com.qcadoo.model.api.Entity) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Example 2 with FieldsForType

use of com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType in project mes by qcadoo.

the class PlannedEventDetailsHooks method toggleFieldsVisible.

public void toggleFieldsVisible(final ViewDefinitionState view) {
    FormComponent plannedEventForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity plannedEvent = plannedEventForm.getPersistedEntityWithIncludedFormValues();
    PlannedEventType type = PlannedEventType.from(plannedEvent);
    FieldsForType fieldsForType = eventFieldsForTypeFactory.createFieldsForType(type);
    if (fieldsForType == null) {
        return;
    }
    hideFields(view, plannedEvent, fieldsForType);
    hideTabs(view, fieldsForType);
    clearGrids(view, fieldsForType);
    setAndLockBasedOn(view, fieldsForType);
    actionsButtonProcess(plannedEvent, view, fieldsForType);
}
Also used : Entity(com.qcadoo.model.api.Entity) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Example 3 with FieldsForType

use of com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType in project mes by qcadoo.

the class PlannedEventHooks method clearHiddenFields.

private void clearHiddenFields(final Entity event) {
    FieldsForType fieldsForType = fieldsForTypeFactory.createFieldsForType(PlannedEventType.from(event));
    List<String> fieldsToClear = fieldsForType.getHiddenFields();
    for (String fieldName : fieldsToClear) {
        if (fieldName.equals(PlannedEventFields.REQUIRES_SHUTDOWN) || fieldName.equals(PlannedEventFields.PLANNED_SEPARATELY)) {
            event.setField(fieldName, false);
        } else {
            event.setField(fieldName, null);
        }
    }
}
Also used : FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Example 4 with FieldsForType

use of com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType in project mes by qcadoo.

the class PlannedEventStateValidationService method tabIsNotHidden.

private boolean tabIsNotHidden(Entity plannedEvent, String tabName) {
    PlannedEventType type = PlannedEventType.from(plannedEvent);
    FieldsForType fieldsForType = eventFieldsForTypeFactory.createFieldsForType(type);
    return !fieldsForType.getHiddenTabs().contains(tabName);
}
Also used : FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Example 5 with FieldsForType

use of com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType in project mes by qcadoo.

the class TimeUsageXlsService method updatePartsAndDescription.

private void updatePartsAndDescription(List<TimeUsageDTO> usages, Locale locale) {
    for (TimeUsageDTO usage : usages) {
        if ("planned".equals(usage.getEventType())) {
            PlannedEventType type = PlannedEventType.parseString(usage.getType());
            FieldsForType fields = fieldsForTypeFactory.createFieldsForType(type);
            if (fields.getHiddenTabs().contains(PlannedEventFields.MACHINE_PARTS_TAB)) {
                String notApplicable = translationService.translate("cmmsMachineParts.timeUsageReport.na", locale);
                usage.setParts(notApplicable);
            }
            if (fields.getHiddenTabs().contains(PlannedEventFields.SOLUTION_DESCRIPTION_TAB)) {
                String notApplicable = translationService.translate("cmmsMachineParts.timeUsageReport.na", locale);
                usage.setDescription(notApplicable);
            }
        }
    }
}
Also used : TimeUsageDTO(com.qcadoo.mes.cmmsMachineParts.reports.xls.timeUsage.dto.TimeUsageDTO) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) FieldsForType(com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)

Aggregations

FieldsForType (com.qcadoo.mes.cmmsMachineParts.plannedEvents.fieldsForType.FieldsForType)6 PlannedEventType (com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType)3 Entity (com.qcadoo.model.api.Entity)2 TimeUsageDTO (com.qcadoo.mes.cmmsMachineParts.reports.xls.timeUsage.dto.TimeUsageDTO)1