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