-
1. Re: Limit Rich:pickList
ilya_shaikovsky Mar 30, 2010 10:55 AM (in response to lgweb)pickList actually is selectManu component. But you could limit selection by attaching validator.
-
2. Re: Limit Rich:pickList
lgweb Mar 30, 2010 1:50 PM (in response to ilya_shaikovsky)But how to capture the amount of items that are available for
selection. -
3. Re: Limit Rich:pickList
lgweb Mar 30, 2010 2:34 PM (in response to lgweb)See my incomplete Validator:
@Override
public void validate(FacesContext fd, UIComponent uiComponent, Object itensSelecionados)
throws ValidatorException {
List<String> selecoes =(List<String>)itensSelecionados;
HtmlPickList pc = (HtmlPickList) uiComponent.findComponent("selAcessoRestrito");
pc.getSize();
System.out.println("Child size()"+pc.getChildren().get(0).getChildCount());
System.out.println("size....:"+pc.getSize());
}why get list.size() ??
-
4. Re: Limit Rich:pickList
lgweb Mar 30, 2010 3:22 PM (in response to lgweb)Thanks ilya, this problem is solved see:
@Override
public void validate(FacesContext fc, UIComponent uiComponent, Object itensSelecionados)
throws ValidatorException {
List<String> selecoes =(List<String>)itensSelecionados;
MBRelatorio controller = (MBRelatorio)fc.getExternalContext().getRequestMap()
.get("mBRelatorio");
int listSize = controller.getListaAreaGestora().size();
if(selecoes !=null){
if( selecoes.size() < listSize && selecoes.size() > 1 ){
throw new ValidatorException(MessageFactory.getMessage(
QUANTIDADE_SELECOES_INVALIDA, MessageFactory.getLabel(
fc, uiComponent)));
}
}
} -
5. Re: Limit Rich:pickList
ilya_shaikovsky Mar 31, 2010 7:30 AM (in response to lgweb)assumed answered