Search in sources :

Example 41 with GridComponent

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

the class OrdersPlanningListListenersWP method workPlanDelivered.

public final void workPlanDelivered(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    GridComponent ordersGrid = (GridComponent) state;
    workPlanService.workPlanDelivered(state, ordersGrid.getSelectedEntities());
}
Also used : GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 42 with GridComponent

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

the class WagesListsHooks method addDiscriminatorRestrictionToGrid.

public final void addDiscriminatorRestrictionToGrid(final ViewDefinitionState view) {
    GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    grid.setCustomRestriction(new CustomRestriction() {

        @Override
        public void addRestriction(final SearchCriteriaBuilder searchBuilder) {
            Entity ownerCompany = companyService.getCompany();
            searchBuilder.add(SearchRestrictions.or(SearchRestrictions.belongsTo("workFor", ownerCompany), SearchRestrictions.isNotNull("laborHourlyCost")));
        }
    });
}
Also used : Entity(com.qcadoo.model.api.Entity) SearchCriteriaBuilder(com.qcadoo.model.api.search.SearchCriteriaBuilder) GridComponent(com.qcadoo.view.api.components.GridComponent) CustomRestriction(com.qcadoo.model.api.search.CustomRestriction)

Example 43 with GridComponent

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

the class WorkPlansListView method from.

public static WorkPlansListView from(final ViewDefinitionState view) {
    WindowComponent window = (WindowComponent) view.getComponentByReference(QcadooViewConstants.L_WINDOW);
    GridComponent grid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    RibbonActionItem deleteButton = window.getRibbon().getGroupByName("actions").getItemByName("delete");
    return new WorkPlansListView(window, deleteButton, grid);
}
Also used : WindowComponent(com.qcadoo.view.api.components.WindowComponent) GridComponent(com.qcadoo.view.api.components.GridComponent) RibbonActionItem(com.qcadoo.view.api.ribbon.RibbonActionItem)

Example 44 with GridComponent

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

the class ProductService method getDefaultConversionsForGrid.

public void getDefaultConversionsForGrid(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    GridComponent productsGrid = (GridComponent) view.getComponentByReference(QcadooViewConstants.L_GRID);
    if (productsGrid.getSelectedEntities().isEmpty()) {
        return;
    }
    final List<Entity> products = productsGrid.getSelectedEntities();
    for (Entity product : products) {
        conversionForProductUnit(product);
        product.getDataDefinition().save(product);
    }
    productsGrid.addMessage("basic.productsList.message.getDefaultConversionsForProductsSuccess", MessageType.SUCCESS);
}
Also used : Entity(com.qcadoo.model.api.Entity) GridComponent(com.qcadoo.view.api.components.GridComponent)

Example 45 with GridComponent

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

the class BasicProductionCountingDetailsHooks method setFieldEditableDependsOfOrderState.

private void setFieldEditableDependsOfOrderState(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    GridComponent grid = (GridComponent) view.getComponentByReference(L_GRID);
    Long formId = form.getEntityId();
    if (formId == null) {
        return;
    }
    Entity basicProductionCounting = form.getEntity();
    if (disableGrid(orderService.getOrder(basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER).getId()))) {
        grid.setEnabled(false);
    } else {
        boolean isLocked = progressModifyLockHelper.isLocked(orderService.getOrder(basicProductionCounting.getBelongsToField(BasicProductionCountingFields.ORDER).getId()));
        grid.setEnabled(!isLocked);
    }
}
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