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);
}
}
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");
}
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);
}
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();
}
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);
}
Aggregations