use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class SalesPlanDetailsListeners method fillTechnology.
public void fillTechnology(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent productsGrid = (GridComponent) view.getComponentByReference(SalesPlanFields.PRODUCTS);
Map<String, Object> parameters = Maps.newHashMap();
parameters.put("productFamilyId", dataDefinitionService.get(MasterOrdersConstants.PLUGIN_IDENTIFIER, MasterOrdersConstants.MODEL_SALES_PLAN_PRODUCT).get(productsGrid.getSelectedEntities().stream().findFirst().get().getId()).getBelongsToField(SalesPlanProductFields.PRODUCT).getBelongsToField(ProductFields.PARENT).getId());
parameters.put("salesPlanProductsIds", productsGrid.getSelectedEntitiesIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
String url = "../page/masterOrders/salesPlanFillTechnology.html";
view.openModal(url, parameters);
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class ProductsListListenersMO method generateOrders.
public final void generateOrders(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
Set<Long> selectedEntities = grid.getSelectedEntitiesIds();
final Map<String, Object> parameters = new HashMap<>();
parameters.put("selectedEntities", selectedEntities);
JSONObject context = new JSONObject(parameters);
StringBuilder url = new StringBuilder("../page/masterOrders/ordersGenerationFromProducts.html");
url.append("?context=");
url.append(context.toString());
view.openModal(url.toString());
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class SalesPlanMaterialRequirementDetailsListeners method showTechnologiesWithUsingProduct.
public final void showTechnologiesWithUsingProduct(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent salesPlanMaterialRequirementProductsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
Entity product = salesPlanMaterialRequirementProductsGrid.getSelectedEntities().get(0).getBelongsToField(SalesPlanMaterialRequirementProductFields.PRODUCT);
Map<String, Object> parameters = Maps.newHashMap();
parameters.put("form.id", product.getId());
String url = "../page/technologies/technologiesWithUsingProductList.html";
view.redirectTo(url, false, true, parameters);
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class SalesPlanDetailsListeners method showOrderedProductsForFamily.
public void showOrderedProductsForFamily(final ViewDefinitionState view, final ComponentState state, final String[] args) {
GridComponent productsGrid = (GridComponent) view.getComponentByReference(SalesPlanFields.PRODUCTS);
Map<String, Object> parameters = Maps.newHashMap();
parameters.put("form.id", productsGrid.getSelectedEntitiesIds().stream().findFirst().get());
String url = "../page/masterOrders/orderedProductsForFamily.html";
view.openModal(url, parameters);
}
use of com.qcadoo.view.api.components.GridComponent in project mes by qcadoo.
the class CostNormsGeneratorListeners method toggleProductsGrid.
public void toggleProductsGrid(final ViewDefinitionState view, final ComponentState state, final String[] args) {
FormComponent costNormsGeneratorForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
GridComponent productsGrid = (GridComponent) view.getComponentByReference(CostNormsGeneratorFields.PRODUCTS);
Entity costNormsGenerator = costNormsGeneratorForm.getPersistedEntityWithIncludedFormValues();
boolean gridVisible = ProductsToUpdate.of(costNormsGenerator).compareTo(ProductsToUpdate.SELECTED) == 0;
productsGrid.setVisible(gridVisible);
if (!gridVisible) {
costNormsGenerator.setField(CostNormsGeneratorFields.PRODUCTS, null);
costNormsGeneratorForm.setEntity(costNormsGenerator);
}
}
Aggregations