use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ProductionPerShiftDetailsHooks method changeButtonState.
void changeButtonState(final ViewDefinitionState view, final ProgressType progressType, final OrderState orderState) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup progressRibbonGroup = window.getRibbon().getGroupByName(PROGRESS_RIBBON_GROUP_NAME);
boolean isInCorrectionMode = progressType == ProgressType.CORRECTED && !UNSUPPORTED_ORDER_STATES.contains(orderState);
for (RibbonActionItem ribbonActionItem : progressRibbonGroup.getItems()) {
ribbonActionItem.setEnabled(isInCorrectionMode);
ribbonActionItem.requestUpdate(true);
}
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class GenerateBalanceViewHooks method toggleRibbonExportButtons.
private void toggleRibbonExportButtons(final ViewDefinitionState viewState) {
WindowComponent window = (WindowComponent) findComponent(viewState, QcadooViewConstants.L_WINDOW);
if (window == null) {
return;
}
Ribbon ribbon = window.getRibbon();
RibbonGroup genericExportGroup = ribbon.getGroupByName("genericExport");
if (genericExportGroup == null) {
return;
}
FormComponent form = (FormComponent) findComponent(viewState, QcadooViewConstants.L_FORM);
boolean hasGeneratedBalances = form.getEntityId() != null;
for (RibbonActionItem ribbonExportButton : genericExportGroup.getItems()) {
ribbonExportButton.setEnabled(hasGeneratedBalances);
ribbonExportButton.requestUpdate(true);
}
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class GeneratorView method from.
public static GeneratorView from(final ViewDefinitionState view) {
FormComponent form = view.<FormComponent>tryFindComponentByReference(QcadooViewConstants.L_FORM).orNull();
Preconditions.checkArgument(form != null, "Cannot find form component!");
LookupComponent technologyLookup = view.<LookupComponent>tryFindComponentByReference("technology").orNull();
Preconditions.checkArgument(technologyLookup != null, "Cannot find technology lookup component!");
TreeComponent treeComponent = (TreeComponent) view.getComponentByReference("technologiesTree");
Preconditions.checkArgument(treeComponent != null, "Cannot find technologies tree component!");
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Preconditions.checkArgument(window != null, "Cannot find window component!");
return new GeneratorView(view, window, form, technologyLookup, treeComponent);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class OperationDetailsHooks method enableRibbonItem.
private void enableRibbonItem(final ViewDefinitionState view, final boolean enable) {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonActionItem addUpTheNumberOfWorkstations = window.getRibbon().getGroupByName(L_WORKSTATIONS).getItemByName(L_ADD_UP_THE_NUMBER_OF_WORKSTATIONS);
addUpTheNumberOfWorkstations.setEnabled(enable);
addUpTheNumberOfWorkstations.requestUpdate(true);
}
use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.
the class ProductDetailsViewHooksT method updateRibbonState.
// TODO lupo fix when problem with navigation will be done
public void updateRibbonState(final ViewDefinitionState view) {
FormComponent productForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity product = productForm.getEntity();
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
RibbonGroup technologies = window.getRibbon().getGroupByName("technologies");
RibbonActionItem showTechnologiesWithTechnologyGroup = technologies.getItemByName("showTechnologiesWithTechnologyGroup");
RibbonActionItem showTechnologiesWithProduct = technologies.getItemByName("showTechnologiesWithProduct");
RibbonActionItem showProductGroupTechnologies = technologies.getItemByName("showProductGroupTechnologies");
RibbonActionItem showTechnologiesWithFamilyProduct = technologies.getItemByName("showTechnologiesWithFamilyProduct");
if (product.getId() != null) {
Entity technologyGroup = product.getBelongsToField("technologyGroup");
updateButtonState(showTechnologiesWithTechnologyGroup, technologyGroup != null);
updateButtonState(showTechnologiesWithProduct, true);
updateButtonState(showProductGroupTechnologies, true);
} else {
updateButtonState(showTechnologiesWithTechnologyGroup, false);
updateButtonState(showTechnologiesWithProduct, false);
updateButtonState(showProductGroupTechnologies, false);
}
Entity parent = product.getBelongsToField(ProductFields.PARENT);
updateButtonState(showTechnologiesWithFamilyProduct, Objects.nonNull(parent));
}
Aggregations