use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class PalletNumberHelperDetailsHooks method disableButtonsWhenNotSaved.
private void disableButtonsWhenNotSaved(final ViewDefinitionState view) {
FormComponent palletNumberHelperForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup actionsRibbonGroup = ribbon.getGroupByName(L_ACTIONS);
RibbonGroup printRibbonGroup = ribbon.getGroupByName(L_PRINT);
RibbonActionItem saveRibbonActionItem = actionsRibbonGroup.getItemByName(L_SAVE);
RibbonActionItem printPalletNumberReportHelperRibbonActionItem = printRibbonGroup.getItemByName(L_PRINT_PALLET_NUMBER_HELPER_REPORT);
Long palletNumberHelperId = palletNumberHelperForm.getEntityId();
boolean isEnabled = (palletNumberHelperId != null);
if (saveRibbonActionItem != null) {
saveRibbonActionItem.setEnabled(!isEnabled);
saveRibbonActionItem.requestUpdate(true);
}
if (printPalletNumberReportHelperRibbonActionItem != null) {
printPalletNumberReportHelperRibbonActionItem.setEnabled(isEnabled);
printPalletNumberReportHelperRibbonActionItem.requestUpdate(true);
}
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ParametersHooks method changeButtonsState.
private void changeButtonsState(final ViewDefinitionState view, final boolean enabled) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup company = ribbon.getGroupByName(L_COMPANY);
RibbonActionItem redirectToCompany = company.getItemByName(L_REDIRECT_TO_COMPANY);
redirectToCompany.setEnabled(enabled);
redirectToCompany.requestUpdate(true);
window.requestRibbonRender();
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class StaffsListHooks method updateRibbonState.
public void updateRibbonState(final ViewDefinitionState view) {
GridComponent staffsGrid = (GridComponent) view.getComponentByReference(L_GRID);
WindowComponent window = (WindowComponent) view.getComponentByReference(L_WINDOW);
RibbonGroup labels = window.getRibbon().getGroupByName(L_LABELS);
RibbonActionItem printStaffLabels = labels.getItemByName(L_PRINT_STAFF_LABELS);
boolean isEnabled = !staffsGrid.getSelectedEntities().isEmpty();
printStaffLabels.setEnabled(isEnabled);
printStaffLabels.requestUpdate(true);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ProductDetailsHooks method updateProductFamilySizesRibbonState.
public void updateProductFamilySizesRibbonState(final ViewDefinitionState view) {
FormComponent productForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup productFamily = window.getRibbon().getGroupByName(L_PRODUCT_FAMILY);
RibbonActionItem productFamilySizes = productFamily.getItemByName(L_PRODUCT_FAMILY_SIZES);
Entity product = productForm.getEntity();
updateButtonState(productFamilySizes, ProductFamilyElementType.PRODUCTS_FAMILY.getStringValue().equals(product.getField(ProductFields.ENTITY_TYPE)));
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ImportService method changeButtonsState.
public void changeButtonsState(final ViewDefinitionState view, final boolean isEnabled) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup importRibbonGroup = ribbon.getGroupByName(L_IMPORT);
RibbonActionItem redirectToLogsRibbonActionItem = importRibbonGroup.getItemByName(L_REDIRECT_TO_LOGS);
redirectToLogsRibbonActionItem.setEnabled(isEnabled);
redirectToLogsRibbonActionItem.requestUpdate(true);
}
Aggregations