use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class EventHooks method enableFromRibbonGroup.
private void enableFromRibbonGroup(final ViewDefinitionState view, final boolean enable, final String groupName, String... items) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup ribbonGroup = ribbon.getGroupByName(groupName);
if (ribbonGroup != null) {
for (String item : items) {
RibbonActionItem ribbonItem = ribbonGroup.getItemByName(item);
if (ribbonItem != null) {
ribbonItem.setEnabled(enable);
ribbonItem.requestUpdate(true);
}
}
}
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class MaintenanceEventContextService method setEnableOfRibbonActions.
private void setEnableOfRibbonActions(ViewDefinitionState viewDefinitionState, boolean enabled) {
WindowComponent window = (WindowComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup customActions = ribbon.getGroupByName("customActions");
if (customActions == null) {
return;
}
for (RibbonActionItem ribbonActionItem : customActions.getItems()) {
ribbonActionItem.setEnabled(enabled);
ribbonActionItem.requestUpdate(true);
}
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ActionDetailsHooks method disableActionsWhenDefault.
public void disableActionsWhenDefault(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actions = window.getRibbon().getGroupByName("actions");
for (RibbonActionItem item : actions.getItems()) {
item.setEnabled(false);
item.requestUpdate(true);
}
GridComponent workstationsGrid = (GridComponent) view.getComponentByReference(ActionFields.WORKSTATIONS);
GridComponent subassembliesGrid = (GridComponent) view.getComponentByReference(ActionFields.SUBASSEMBLIES);
GridComponent workstationTypesGrid = (GridComponent) view.getComponentByReference(ActionFields.WORKSTATION_TYPES);
workstationsGrid.setEnabled(false);
subassembliesGrid.setEnabled(false);
workstationTypesGrid.setEnabled(false);
FieldComponent nameField = (FieldComponent) view.getComponentByReference(ActionFields.NAME);
FieldComponent appliesToField = (FieldComponent) view.getComponentByReference(ActionFields.APPLIES_TO);
nameField.setEnabled(false);
appliesToField.setEnabled(false);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class GanttOperationService method disableCalendarButtonWhenRealizationTimeNotGenerated.
public void disableCalendarButtonWhenRealizationTimeNotGenerated(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (form.getEntity() == null) {
return;
}
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonActionItem showOnCalendarButton = window.getRibbon().getGroupByName(ProductionSchedulingConstants.VIEW_RIBBON_ACTION_ITEM_GROUP).getItemByName(ProductionSchedulingConstants.VIEW_RIBBON_ACTION_ITEM_NAME);
if (isRealizationTimeGenerated(view)) {
showOnCalendarButton.setEnabled(true);
} else {
showOnCalendarButton.setEnabled(false);
}
showOnCalendarButton.requestUpdate(true);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class GenerateMRCForOrderHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FormComponent materialRequirementCoverageForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Long materialRequirementCoverageId = materialRequirementCoverageForm.getEntityId();
Entity mRCForOrder = materialRequirementCoverageForm.getEntity();
Entity order = mRCForOrder.getBelongsToField("order");
boolean saved = checkIfMaterialRequirementCoverageIsSaved(materialRequirementCoverageId);
boolean enable = false;
if (order.getStringField(OrderFields.STATE).equals(OrderState.ACCEPTED.getStringValue())) {
enable = true;
}
FieldComponent generatedField = (FieldComponent) view.getComponentByReference(CoverageForOrderFields.GENERATED);
boolean generated = "1".equals(generatedField.getFieldValue());
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup coverage = (RibbonGroup) window.getRibbon().getGroupByName(L_COVERAGE);
RibbonGroup reports = (RibbonGroup) window.getRibbon().getGroupByName(L_REPORTS);
RibbonActionItem generateMaterialRequirementCoverage = (RibbonActionItem) coverage.getItemByName(L_GENERATE_MATERIAL_REQUIREMENT_COVERAGE);
RibbonActionItem printMaterialRequirementCoverage = (RibbonActionItem) coverage.getItemByName(L_PRINT_MATERIAL_REQUIREMENT_COVERAGE);
RibbonActionItem saveMaterialRequirementCoverage = (RibbonActionItem) reports.getItemByName(L_SAVE_MATERIAL_REQUIREMENT_COVERAGE);
RibbonActionItem showMaterialRequirementCoverages = (RibbonActionItem) reports.getItemByName(L_SHOW_MATERIAL_REQUIREMENT_COVERAGES);
boolean areSaved = checkIfThereAreSavedMaterialRequirementCoverages();
updateButtonState(generateMaterialRequirementCoverage, enable);
updateButtonState(printMaterialRequirementCoverage, generated && !saved);
updateButtonState(saveMaterialRequirementCoverage, generated && !saved);
updateButtonState(showMaterialRequirementCoverages, areSaved);
}
Aggregations