Search in sources :

Example 66 with WindowComponent

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

Example 67 with WindowComponent

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

Example 68 with WindowComponent

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);
}
Also used : TreeComponent(com.qcadoo.view.api.components.TreeComponent) FormComponent(com.qcadoo.view.api.components.FormComponent) LookupComponent(com.qcadoo.view.api.components.LookupComponent) WindowComponent(com.qcadoo.view.api.components.WindowComponent)

Example 69 with WindowComponent

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

Example 70 with WindowComponent

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

Aggregations

WindowComponent (com.qcadoo.view.api.components.WindowComponent)105 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)93 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)75 FormComponent (com.qcadoo.view.api.components.FormComponent)51 Entity (com.qcadoo.model.api.Entity)46 Ribbon (com.qcadoo.view.api.ribbon.Ribbon)31 GridComponent (com.qcadoo.view.api.components.GridComponent)28 FieldComponent (com.qcadoo.view.api.components.FieldComponent)12 LookupComponent (com.qcadoo.view.api.components.LookupComponent)8 EntityTree (com.qcadoo.model.api.EntityTree)4 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)3 JSONObject (org.json.JSONObject)3 Optional (com.google.common.base.Optional)2 AssignmentToShiftState (com.qcadoo.mes.assignmentToShift.states.constants.AssignmentToShiftState)2 DataDefinition (com.qcadoo.model.api.DataDefinition)2 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)2 TreeComponent (com.qcadoo.view.api.components.TreeComponent)2 Date (java.util.Date)2 HashMultimap (com.google.common.collect.HashMultimap)1 Lists (com.google.common.collect.Lists)1