Search in sources :

Example 1 with Ribbon

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) GridComponent(com.qcadoo.view.api.components.GridComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 2 with Ribbon

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);
        }
    }
}
Also used : Entity(com.qcadoo.model.api.Entity) RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) JSONObject(org.json.JSONObject) WindowComponent(com.qcadoo.view.api.components.WindowComponent) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 3 with Ribbon

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) Ribbon(com.qcadoo.view.api.ribbon.Ribbon)

Example 4 with Ribbon

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);
    }
}
Also used : RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem) DataDefinitionService(com.qcadoo.model.api.DataDefinitionService) Arrays(java.util.Arrays) TechnologyState(com.qcadoo.mes.technologies.states.constants.TechnologyState) QcadooViewConstants(com.qcadoo.view.constants.QcadooViewConstants) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) Autowired(org.springframework.beans.factory.annotation.Autowired) DataDefinition(com.qcadoo.model.api.DataDefinition) FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) com.qcadoo.mes.technologies.constants(com.qcadoo.mes.technologies.constants) Entity(com.qcadoo.model.api.Entity) ViewDefinitionState(com.qcadoo.view.api.ViewDefinitionState) com.qcadoo.view.api.components(com.qcadoo.view.api.components) List(java.util.List) Lists(com.google.common.collect.Lists) Service(org.springframework.stereotype.Service) Entity(com.qcadoo.model.api.Entity) Ribbon(com.qcadoo.view.api.ribbon.Ribbon)

Example 5 with Ribbon

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);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) Ribbon(com.qcadoo.view.api.ribbon.Ribbon)

Aggregations

Ribbon (com.qcadoo.view.api.ribbon.Ribbon)40 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)37 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)36 WindowComponent (com.qcadoo.view.api.components.WindowComponent)31 FormComponent (com.qcadoo.view.api.components.FormComponent)16 Entity (com.qcadoo.model.api.Entity)10 GridComponent (com.qcadoo.view.api.components.GridComponent)8 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)4 QcadooViewConstants (com.qcadoo.view.constants.QcadooViewConstants)3 Optional (com.google.common.base.Optional)2 Lists (com.google.common.collect.Lists)2 AssignmentToShiftState (com.qcadoo.mes.assignmentToShift.states.constants.AssignmentToShiftState)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)2 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)2 FieldComponent (com.qcadoo.view.api.components.FieldComponent)2 BigDecimal (java.math.BigDecimal)2 Arrays (java.util.Arrays)2 Service (org.springframework.stereotype.Service)2 HashMultimap (com.google.common.collect.HashMultimap)1