Search in sources :

Example 76 with WindowComponent

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

the class DetailedProductionCountingAndProgressListHooksBPC method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    String releaseOfMaterials = parameterService.getParameter().getStringField(ParameterFieldsPC.RELEASE_OF_MATERIALS);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    Ribbon ribbon = window.getRibbon();
    RibbonGroup issueRibbonGroup = ribbon.getGroupByName(L_ISSUE);
    RibbonActionItem resourceIssueRibbonActionItem = issueRibbonGroup.getItemByName(L_RESOURCE_ISSUE);
    if (!ReleaseOfMaterials.MANUALLY_TO_ORDER_OR_GROUP.getStringValue().equals(releaseOfMaterials)) {
        resourceIssueRibbonActionItem.setEnabled(false);
        resourceIssueRibbonActionItem.setMessage("basicProductionCounting.detailedProductionCountingAndProgressList.resourceIssue.description");
        resourceIssueRibbonActionItem.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 77 with WindowComponent

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

the class ProductionLineDetailsListeners method generateFactoryStructure.

public void generateFactoryStructure(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity productionLine = form.getEntity();
    EntityTree structure = factoryStructureGenerationService.generateFactoryStructureForProductionLine(productionLine);
    productionLine.setField(WorkstationFieldsPL.FACTORY_STRUCTURE, structure);
    form.setEntity(productionLine);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    window.setActiveTab("factoryStructureTab");
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) WindowComponent(com.qcadoo.view.api.components.WindowComponent) EntityTree(com.qcadoo.model.api.EntityTree)

Example 78 with WindowComponent

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

the class TechnologiesListHooksTNFO method toggleCopyTimeNormsFromOperationForTechnologiesButton.

public void toggleCopyTimeNormsFromOperationForTechnologiesButton(final ViewDefinitionState view) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonActionItem copyTimeNormsFromOperationForTechnologies = window.getRibbon().getGroupByName("norm").getItemByName("copyTimeNormsFromOperationForTechnologies");
    GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    copyTimeNormsFromOperationForTechnologies.setEnabled(!grid.getSelectedEntities().isEmpty() && grid.getSelectedEntities().stream().allMatch(e -> e.getStringField(TechnologyFields.STATE).equals(TechnologyState.DRAFT.getStringValue())));
    copyTimeNormsFromOperationForTechnologies.requestUpdate(true);
}
Also used : WindowComponent(com.qcadoo.view.api.components.WindowComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 79 with WindowComponent

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

the class WarehouseMinimumStateAddMulti method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    LookupComponent location = (LookupComponent) view.getComponentByReference("location");
    location.setRequired(true);
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    RibbonActionItem addMultiButton = window.getRibbon().getGroupByName("action").getItemByName("createMultiMinimalStates");
    addMultiButton.setMessage("warehouseMinimalState.warehouseMinimumStateAddMulti.createMultiMinimalStates.button.message");
    addMultiButton.requestUpdate(true);
    window.requestRibbonRender();
}
Also used : LookupComponent(com.qcadoo.view.api.components.LookupComponent) WindowComponent(com.qcadoo.view.api.components.WindowComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 80 with WindowComponent

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

the class ActionListHooks 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