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