Search in sources :

Example 16 with WindowComponent

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

the class ProductDetailsHooks method updateRibbonState.

public void updateRibbonState(final ViewDefinitionState view) {
    FormComponent operationGroupForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup operationGroups = window.getRibbon().getGroupByName(L_CONVERSIONS);
    RibbonActionItem getDefaultConversions = operationGroups.getItemByName(L_GET_DEFAULT_CONVERSIONS);
    Entity operationGroup = operationGroupForm.getEntity();
    updateButtonState(getDefaultConversions, Objects.nonNull(operationGroup.getId()));
}
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 17 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent 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 18 with WindowComponent

use of com.qcadoo.view.api.components.WindowComponent 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 19 with WindowComponent

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

the class FaultTypeDetailsHooks method disableActionsWhenDefault.

public void disableActionsWhenDefault(final ViewDefinitionState view) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup actions = window.getRibbon().getGroupByName("actions");
    for (RibbonActionItem item : actions.getItems()) {
        item.setEnabled(false);
        item.requestUpdate(true);
    }
    GridComponent workstationsGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.WORKSTATIONS);
    GridComponent subassembliesGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.SUBASSEMBLIES);
    GridComponent workstationTypesGrid = (GridComponent) view.getComponentByReference(FaultTypeFields.WORKSTATION_TYPES);
    workstationsGrid.setEnabled(false);
    subassembliesGrid.setEnabled(false);
    workstationTypesGrid.setEnabled(false);
    FieldComponent nameField = (FieldComponent) view.getComponentByReference(FaultTypeFields.NAME);
    FieldComponent appliesToField = (FieldComponent) view.getComponentByReference(FaultTypeFields.APPLIES_TO);
    nameField.setEnabled(false);
    appliesToField.setEnabled(false);
}
Also used : RibbonGroup(com.qcadoo.view.api.ribbon.RibbonGroup) WindowComponent(com.qcadoo.view.api.components.WindowComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 20 with WindowComponent

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

the class FaultTypeListHooks method disableActionsWhenDefault.

private void disableActionsWhenDefault(final ViewDefinitionState view) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonGroup actions = window.getRibbon().getGroupByName("actions");
    RibbonActionItem copyButton = actions.getItemByName("copy");
    RibbonActionItem deleteButton = actions.getItemByName("delete");
    GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    List<Entity> selectedFaults = grid.getSelectedEntities();
    for (Entity selectedFault : selectedFaults) {
        if (selectedFault.getBooleanField("isDefault")) {
            copyButton.setEnabled(false);
            deleteButton.setEnabled(false);
            copyButton.requestUpdate(true);
            deleteButton.requestUpdate(true);
            return;
        }
    }
    boolean enabled = !selectedFaults.isEmpty();
    copyButton.setEnabled(enabled);
    deleteButton.setEnabled(enabled);
    copyButton.requestUpdate(true);
    deleteButton.requestUpdate(true);
}
Also used : Entity(com.qcadoo.model.api.Entity) 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)

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