Search in sources :

Example 76 with GridComponent

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

the class DeliveriesListHooks method fillGridWithRelatedDeliveries.

public void fillGridWithRelatedDeliveries(final ViewDefinitionState view) {
    GridComponent deliveriesGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    FormComponent deliveryForm = (FormComponent) view.getComponentByReference(L_DELIVERY);
    Long deliveryId = deliveryForm.getEntityId();
    if (deliveryId == null) {
        return;
    }
    Entity delivery = deliveriesService.getDelivery(deliveryId);
    deliveriesGrid.setEntities(getRelatedDeliveries(delivery));
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 77 with GridComponent

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

the class DeliveryDetailsHooks method changeFieldsEnabled.

private void changeFieldsEnabled(final ViewDefinitionState view, final boolean enabledForm, final boolean enabledOrderedGrid, final boolean enabledDeliveredGrid) {
    FormComponent deliveryForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    GridComponent orderedProducts = (GridComponent) view.getComponentByReference(DeliveryFields.ORDERED_PRODUCTS);
    GridComponent deliveredProducts = (GridComponent) view.getComponentByReference(DeliveryFields.DELIVERED_PRODUCTS);
    deliveryForm.setFormEnabled(enabledForm);
    orderedProducts.setEnabled(enabledOrderedGrid);
    deliveredProducts.setEnabled(enabledDeliveredGrid);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 78 with GridComponent

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

the class DeliveryDetailsHooks method filterStateChangeHistory.

private void filterStateChangeHistory(final ViewDefinitionState view) {
    final GridComponent historyGrid = (GridComponent) view.getComponentByReference(L_LOGGINGS_GRID);
    final CustomRestriction onlySuccessfulRestriction = stateChangeHistoryService.buildStatusRestriction(DeliveryStateChangeFields.STATUS, Lists.newArrayList(StateChangeStatus.SUCCESSFUL.getStringValue()));
    historyGrid.setCustomRestriction(onlySuccessfulRestriction);
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent) CustomRestriction(com.qcadoo.model.api.search.CustomRestriction)

Example 79 with GridComponent

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

the class ProductDetailsHooksD method toggleSuppliersGrids.

public void toggleSuppliersGrids(final ViewDefinitionState view) {
    FormComponent productForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity product = productForm.getPersistedEntityWithIncludedFormValues();
    GridComponent productCompanies = (GridComponent) view.getComponentByReference(ProductFieldsD.PRODUCT_COMPANIES);
    GridComponent productsFamilyCompanies = (GridComponent) view.getComponentByReference(ProductFieldsD.PRODUCTS_FAMILY_COMPANIES);
    if (ProductFamilyElementType.from(product).equals(ProductFamilyElementType.PARTICULAR_PRODUCT)) {
        productCompanies.setVisible(true);
        productsFamilyCompanies.setVisible(false);
    } else {
        productCompanies.setVisible(false);
        productsFamilyCompanies.setVisible(true);
    }
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 80 with GridComponent

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

the class DeliveredProductDetailsHooks method disableReservationsForWaste.

private void disableReservationsForWaste(final ViewDefinitionState view) {
    FormComponent deliveredProductForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    GridComponent reservationsGrid = (GridComponent) view.getComponentByReference(L_DELIVERED_PRODUCT_RESERVATIONS);
    Entity deliveredProduct = deliveredProductForm.getEntity();
    boolean isWaste = !deliveredProduct.getBooleanField(DeliveredProductFields.IS_WASTE);
    reservationsGrid.setEnabled(isWaste);
}
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