use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class ProductionTrackingsForProductGroupedListHooks method updateButtonsState.
public void updateButtonsState(final ViewDefinitionState view) {
GridComponent productionTrackingsForProductGroupedGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup showProductionTrackingsRibbonGroup = ribbon.getGroupByName(L_SHOW_PRODUCTION_TRACKINGS);
RibbonActionItem showProductionTrackingsForProductRibbonActionItem = showProductionTrackingsRibbonGroup.getItemByName(L_SHOW_PRODUCTION_TRACKINGS_FOR_PRODUCT);
boolean isSelected = !productionTrackingsForProductGroupedGrid.getSelectedEntities().isEmpty();
showProductionTrackingsForProductRibbonActionItem.setEnabled(isSelected);
showProductionTrackingsForProductRibbonActionItem.requestUpdate(true);
}
use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class StoppageForOrderFormHooks method onRibbonBeforeRender.
public final void onRibbonBeforeRender(final ViewDefinitionState view) throws JSONException {
WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = window.getRibbon();
RibbonGroup actionsRibbonGroup = ribbon.getGroupByName("actions");
RibbonActionItem addNew = actionsRibbonGroup.getItemByName("new");
RibbonActionItem copy = actionsRibbonGroup.getItemByName("copy");
JSONObject context = view.getJsonContext();
if (context.has("window.mainTab.stoppage.forOrder")) {
Entity order = dataDefinitionService.get(OrdersConstants.PLUGIN_IDENTIFIER, OrdersConstants.MODEL_ORDER).get(context.getLong("window.mainTab.stoppage.forOrder"));
if (OrderState.DECLINED.getStringValue().equals(order.getStringField(OrderFields.STATE))) {
addNew.setEnabled(false);
addNew.requestUpdate(true);
copy.setEnabled(false);
copy.requestUpdate(true);
}
}
}
use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class GeneratorView method getRibbonItemByName.
private RibbonActionItem getRibbonItemByName(String itemName) {
Ribbon ribbon = window.getRibbon();
RibbonGroup generateGroup = ribbon.getGroupByName("generate");
return generateGroup.getItemByName(itemName);
}
use of com.qcadoo.view.api.ribbon.Ribbon in project mes by qcadoo.
the class TOCDetailsHooks method disableViewForState.
private void disableViewForState(final ViewDefinitionState view) {
FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
Entity toc = form.getEntity();
if (toc.getId() == null) {
return;
}
toc = getTechnologyOperationComponentDD().get(toc.getId());
Entity technology = toc.getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
if (!TechnologyState.DRAFT.getStringValue().equals(technology.getStringField(TechnologyFields.STATE))) {
WindowComponent windowComponent = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
Ribbon ribbon = windowComponent.getRibbon();
ribbon.getGroups().stream().filter(group -> !group.getName().equals(L_NAVIGATION)).forEach(group -> group.getItems().forEach(item -> {
item.setEnabled(false);
item.requestUpdate(true);
}));
form.setFormEnabled(false);
}
}
use of com.qcadoo.view.api.ribbon.Ribbon 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);
}
Aggregations