Search in sources :

Example 16 with FilterValueHolder

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

the class StoppageForOrderFormHooks method onBeforeRender.

public final void onBeforeRender(final ViewDefinitionState view) throws JSONException {
    LookupComponent orderLookupComponent = (LookupComponent) view.getComponentByReference(L_ORDER);
    orderLookupComponent.setEnabled(false);
    if (Objects.isNull(((FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM)).getEntityId())) {
        JSONObject context = view.getJsonContext();
        if (view.isViewAfterRedirect() && context.has(L_CONTEXT_KEY_ORDER)) {
            Long orderId = context.getLong(L_CONTEXT_KEY_ORDER);
            orderLookupComponent.setFieldValue(orderId);
            orderLookupComponent.requestComponentUpdateState();
            LookupComponent productionTrackingComponent = (LookupComponent) view.getComponentByReference(L_PRODUCTION_TRACKING);
            FilterValueHolder holder = productionTrackingComponent.getFilterValue();
            holder.put(StoppageFields.ORDER, orderId);
            productionTrackingComponent.setFilterValue(holder);
        }
    } else {
        LookupComponent productionTrackingComponent = (LookupComponent) view.getComponentByReference(L_PRODUCTION_TRACKING);
        Entity order = orderLookupComponent.getEntity();
        if (order != null) {
            FilterValueHolder holder = productionTrackingComponent.getFilterValue();
            holder.put(StoppageFields.ORDER, order.getId());
            productionTrackingComponent.setFilterValue(holder);
        }
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) JSONObject(org.json.JSONObject) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 17 with FilterValueHolder

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

the class AllStoppagesFormListeners method changeOrder.

public void changeOrder(final ViewDefinitionState view, final ComponentState state, final String[] args) {
    LookupComponent orderLookup = (LookupComponent) view.getComponentByReference(StoppageFields.ORDER);
    LookupComponent productionTrackingLookup = (LookupComponent) view.getComponentByReference(StoppageFields.PRODUCTION_TRACKING);
    Entity order = orderLookup.getEntity();
    if (order != null) {
        FilterValueHolder holder = productionTrackingLookup.getFilterValue();
        holder.put(StoppageFields.ORDER, order.getId());
        productionTrackingLookup.setFilterValue(holder);
    }
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 18 with FilterValueHolder

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

the class SkillOperationDetailsHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    FormComponent form = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    Entity opSkill = form.getEntity();
    FieldComponent maxSkillLevelField = (FieldComponent) view.getComponentByReference(MAX_LEVEL);
    maxSkillLevelField.setFieldValue(opSkill.getBelongsToField(OperationSkillFields.SKILL).getIntegerField(SkillFields.MAXIMUM_LEVEL));
    LookupComponent operationLookup = (LookupComponent) view.getComponentByReference(OperationSkillFields.OPERATION);
    FilterValueHolder filterValueHolder = operationLookup.getFilterValue();
    Long skillId = opSkill.getBelongsToField(StaffSkillsFields.SKILL).getId();
    if (Objects.isNull(skillId)) {
        filterValueHolder.remove(L_SKILL_ID);
    } else {
        filterValueHolder.put(L_SKILL_ID, skillId);
    }
    operationLookup.setFilterValue(filterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) LookupComponent(com.qcadoo.view.api.components.LookupComponent) FieldComponent(com.qcadoo.view.api.components.FieldComponent)

Example 19 with FilterValueHolder

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

the class TOCProcessListDetailsHooks method onBeforeRender.

public void onBeforeRender(final ViewDefinitionState view) {
    Long operationId = ((FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM)).getPersistedEntityWithIncludedFormValues().getBelongsToField(TechnologyOperationComponentFields.OPERATION).getId();
    LookupComponent technologicalProcessList = (LookupComponent) view.getComponentByReference(TechnologyOperationComponentFields.TECHNOLOGICAL_PROCESS_LIST);
    FilterValueHolder filterValueHolder = technologicalProcessList.getFilterValue();
    filterValueHolder.put(TechnologicalProcessListFields.OPERATION, operationId);
    technologicalProcessList.setFilterValue(filterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder) FormComponent(com.qcadoo.view.api.components.FormComponent) LookupComponent(com.qcadoo.view.api.components.LookupComponent)

Example 20 with FilterValueHolder

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

the class TechOperCompWorkstationTimeDetailsHooks method filterWorkstationLookup.

private void filterWorkstationLookup(final LookupComponent workstationLookup, final Entity technologyOperationComponent, Entity workstation) {
    FilterValueHolder filterValueHolder = workstationLookup.getFilterValue();
    Long technologyOperationComponentId = technologyOperationComponent.getId();
    filterValueHolder.put(WorkstationCriteriaModifiersTNFO.TECHNOLOGY_OPERATION_COMPONENT_ID, technologyOperationComponentId);
    if (Objects.isNull(workstation)) {
        filterValueHolder.remove(WorkstationCriteriaModifiersTNFO.L_WORKSTATION_ID);
    } else {
        filterValueHolder.put(WorkstationCriteriaModifiersTNFO.L_WORKSTATION_ID, workstation.getId());
    }
    workstationLookup.setFilterValue(filterValueHolder);
}
Also used : FilterValueHolder(com.qcadoo.view.api.components.lookup.FilterValueHolder)

Aggregations

FilterValueHolder (com.qcadoo.view.api.components.lookup.FilterValueHolder)119 LookupComponent (com.qcadoo.view.api.components.LookupComponent)69 Entity (com.qcadoo.model.api.Entity)64 FormComponent (com.qcadoo.view.api.components.FormComponent)45 GridComponent (com.qcadoo.view.api.components.GridComponent)26 FieldComponent (com.qcadoo.view.api.components.FieldComponent)13 Collectors (java.util.stream.Collectors)11 Autowired (org.springframework.beans.factory.annotation.Autowired)11 Service (org.springframework.stereotype.Service)11 DataDefinitionService (com.qcadoo.model.api.DataDefinitionService)10 SearchCriteriaBuilder (com.qcadoo.model.api.search.SearchCriteriaBuilder)10 SearchRestrictions (com.qcadoo.model.api.search.SearchRestrictions)10 Objects (java.util.Objects)10 DataDefinition (com.qcadoo.model.api.DataDefinition)9 JSONObject (org.json.JSONObject)9 UserFieldsMF (com.qcadoo.mes.materialFlow.constants.UserFieldsMF)8 UserLocationFields (com.qcadoo.mes.materialFlow.constants.UserLocationFields)8 EntityList (com.qcadoo.model.api.EntityList)8 SecurityService (com.qcadoo.security.api.SecurityService)8 QcadooSecurityConstants (com.qcadoo.security.constants.QcadooSecurityConstants)8