Search in sources :

Example 51 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class PalletNumberHelperDetailsHooks method disableButtonsWhenNotSaved.

private void disableButtonsWhenNotSaved(final ViewDefinitionState view) {
    FormComponent palletNumberHelperForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup actionsRibbonGroup = ribbon.getGroupByName(L_ACTIONS);
    RibbonGroup printRibbonGroup = ribbon.getGroupByName(L_PRINT);
    RibbonActionItem saveRibbonActionItem = actionsRibbonGroup.getItemByName(L_SAVE);
    RibbonActionItem printPalletNumberReportHelperRibbonActionItem = printRibbonGroup.getItemByName(L_PRINT_PALLET_NUMBER_HELPER_REPORT);
    Long palletNumberHelperId = palletNumberHelperForm.getEntityId();
    boolean isEnabled = (palletNumberHelperId != null);
    if (saveRibbonActionItem != null) {
        saveRibbonActionItem.setEnabled(!isEnabled);
        saveRibbonActionItem.requestUpdate(true);
    }
    if (printPalletNumberReportHelperRibbonActionItem != null) {
        printPalletNumberReportHelperRibbonActionItem.setEnabled(isEnabled);
        printPalletNumberReportHelperRibbonActionItem.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 52 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class ParametersHooks method changeButtonsState.

private void changeButtonsState(final ViewDefinitionState view, final boolean enabled) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup company = ribbon.getGroupByName(L_COMPANY);
    RibbonActionItem redirectToCompany = company.getItemByName(L_REDIRECT_TO_COMPANY);
    redirectToCompany.setEnabled(enabled);
    redirectToCompany.requestUpdate(true);
    window.requestRibbonRender();
}
Also used : 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 53 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class StaffsListHooks method updateRibbonState.

public void updateRibbonState(final ViewDefinitionState view) {
    GridComponent staffsGrid = (GridComponent) view.getComponentByReference(L_GRID);
    WindowComponent window = (WindowComponent) view.getComponentByReference(L_WINDOW);
    RibbonGroup labels = window.getRibbon().getGroupByName(L_LABELS);
    RibbonActionItem printStaffLabels = labels.getItemByName(L_PRINT_STAFF_LABELS);
    boolean isEnabled = !staffsGrid.getSelectedEntities().isEmpty();
    printStaffLabels.setEnabled(isEnabled);
    printStaffLabels.requestUpdate(true);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 54 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class ProductDetailsHooks method updateProductFamilySizesRibbonState.

public void updateProductFamilySizesRibbonState(final ViewDefinitionState view) {
    FormComponent productForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup productFamily = window.getRibbon().getGroupByName(L_PRODUCT_FAMILY);
    RibbonActionItem productFamilySizes = productFamily.getItemByName(L_PRODUCT_FAMILY_SIZES);
    Entity product = productForm.getEntity();
    updateButtonState(productFamilySizes, ProductFamilyElementType.PRODUCTS_FAMILY.getStringValue().equals(product.getField(ProductFields.ENTITY_TYPE)));
}
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)

Example 55 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent in project mes by qcadoo.

the class ImportService method changeButtonsState.

public void changeButtonsState(final ViewDefinitionState view, final boolean isEnabled) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup importRibbonGroup = ribbon.getGroupByName(L_IMPORT);
    RibbonActionItem redirectToLogsRibbonActionItem = importRibbonGroup.getItemByName(L_REDIRECT_TO_LOGS);
    redirectToLogsRibbonActionItem.setEnabled(isEnabled);
    redirectToLogsRibbonActionItem.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) 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