use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ProductAttributeValueDetailsHooks method setValueBold.
private void setValueBold(ViewDefinitionState view) {
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProductAttributeValueFields.ATTRIBUTE_VALUE);
attributeValueLookup.setRequired(true);
attributeValueLookup.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class BaseAttributeValueDetailsHooks method setFilters.
private void setFilters(ViewDefinitionState view) {
LookupComponent attributeLookup = (LookupComponent) view.getComponentByReference(ATTRIBUTE);
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ATTRIBUTE_VALUE);
FilterValueHolder attributeValueLookupFilters = attributeValueLookup.getFilterValue();
if (Objects.nonNull(attributeLookup.getEntity())) {
attributeValueLookupFilters.put(L_ATTRIBUTE_ID, attributeLookup.getEntity().getId());
} else if (attributeValueLookupFilters.has(L_ATTRIBUTE_ID)) {
attributeValueLookupFilters.remove(L_ATTRIBUTE_ID);
}
attributeValueLookup.setFilterValue(attributeValueLookupFilters);
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class CompanyDetailsHooks method fillDefaultCountry.
public void fillDefaultCountry(final ViewDefinitionState view) {
FormComponent companyForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
if (companyForm.getEntityId() != null) {
return;
}
CheckBoxComponent isSetFieldsFromParameter = (CheckBoxComponent) view.getComponentByReference(CompanyFields.IS_SET_FIELDS_FROM_PARAMETER);
if (isSetFieldsFromParameter.isChecked()) {
return;
}
LookupComponent countryField = (LookupComponent) view.getComponentByReference(CompanyFields.COUNTRY);
LookupComponent taxCountryField = (LookupComponent) view.getComponentByReference(CompanyFields.TAX_COUNTRY_CODE);
Entity defaultCountry = parameterService.getParameter().getBelongsToField(CompanyFields.COUNTRY);
if (defaultCountry != null) {
countryField.setFieldValue(defaultCountry.getId());
taxCountryField.setFieldValue(defaultCountry.getId());
taxCountryField.requestComponentUpdateState();
countryField.requestComponentUpdateState();
}
isSetFieldsFromParameter.setFieldValue(true);
isSetFieldsFromParameter.requestComponentUpdateState();
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ModelDetailsHooks method fillCriteriaModifiers.
private void fillCriteriaModifiers(final ViewDefinitionState view) {
FormComponent modelForm = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
LookupComponent assortmentLookup = (LookupComponent) view.getComponentByReference(ModelFields.ASSORTMENT);
LookupComponent productLookup = (LookupComponent) view.getComponentByReference("productLookup");
Long modelId = modelForm.getEntityId();
Entity assortment = assortmentLookup.getEntity();
FilterValueHolder filterValueHolder = productLookup.getFilterValue();
if (Objects.nonNull(modelId)) {
filterValueHolder.put(ProductCriteriaModifiers.L_MODEL_ID, modelId);
}
if (Objects.isNull(assortment)) {
if (filterValueHolder.has(ProductCriteriaModifiers.L_ASSORTMENT_ID)) {
filterValueHolder.remove(ProductCriteriaModifiers.L_ASSORTMENT_ID);
}
} else {
filterValueHolder.put(ProductCriteriaModifiers.L_ASSORTMENT_ID, assortment.getId());
}
productLookup.setFilterValue(filterValueHolder);
}
use of com.qcadoo.view.api.components.LookupComponent in project mes by qcadoo.
the class ProductAttributeValueDetailsListeners method onChangeAttributeValue.
public void onChangeAttributeValue(final ViewDefinitionState view, final ComponentState state, final String[] args) {
LookupComponent attributeValueLookup = (LookupComponent) view.getComponentByReference(ProductAttributeValueFields.ATTRIBUTE_VALUE);
FieldComponent valueField = (FieldComponent) view.getComponentByReference(ProductAttributeValueFields.VALUE);
if (Objects.nonNull(attributeValueLookup.getEntity())) {
valueField.setFieldValue(attributeValueLookup.getEntity().getStringField(AttributeValueFields.VALUE));
valueField.requestComponentUpdateState();
}
}
Aggregations