use of com.qcadoo.view.api.components.WindowComponent 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.components.WindowComponent 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.components.WindowComponent 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.components.WindowComponent in project mes by qcadoo.
the class FaultTypeDetailsHooks 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(FaultTypeFields.WORKSTATIONS);
GridComponent subassembliesGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.SUBASSEMBLIES);
GridComponent workstationTypesGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.WORKSTATION_TYPES);
workstationsGrid.setEnabled(false);
subassembliesGrid.setEnabled(false);
workstationTypesGrid.setEnabled(false);
FieldComponent nameField = (FieldComponent) view.getComponentByReference(FaultTypeFields.NAME);
FieldComponent appliesToField = (FieldComponent) view.getComponentByReference(FaultTypeFields.APPLIES_TO);
nameField.setEnabled(false);
appliesToField.setEnabled(false);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class FaultTypeListHooks method disableActionsWhenDefault.
private void disableActionsWhenDefault(final ViewDefinitionState view) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup actions = window.getRibbon().getGroupByName("actions");
RibbonActionItem copyButton = actions.getItemByName("copy");
RibbonActionItem deleteButton = actions.getItemByName("delete");
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
List<Entity> selectedFaults = grid.getSelectedEntities();
for (Entity selectedFault : selectedFaults) {
if (selectedFault.getBooleanField("isDefault")) {
copyButton.setEnabled(false);
deleteButton.setEnabled(false);
copyButton.requestUpdate(true);
deleteButton.requestUpdate(true);
return;
}
}
boolean enabled = !selectedFaults.isEmpty();
copyButton.setEnabled(enabled);
deleteButton.setEnabled(enabled);
copyButton.requestUpdate(true);
deleteButton.requestUpdate(true);
}
Aggregations