package pt.ist.renderers.extensions.validators; import java.util.Collection; import pt.ist.renderers.components.HtmlSimpleValueComponent; import pt.ist.renderers.extensions.MultiLanguageStringInputRenderer.LanguageBean; import pt.ist.renderers.validators.HtmlChainValidator; public class RequiredMultiLanguageStringValidator extends MultiLanguageStringValidator { public RequiredMultiLanguageStringValidator() { super(); setMessage("renderers.validator.language.required"); } public RequiredMultiLanguageStringValidator(HtmlChainValidator htmlChainValidator) { super(htmlChainValidator); setMessage("renderers.validator.language.required"); } @Override public void performValidation() { super.performValidation(); if (!isValid()) { return; } HtmlSimpleValueComponent component = (HtmlSimpleValueComponent) getComponent(); Collection beans = LanguageBean.importAllFromString(component.getValue()); for (LanguageBean bean : beans) { if (bean.value != null && bean.value.length() > 0) { setValid(true); return; } } setValid(false); } }