use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class PalletNumberDetailsHooks method disableButtonsWhenNotSaved.
public void disableButtonsWhenNotSaved(final ViewDefinitionState view) {
FormComponent palletNumberForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup printRibbonGroup = ribbon.getGroupByName(L_PRINT);
RibbonActionItem printPalletNumberReportRibbonActionItem = printRibbonGroup.getItemByName(L_PRINT_PALLET_NUMBER_REPORT);
Long palletNumberId = palletNumberForm.getEntityId();
boolean isSaved = (palletNumberId != null);
if (printPalletNumberReportRibbonActionItem != null) {
printPalletNumberReportRibbonActionItem.setEnabled(isSaved);
printPalletNumberReportRibbonActionItem.requestUpdate(true);
}
}
use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class PalletNumbersListHooks method disableButtonsWhenNotSelected.
public void disableButtonsWhenNotSelected(final ViewDefinitionState view) {
GridComponent palletNumbersGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup printRibbonGroup = ribbon.getGroupByName(L_PRINT);
RibbonActionItem printPalletNumbersReportRibbonActionItem = printRibbonGroup.getItemByName(L_PRINT_PALLET_NUMBERS_REPORT);
boolean palletNumbersAreSelected = !palletNumbersGrid.getSelectedEntities().isEmpty();
if (printPalletNumbersReportRibbonActionItem != null) {
printPalletNumbersReportRibbonActionItem.setEnabled(palletNumbersAreSelected);
printPalletNumbersReportRibbonActionItem.requestUpdate(true);
}
}
use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class EventHooks method toggleOldSolutionsButton.
private void toggleOldSolutionsButton(ViewDefinitionState view) {
WindowComponent windowComponent = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = windowComponent.getRibbon();
RibbonGroup solutionsRibbonGroup = ribbon.getGroupByName("solutions");
RibbonActionItem showSolutionsRibbonActionItem = solutionsRibbonGroup.getItemByName("showSolutions");
FormComponent formComponent = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity event = formComponent.getPersistedEntityWithIncludedFormValues();
showSolutionsRibbonActionItem.setEnabled(event.getId() != null);
showSolutionsRibbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class EventHooks method toggleRibbonButton.
private void toggleRibbonButton(final ViewDefinitionState view, String groupName, String itemName, boolean enabled) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup group = ribbon.getGroupByName(groupName);
RibbonActionItem item = group.getItemByName(itemName);
item.setEnabled(enabled);
item.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.Ribbon 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();
}
Aggregations