Search in sources :

Example 6 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class AnomalyProductionTrackingDetailsHooks method updateRibbon.

private void updateRibbon(final ViewDefinitionState view) {
    try {
        WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
        RibbonGroup actions = window.getRibbon().getGroupByName(L_ACTIONS);
        RibbonActionItem perform = actions.getItemByName("perform");
        RibbonActionItem performAndAccept = actions.getItemByName("performAndAccept");
        boolean performAndAcceptFlag = view.getJsonContext().getBoolean("window.mainTab.form.performAndAccept");
        perform.setEnabled(!performAndAcceptFlag);
        performAndAccept.setEnabled(performAndAcceptFlag);
        perform.requestUpdate(true);
        performAndAccept.requestUpdate(true);
    } catch (JSONException e) {
    }
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) JSONException(org.json.JSONException) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 7 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup 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 8 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class GeneratorView method setActionsGroupButtonEnabled.

public void setActionsGroupButtonEnabled(boolean enabled, boolean msg, String itemName) {
    RibbonGroup actions = (RibbonGroup) window.getRibbon().getGroupByName("actions");
    RibbonActionItem saveButton = actions.getItemByName(itemName);
    saveButton.setEnabled(enabled);
    saveButton.requestUpdate(true);
    if (!enabled && msg) {
        saveButton.setMessage("technologiesGenerator.generateTechnologyInProgress");
    }
    window.requestRibbonRender();
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 9 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup 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 10 with RibbonGroup

use of com.qcadoo.view.api.ribbon.RibbonGroup in project mes by qcadoo.

the class TechnologyReferenceTechnologyComponentDetailsHooks method disabledSaveBackButton.

public void disabledSaveBackButton(final ViewDefinitionState viewDefinitionState) {
    WindowComponent window = (WindowComponent) viewDefinitionState.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup actionsGroup = (RibbonGroup) window.getRibbon().getGroupByName("actions");
    RibbonActionItem saveBack = (RibbonActionItem) actionsGroup.getItemByName("saveBack");
    LookupComponent technology = (LookupComponent) viewDefinitionState.getComponentByReference("technology");
    if (technology.getEntity() == null) {
        saveBack.setEnabled(false);
    } else {
        saveBack.setEnabled(true);
    }
    saveBack.requestUpdate(true);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) LookupComponent(com.qcadoo.view.api.components.LookupComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Aggregations

RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)92 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)86 WindowComponent (com.qcadoo.view.api.components.WindowComponent)75 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)37 FormComponent (com.qcadoo.view.api.components.FormComponent)36 Entity (com.qcadoo.model.api.Entity)34 GridComponent (com.qcadoo.view.api.components.GridComponent)23 FieldComponent (com.qcadoo.view.api.components.FieldComponent)9 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)3 LookupComponent (com.qcadoo.view.api.components.LookupComponent)3 JSONObject (org.json.JSONObject)3 AssignmentToShiftState (com.qcadoo.mes.assignmentToShift.states.constants.AssignmentToShiftState)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)2 QcadooViewConstants (com.qcadoo.view.constants.QcadooViewConstants)2 Optional (com.google.common.base.Optional)1 HashMultimap (com.google.common.collect.HashMultimap)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Multimap (com.google.common.collect.Multimap)1