I have a FormComponentPanel that contains multiple child formcomponent.
The purpose of this panel is to be able to add in several cihldren
dynamically. The end model is supposed to be the list from all the children
component. I get the value in my convertInput() method by iterating over all
the children components, calling each one's getConvertedInput()

Here's the problem, the child component's values haven't convertedTheir
input at that point, so i call 'validate()' on each one to trigger that
coversion.  Is that the right way to approach this? Am i causing
unneeded/duplicate processing?
.

protected void convertInput() {
  final ArrayList<T> convertedInputList = new ArrayList<T>();
  inForm.visitFormComponents(new IVisitor() {
   public Object formComponent(IFormVisitorParticipant formComponent) {
    if (formComponent instanceof FormComponent<?>) {
     FormComponent<T> fc = (FormComponent<T>) formComponent;
     *fc.validate();
*     T convertedInput =  *fc.getConvertedInput();
*     if(null != convertedInput){
      convertedInputList.add(convertedInput);
     }
    }
    return Component.IVisitor.CONTINUE_TRAVERSAL;
   }
  });
  setConvertedInput(convertedInputList);
 }

 Thanks,

-Clint

Reply via email to