Search in sources :

Example 91 with GridComponent

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);
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent) JSONObject(org.json.JSONObject)

Example 92 with GridComponent

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());
}
Also used : JSONObject(org.json.JSONObject) HashMap(java.util.HashMap) GridComponent(com.qcadoo.view.api.components.GridComponent) JSONObject(org.json.JSONObject)

Example 93 with GridComponent

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);
}
Also used : Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 94 with GridComponent

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);
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent) JSONObject(org.json.JSONObject)

Example 95 with GridComponent

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);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Aggregations

GridComponent (com.qcadoo.view.api.components.GridComponent)260 Entity (com.qcadoo.model.api.Entity)131 FormComponent (com.qcadoo.view.api.components.FormComponent)85 FieldComponent (com.qcadoo.view.api.components.FieldComponent)33 WindowComponent (com.qcadoo.view.api.components.WindowComponent)30 RibbonActionItem (com.qcadoo.view.api.ribbon.RibbonActionItem)29 JSONObject (org.json.JSONObject)28 FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)26 RibbonGroup (com.qcadoo.view.api.ribbon.RibbonGroup)24 ComponentState (com.qcadoo.view.api.ComponentState)23 DataDefinition (com.qcadoo.model.api.DataDefinition)22 ViewDefinitionState (com.qcadoo.view.api.ViewDefinitionState)22 QcadooViewConstants (com.qcadoo.view.constants.QcadooViewConstants)20 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)19 Autowired (org.springframework.beans.factory.annotation.Autowired)19 BigDecimal (java.math.BigDecimal)16 Service (org.springframework.stereotype.Service)16 LookupComponent (com.qcadoo.view.api.components.LookupComponent)15 Collectors (java.util.stream.Collectors)15 Lists (com.google.common.collect.Lists)12