The af:query component is built out of other components, one of which is the af:InputNumberSpinbox. You can use the code shown below to parse the af:query component for its child components. It stops for occurences of af:InputNumberSpinbox and sets the maximum and minimum value you specify.
private void setAdfQueryNumberSpinRange(UIComponent component, Integer min, Integer max){ List<UIComponent> list = component.getChildren(); for (UIComponent com : list){ if (!(com instanceof RichInputNumberSpinbox)){ setAdfQueryNumberSpinRange(com,min,max); } else{ if (min != null){ ((RichInputNumberSpinbox)com).setMinimum(min); } if(max != null){ ((RichInputNumberSpinbox)com).setMaximum(max); } } } }
You call this method from a managed bean and pass it an instance of RichQuery that you ceate through a HSF component binding. As you can see, this code only is the start because it allows you to custoimze a lot more than the number spin box. |