use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType in project mes by qcadoo.
the class PlannedEventDetailsHooks method actionsButtonProcess.
private void actionsButtonProcess(Entity plannedEvent, ViewDefinitionState view, FieldsForType ftype) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
PlannedEventType type = PlannedEventType.from(plannedEvent);
Ribbon ribbon = window.getRibbon();
RibbonGroup actionsGroup = ribbon.getGroupByName("actionsGroup");
RibbonActionItem addActionsItem = actionsGroup.getItemByName("actions");
if (plannedEvent.getId() == null) {
addActionsItem.setEnabled(false);
addActionsItem.requestUpdate(true);
window.requestRibbonRender();
return;
}
boolean enable = false;
if (type.compareTo(PlannedEventType.REVIEW) == 0) {
enable = true;
} else if (type.compareTo(PlannedEventType.REPAIRS) == 0) {
enable = true;
} else if (type.compareTo(PlannedEventType.EXTERNAL_SERVICE) == 0) {
enable = false;
} else if (type.compareTo(PlannedEventType.ADDITIONAL_WORK) == 0) {
enable = true;
} else if (type.compareTo(PlannedEventType.MANUAL) == 0) {
enable = true;
} else if (type.compareTo(PlannedEventType.METER_READING) == 0) {
enable = false;
} else if (type.compareTo(PlannedEventType.UDT_REVIEW) == 0) {
enable = false;
} else if (type.compareTo(PlannedEventType.AFTER_REVIEW) == 0) {
enable = false;
}
addActionsItem.setEnabled(enable);
addActionsItem.requestUpdate(true);
window.requestRibbonRender();
}
use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType 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);
}
use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType 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);
}
use of com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType 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);
}
}
}
}
Aggregations