| An iterator for a collection of Java Beans (java.awt.Component objects)
contained by a FormPanel. Only components that occupy a cell in the grid on
the form are returned - not children of those components. For example, if you
have a Java Bean such as a calendar that has several child components, only
the calendar instance will be returned. This iterator will not return the
child components of that bean. However, if a component is a nested form and
this iterator is nested, then this iterator will return the components in the
nested form (as well as the form itself).
If an iterator encounters a nested form instance, that object will be
returned (regardless of whether the nested flag is set). A component is a
nested form if it is an instance of a FormAccessor:
Iterator iter = formaccessor.beanIterator(); while( iter.hasNext() ) {
Component comp = (Component)iter.next(); if ( comp instanceof FormAccessor ) { //
found a nested form. // if this iterator is nested, the next call to next
will // return components in the nested form. } else { // found a standard
Java Bean } }
This iterator is fail-fast. If any components are added or removed by
invoking the underlying FormAccessors at any time after the Iterator is
created, the iterator will throw a ConcurrentModificationException. If nested
is true, then the iterator will fail if components are added to any
FormAccessor in the form hierarchy. You may safely call remove on the
iterator if you want to remove the component from the form. Note that you
should not modify the underlying form container by calling the
java.awt.Container methods directly. This is not recommended and can
also leave the form in an undefined state.
author: Jeff Tassin |