use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class OperationalTaskHooksBPC method getRibbonItem.
private RibbonActionItem getRibbonItem(final ViewDefinitionState view, final String ribbonGroupName, final String ribbonItemName) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup ribbonGroup = ribbon.getGroupByName(ribbonGroupName);
if (ribbonGroup == null) {
return null;
}
return ribbonGroup.getItemByName(ribbonItemName);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class CompanyService method disableButton.
public void disableButton(final ViewDefinitionState view, final String ribbonGroupName, final String ribbonActionItemName, final boolean isEnabled, final String message) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup ribbonGroup = window.getRibbon().getGroupByName(ribbonGroupName);
RibbonActionItem ribbonActionItem = ribbonGroup.getItemByName(ribbonActionItemName);
ribbonActionItem.setEnabled(isEnabled);
if (isEnabled) {
ribbonActionItem.setMessage(null);
} else {
ribbonActionItem.setMessage(message);
}
ribbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.
the class ProductDetailsHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
FormComponent operationGroupForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup operationGroups = window.getRibbon().getGroupByName(L_CONVERSIONS);
RibbonActionItem getDefaultConversions = operationGroups.getItemByName(L_GET_DEFAULT_CONVERSIONS);
Entity operationGroup = operationGroupForm.getEntity();
updateButtonState(getDefaultConversions, Objects.nonNull(operationGroup.getId()));
}
use of com.qcadoo.view.api.ribbon.RibbonGroup 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.RibbonGroup 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);
}
}
Aggregations