Search in sources :

Example 6 with Ribbon

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

the class PalletNumberDetailsHooks method disableButtonsWhenNotSaved.

public void disableButtonsWhenNotSaved(final ViewDefinitionState view) {
    FormComponent palletNumberForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup printRibbonGroup = ribbon.getGroupByName(L_PRINT);
    RibbonActionItem printPalletNumberReportRibbonActionItem = printRibbonGroup.getItemByName(L_PRINT_PALLET_NUMBER_REPORT);
    Long palletNumberId = palletNumberForm.getEntityId();
    boolean isSaved = (palletNumberId != null);
    if (printPalletNumberReportRibbonActionItem != null) {
        printPalletNumberReportRibbonActionItem.setEnabled(isSaved);
        printPalletNumberReportRibbonActionItem.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 7 with Ribbon

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

the class PalletNumbersListHooks method disableButtonsWhenNotSelected.

public void disableButtonsWhenNotSelected(final ViewDefinitionState view) {
    GridComponent palletNumbersGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup printRibbonGroup = ribbon.getGroupByName(L_PRINT);
    RibbonActionItem printPalletNumbersReportRibbonActionItem = printRibbonGroup.getItemByName(L_PRINT_PALLET_NUMBERS_REPORT);
    boolean palletNumbersAreSelected = !palletNumbersGrid.getSelectedEntities().isEmpty();
    if (printPalletNumbersReportRibbonActionItem != null) {
        printPalletNumbersReportRibbonActionItem.setEnabled(palletNumbersAreSelected);
        printPalletNumbersReportRibbonActionItem.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 8 with Ribbon

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

the class EventHooks method toggleOldSolutionsButton.

private void toggleOldSolutionsButton(ViewDefinitionState view) {
    WindowComponent windowComponent = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = windowComponent.getRibbon();
    RibbonGroup solutionsRibbonGroup = ribbon.getGroupByName("solutions");
    RibbonActionItem showSolutionsRibbonActionItem = solutionsRibbonGroup.getItemByName("showSolutions");
    FormComponent formComponent = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity event = formComponent.getPersistedEntityWithIncludedFormValues();
    showSolutionsRibbonActionItem.setEnabled(event.getId() != null);
    showSolutionsRibbonActionItem.requestUpdate(true);
}
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) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 9 with Ribbon

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

the class EventHooks method toggleRibbonButton.

private void toggleRibbonButton(final ViewDefinitionState view, String groupName, String itemName, boolean enabled) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup group = ribbon.getGroupByName(groupName);
    RibbonActionItem item = group.getItemByName(itemName);
    item.setEnabled(enabled);
    item.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)

Example 10 with Ribbon

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

the class PlannedEventDetailsHooks method actionsButtonProcess.

private void actionsButtonProcess(Entity plannedEvent, ViewDefinitionState view, FieldsForType ftype) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    PlannedEventType type = PlannedEventType.from(plannedEvent);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup actionsGroup = ribbon.getGroupByName("actionsGroup");
    RibbonActionItem addActionsItem = actionsGroup.getItemByName("actions");
    if (plannedEvent.getId() == null) {
        addActionsItem.setEnabled(false);
        addActionsItem.requestUpdate(true);
        window.requestRibbonRender();
        return;
    }
    boolean enable = false;
    if (type.compareTo(PlannedEventType.REVIEW) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.REPAIRS) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.EXTERNAL_SERVICE) == 0) {
        enable = false;
    } else if (type.compareTo(PlannedEventType.ADDITIONAL_WORK) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.MANUAL) == 0) {
        enable = true;
    } else if (type.compareTo(PlannedEventType.METER_READING) == 0) {
        enable = false;
    } else if (type.compareTo(PlannedEventType.UDT_REVIEW) == 0) {
        enable = false;
    } else if (type.compareTo(PlannedEventType.AFTER_REVIEW) == 0) {
        enable = false;
    }
    addActionsItem.setEnabled(enable);
    addActionsItem.requestUpdate(true);
    window.requestRibbonRender();
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) Ribbon(com.qcadoo.view.api.ribbon.Ribbon) PlannedEventType(com.qcadoo.mes.cmmsMachineParts.constants.PlannedEventType) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

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