benjamin84 / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

Add support for looking up multiple components. #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
E-mail from Simeon Fitch:

I'm looking for a recommendation on how to best use the FEST-Swing API
to get a collection of all components matching a criteria implemented
by a ComponentMatcher. It's very much in a similar vein as the
ComponentPrinter.printComponents(PrintStream, Class<? extends
Component>) method, except that I want the found components placed in
a collection rather than written to the PrintStream.

Here's the approach I'm taking, but it seems like a kludge since it's
using the finder in a way that's doesn't seem intended.

       final List<AbstractButton> allButtons = new
LinkedList<AbstractButton>();
       ComponentFinder finder = _fixture.robot.finder();

       try {
           finder.find(new ComponentMatcher() {
               public boolean matches(Component c) {
                   if(c instanceof AbstractButton) {
                       allButtons.add((AbstractButton) c);
                   }
                   return false;
               }
           });
       }
       catch (ComponentLookupException ex) {
       }

Is there a better way?

Original issue reported on code.google.com by Alex.Rui...@gmail.com on 5 Jun 2008 at 9:06

GoogleCodeExporter commented 9 years ago
Added methods 'findAll(ComponentMatcher)' and 'findAll(Container, 
ComponentMatcher)'
to org.fest.swing.core.ComponentFinder to look up all the components that match
certain search criteria.

Original comment by Alex.Rui...@gmail.com on 6 Jun 2008 at 3:05

GoogleCodeExporter commented 9 years ago
Set the module as a label, instead of being part of the title.

Original comment by Alex.Rui...@gmail.com on 1 Dec 2008 at 1:59