001 /*
002 * Created on Jan 13, 2009
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
005 * the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
010 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
011 * specific language governing permissions and limitations under the License.
012 *
013 * Copyright @2009-2010 the original author or authors.
014 */
015 package org.fest.swing.fixture;
016
017 import static org.fest.swing.timing.Timeout.timeout;
018
019 import java.awt.Component;
020 import java.awt.Container;
021 import java.awt.Dialog;
022
023 import javax.swing.JButton;
024 import javax.swing.JCheckBox;
025 import javax.swing.JComboBox;
026 import javax.swing.JFileChooser;
027 import javax.swing.JLabel;
028 import javax.swing.JList;
029 import javax.swing.JMenuItem;
030 import javax.swing.JOptionPane;
031 import javax.swing.JPanel;
032 import javax.swing.JProgressBar;
033 import javax.swing.JRadioButton;
034 import javax.swing.JScrollBar;
035 import javax.swing.JScrollPane;
036 import javax.swing.JSlider;
037 import javax.swing.JSpinner;
038 import javax.swing.JSplitPane;
039 import javax.swing.JTabbedPane;
040 import javax.swing.JTable;
041 import javax.swing.JToggleButton;
042 import javax.swing.JToolBar;
043 import javax.swing.JTree;
044 import javax.swing.text.JTextComponent;
045
046 import org.fest.swing.core.GenericTypeMatcher;
047 import org.fest.swing.exception.ComponentLookupException;
048 import org.fest.swing.exception.WaitTimedOutError;
049 import org.fest.swing.timing.Timeout;
050
051 /**
052 * Understands lookup of <code>{@link Component}</code>s contained in a <code>{@link Container}</code>.
053 *
054 * @author Alex Ruiz
055 */
056 public interface ComponentContainerFixture {
057
058 /** The timeout to use when looking for a dialog. It's value is 100 ms. **/
059 public static Timeout DEFAULT_DIALOG_LOOKUP_TIMEOUT = timeout(100);
060
061 /**
062 * Returns a <code>{@link JButton}</code> found in this fixture's <code>{@link Container}</code>.
063 * @return a fixture that manages the <code>JButton</code> found.
064 * @throws ComponentLookupException if a <code>JButton</code> could not be found.
065 * @throws ComponentLookupException if more than one <code>JButton</code> is found.
066 */
067 JButtonFixture button();
068
069 /**
070 * Finds a <code>{@link JButton}</code> in this fixture's <code>{@link Container}</code>, that matches the
071 * specified search criteria.
072 * @param matcher contains the search criteria for finding a <code>JButton</code>.
073 * @return a fixture that manages the <code>JButton</code> found.
074 * @throws ComponentLookupException if a <code>JButton</code> that matches the given search criteria could not be
075 * found.
076 * @throws ComponentLookupException if more than one <code>JButton</code> that matches the given search criteria is
077 * found.
078 */
079 JButtonFixture button(GenericTypeMatcher<? extends JButton> matcher);
080
081 /**
082 * Finds a <code>{@link JButton}</code> in this fixture's <code>{@link Container}</code>, which name matches the
083 * specified one.
084 * @param name the name to match.
085 * @return a fixture that manages the <code>JButton</code> found.
086 * @throws ComponentLookupException if a <code>JButton</code> having a matching name could not be found.
087 * @throws ComponentLookupException if more than one <code>JButton</code> having a matching name is found.
088 */
089 JButtonFixture button(String name);
090
091 /**
092 * Returns a <code>{@link JCheckBox}</code> found in this fixture's <code>{@link Container}</code>.
093 * @return a fixture that manages the <code>JCheckBox</code> found.
094 * @throws ComponentLookupException if a <code>JCheckBox</code> could not be found.
095 * @throws ComponentLookupException if more than one <code>JCheckBox</code> is found.
096 */
097 JCheckBoxFixture checkBox();
098
099 /**
100 * Finds a <code>{@link JCheckBox}</code> in this fixture's <code>{@link Container}</code>, that matches the
101 * specified search criteria.
102 * @param matcher contains the search criteria for finding a <code>JCheckBox</code>.
103 * @return a fixture that manages the <code>JCheckBox</code> found.
104 * @throws ComponentLookupException if a <code>JCheckBox</code> that matches the given search criteria could not be
105 * found.
106 * @throws ComponentLookupException if more than one <code>JCheckBox</code> that matches the given search criteria is
107 * found.
108 */
109 JCheckBoxFixture checkBox(GenericTypeMatcher<? extends JCheckBox> matcher);
110
111 /**
112 * Finds a <code>{@link JCheckBox}</code> in this fixture's <code>{@link Container}</code>, which name matches
113 * the specified one.
114 * @param name the name to match.
115 * @return a fixture that manages the <code>JCheckBox</code> found.
116 * @throws ComponentLookupException if a <code>JCheckBox</code> having a matching name could not be found.
117 */
118 JCheckBoxFixture checkBox(String name);
119
120 /**
121 * Returns a <code>{@link JComboBox}</code> found in this fixture's <code>{@link Container}</code>.
122 * @return a fixture that manages the <code>JComboBox</code> found.
123 * @throws ComponentLookupException if a <code>JComboBox</code> could not be found.
124 * @throws ComponentLookupException if more than one <code>JComboBox</code> is found.
125 */
126 JComboBoxFixture comboBox();
127
128 /**
129 * Finds a <code>{@link JComboBox}</code> in this fixture's <code>{@link Container}</code>, that matches the
130 * specified search criteria.
131 * @param matcher contains the search criteria for finding a <code>JComboBox</code>.
132 * @return a fixture that manages the <code>JComboBox</code> found.
133 * @throws ComponentLookupException if a <code>JComboBox</code> that matches the given search criteria could not be
134 * found.
135 * @throws ComponentLookupException if more than one <code>JComboBox</code> that matches the given search criteria is
136 * found.
137 */
138 JComboBoxFixture comboBox(GenericTypeMatcher<? extends JComboBox> matcher);
139
140 /**
141 * Finds a <code>{@link JComboBox}</code> in this fixture's <code>{@link Container}</code>, which name matches
142 * the specified one.
143 * @param name the name to match.
144 * @return a fixture that manages the <code>JComboBox</code> found.
145 * @throws ComponentLookupException if a <code>JComboBox</code> having a matching name could not be found.
146 * @throws ComponentLookupException if more than one <code>JComboBox</code> having a matching name is found.
147 */
148 JComboBoxFixture comboBox(String name);
149
150 /**
151 * Returns the only <code>{@link Dialog}</code> currently available (if any.) This method uses the value defined in
152 * <code>{@link #DEFAULT_DIALOG_LOOKUP_TIMEOUT}</code> as the default lookup timeout.
153 * @return a fixture that manages the <code>Dialog</code> found.
154 * @throws WaitTimedOutError if a <code>Dialog</code> could not be found.
155 * @see #dialog(Timeout)
156 */
157 DialogFixture dialog();
158
159 /**
160 * Returns the only <code>{@link Dialog}</code> currently available (if any.)
161 * @param timeout the amount of time to wait for a <code>Dialog</code> to be found.
162 * @return a fixture that manages the <code>Dialog</code> found.
163 * @throws WaitTimedOutError if a <code>Dialog</code> could not be found.
164 * @since 1.2
165 */
166 DialogFixture dialog(Timeout timeout);
167
168 /**
169 * Finds a <code>{@link Dialog}</code> that matches the specified search criteria. This method uses the value defined
170 * in <code>{@link #DEFAULT_DIALOG_LOOKUP_TIMEOUT}</code> as the default lookup timeout.
171 * @param matcher contains the search criteria for finding a <code>Dialog</code>.
172 * @return a fixture that manages the <code>Dialog</code> found.
173 * @throws WaitTimedOutError if a <code>Dialog</code> that matches the given search criteria could not be found.
174 * @see #dialog(GenericTypeMatcher, Timeout)
175 */
176 DialogFixture dialog(GenericTypeMatcher<? extends Dialog> matcher);
177
178 /**
179 * Finds a <code>{@link Dialog}</code> that matches the specified search criteria.
180 * @param matcher contains the search criteria for finding a <code>Dialog</code>.
181 * @param timeout the amount of time to wait for a <code>Dialog</code> to be found.
182 * @return a fixture that manages the <code>Dialog</code> found.
183 * @throws WaitTimedOutError if a <code>Dialog</code> that matches the given search criteria could not be found.
184 * @since 1.2
185 */
186 DialogFixture dialog(GenericTypeMatcher<? extends Dialog> matcher, Timeout timeout);
187
188 /**
189 * Finds a <code>{@link Dialog}</code> with a name matching the specified one. This method uses the value defined in
190 * <code>{@link #DEFAULT_DIALOG_LOOKUP_TIMEOUT}</code> as the default lookup timeout.
191 * @param name the name to match.
192 * @return a fixture that manages the <code>Dialog</code> found.
193 * @throws WaitTimedOutError if a <code>Dialog</code> that a matching name could not be found.
194 * @see #dialog(String, Timeout)
195 */
196 DialogFixture dialog(String name);
197
198 /**
199 * Finds a <code>{@link Dialog}</code> with a name matching the specified one.
200 * @param name the name to match.
201 * @param timeout the amount of time to wait for a <code>Dialog</code> to be found.
202 * @return a fixture that manages the <code>Dialog</code> found.
203 * @throws WaitTimedOutError if a <code>Dialog</code> that a matching name could not be found.
204 * @since 1.2
205 */
206 DialogFixture dialog(String name, Timeout timeout);
207
208 /**
209 * Returns the only <code>{@link JFileChooser}</code> currently available (if any.) This method uses the value
210 * defined in <code>{@link #DEFAULT_DIALOG_LOOKUP_TIMEOUT}</code> as the default lookup timeout.
211 * @return a fixture that manages the <code>JFileChooser</code> found.
212 * @throws WaitTimedOutError if a <code>JFileChooser</code> could not be found.
213 * @see #fileChooser(Timeout)
214 */
215 JFileChooserFixture fileChooser();
216
217 /**
218 * Returns the only <code>{@link JFileChooser}</code> currently available (if any.)
219 * @param timeout the amount of time to wait for a <code>JFileChooser</code> to be found.
220 * @return a fixture that manages the <code>JFileChooser</code> found.
221 * @throws WaitTimedOutError if a <code>JFileChooser</code> could not be found.
222 */
223 JFileChooserFixture fileChooser(Timeout timeout);
224
225 /**
226 * Finds a <code>{@link JFileChooser}</code> that matches the specified search criteria. This method uses the value
227 * defined in <code>{@link #DEFAULT_DIALOG_LOOKUP_TIMEOUT}</code> as the default lookup timeout.
228 * @param matcher contains the search criteria for finding a <code>JFileChooser</code>.
229 * @return a fixture that manages the <code>JFileChooser</code> found.
230 * @throws WaitTimedOutError if a <code>JFileChooser</code> could not be found.
231 * @see #fileChooser(GenericTypeMatcher, Timeout)
232 */
233 JFileChooserFixture fileChooser(GenericTypeMatcher<? extends JFileChooser> matcher);
234
235 /**
236 * Finds a <code>{@link JFileChooser}</code> that matches the specified search criteria.
237 * @param matcher contains the search criteria for finding a <code>JFileChooser</code>.
238 * @param timeout the amount of time to wait for a <code>JFileChooser</code> to be found.
239 * @return a fixture that manages the <code>JFileChooser</code> found.
240 * @throws WaitTimedOutError if a <code>JFileChooser</code> could not be found.
241 */
242 JFileChooserFixture fileChooser(GenericTypeMatcher<? extends JFileChooser> matcher, Timeout timeout);
243
244 /**
245 * Finds a <code>{@link JFileChooser}</code> with a name matching the specified one. This method uses the value
246 * defined in <code>{@link #DEFAULT_DIALOG_LOOKUP_TIMEOUT}</code> as the default lookup timeout.
247 * @param name the name to match.
248 * @return a fixture that manages the <code>JFileChooser</code> found.
249 * @throws WaitTimedOutError if a <code>JFileChooser</code> could not be found.
250 * @see #fileChooser(String, Timeout)
251 */
252 JFileChooserFixture fileChooser(String name);
253
254 /**
255 * Finds a <code>{@link JFileChooser}</code> with a name matching the specified one.
256 * @param name the name to match.
257 * @param timeout the amount of time to wait for a <code>JFileChooser</code> to be found.
258 * @return a fixture that manages the <code>JFileChooser</code> found.
259 * @throws WaitTimedOutError if a <code>JFileChooser</code> could not be found.
260 */
261 JFileChooserFixture fileChooser(String name, Timeout timeout);
262
263 /**
264 * Returns a <code>{@link JLabel}</code> found in this fixture's <code>{@link Container}</code>.
265 * @return a fixture that manages the <code>JLabel</code> found.
266 * @throws ComponentLookupException if a <code>JLabel</code> could not be found.
267 * @throws ComponentLookupException if more than one <code>JLabel</code> is found.
268 */
269 JLabelFixture label();
270
271 /**
272 * Finds a <code>{@link JLabel}</code> in this fixture's <code>{@link Container}</code>, that matches the
273 * specified search criteria.
274 * @param matcher contains the search criteria for finding a <code>JLabel</code>.
275 * @return a fixture that manages the <code>JLabel</code> found.
276 * @throws ComponentLookupException if a <code>JLabel</code> that matches the given search criteria could not be
277 * found.
278 * @throws ComponentLookupException if more than one <code>JLabel</code> that matches the given search criteria is
279 * found.
280 */
281 JLabelFixture label(GenericTypeMatcher<? extends JLabel> matcher);
282
283 /**
284 * Finds a <code>{@link JLabel}</code> in this fixture's <code>{@link Container}</code>, which name matches the
285 * specified one.
286 * @param name the name to match.
287 * @return a fixture that manages the <code>JLabel</code> found.
288 * @throws ComponentLookupException if a <code>JLabel</code> having a matching name could not be found.
289 * @throws ComponentLookupException if more than one <code>JLabel</code> having a matching name could is found.
290 */
291 JLabelFixture label(String name);
292
293 /**
294 * Returns a <code>{@link JList}</code> found in this fixture's <code>{@link Container}</code>.
295 * @return a fixture that manages the <code>JList</code> found.
296 * @throws ComponentLookupException if a <code>JList</code> could not be found.
297 * @throws ComponentLookupException if more than one <code>JList</code> is found.
298 */
299 JListFixture list();
300
301 /**
302 * Finds a <code>{@link JList}</code> in this fixture's <code>{@link Container}</code>, that matches the
303 * specified search criteria.
304 * @param matcher contains the search criteria for finding a <code>JList</code>.
305 * @return a fixture that manages the <code>JList</code> found.
306 * @throws ComponentLookupException if a <code>JList</code> that matches the given search criteria could not be found.
307 * @throws ComponentLookupException if more than one <code>JList</code> that matches the given search criteria is
308 * found.
309 */
310 JListFixture list(GenericTypeMatcher<? extends JList> matcher);
311
312 /**
313 * Finds a <code>{@link JList}</code> in this fixture's <code>{@link Container}</code>, which name matches the
314 * specified one.
315 * @param name the name to match.
316 * @return a fixture that manages the <code>JList</code> found.
317 * @throws ComponentLookupException if a <code>JList</code> having a matching name could not be found.
318 * @throws ComponentLookupException if more than one <code>JList</code> having a matching name is found.
319 */
320 JListFixture list(String name);
321
322 /**
323 * Finds a <code>{@link JMenuItem}</code> in this fixture's <code>{@link Container}</code>, which path matches
324 * the given one.
325 * <p>
326 * For example, if we are looking for the menu with text "New" contained under the menu with text "File", we can
327 * simply call
328 *
329 * <pre>
330 * JMenuItemFixture menuItem = container.<strong>menuItemWithPath("File", "Menu")</strong>;
331 * </pre>
332 *
333 * </p>
334 * @param path the path of the menu to find.
335 * @return a fixture that manages the <code>JMenuItem</code> found.
336 * @throws ComponentLookupException if a <code>JMenuItem</code> under the given path could not be found.
337 * @throws AssertionError if the <code>Component</code> found under the given path is not a <code>JMenuItem</code>.
338 */
339 JMenuItemFixture menuItemWithPath(String... path);
340
341 /**
342 * Finds a <code>{@link JMenuItem}</code>, contained in this fixture's <code>{@link Container}</code>,
343 * which name matches the specified one.
344 * @param name the name to match.
345 * @return a fixture that manages the <code>JMenuItem</code> found.
346 * @throws ComponentLookupException if a <code>JMenuItem</code> having a matching name could not be found.
347 * @throws ComponentLookupException if more than one <code>JMenuItem</code> having a matching name is found.
348 */
349 JMenuItemFixture menuItem(String name);
350
351 /**
352 * Finds a <code>{@link JMenuItem}</code>, contained in this fixture's <code>{@link Container}</code>,
353 * that matches the specified search criteria.
354 * @param matcher contains the search criteria for finding a <code>JMenuItem</code>.
355 * @return a fixture that manages the <code>JMenuItem</code> found.
356 * @throws ComponentLookupException if a <code>JMenuItem</code> that matches the given search criteria could not be
357 * found.
358 * @throws ComponentLookupException if more than one <code>JMenuItem</code> that matches the given search criteria is
359 * found.
360 */
361 JMenuItemFixture menuItem(GenericTypeMatcher<? extends JMenuItem> matcher);
362
363 /**
364 * Returns the only <code>{@link JOptionPane}</code> currently available (if any.) This method uses the value defined
365 * in <code>{@link #DEFAULT_DIALOG_LOOKUP_TIMEOUT}</code> as the default lookup timeout.
366 * @return a fixture that manages the <code>JOptionPane</code> found.
367 * @throws WaitTimedOutError if a <code>JOptionPane</code> could not be found.
368 * @see #optionPane(Timeout)
369 */
370 JOptionPaneFixture optionPane();
371
372 /**
373 * Returns the only <code>{@link JOptionPane}</code> currently available (if any.)
374 * @param timeout the amount of time to wait for a <code>JOptionPane</code> to be found.
375 * @return a fixture that manages the <code>JOptionPane</code> found.
376 * @throws WaitTimedOutError if a <code>JOptionPane</code> could not be found.
377 */
378 JOptionPaneFixture optionPane(Timeout timeout);
379
380 /**
381 * Returns a <code>{@link JPanel}</code> found in this fixture's <code>{@link Container}</code>.
382 * @return a fixture that manages the <code>JPanel</code> found.
383 * @throws ComponentLookupException if a <code>JPanel</code> could not be found.
384 * @throws ComponentLookupException if more than one <code>JPanel</code> is found.
385 */
386 JPanelFixture panel();
387
388 /**
389 * Finds a <code>{@link JPanel}</code> in this fixture's <code>{@link Container}</code>, that matches the
390 * specified search criteria.
391 * @param matcher contains the search criteria for finding a <code>JPanel</code>.
392 * @return a fixture that manages the <code>JPanel</code> found.
393 * @throws ComponentLookupException if a <code>JPanel</code> that matches the given search criteria could not be
394 * found.
395 * @throws ComponentLookupException if more than one <code>JPanel</code> that matches the given search criteria is
396 * found.
397 */
398 JPanelFixture panel(GenericTypeMatcher<? extends JPanel> matcher);
399
400 /**
401 * Finds a <code>{@link JPanel}</code> in this fixture's <code>{@link Container}</code>, which name matches
402 * the specified one.
403 * @param name the name to match.
404 * @return a fixture that manages the <code>JPanel</code> found.
405 * @throws ComponentLookupException if a <code>JPanel</code> having a matching name could not be found.
406 */
407 JPanelFixture panel(String name);
408
409 /**
410 * Returns a <code>{@link JProgressBar}</code> found in this fixture's <code>{@link Container}</code>.
411 * @return a fixture that manages the <code>JProgressBar</code> found.
412 * @throws ComponentLookupException if a <code>JProgressBar</code> could not be found.
413 * @throws ComponentLookupException if more than one <code>JProgressBar</code> is found.
414 */
415 JProgressBarFixture progressBar();
416
417 /**
418 * Finds a <code>{@link JProgressBar}</code> in this fixture's <code>{@link Container}</code>, that matches the
419 * specified search criteria.
420 * @param matcher contains the search criteria for finding a <code>JProgressBar</code>.
421 * @return a fixture that manages the <code>JProgressBar</code> found.
422 * @throws ComponentLookupException if a <code>JProgressBar</code> that matches the given search criteria could not be
423 * found.
424 * @throws ComponentLookupException if more than one <code>JProgressBar</code> that matches the given search criteria
425 * is found.
426 */
427 JProgressBarFixture progressBar(GenericTypeMatcher<? extends JProgressBar> matcher);
428
429 /**
430 * Finds a <code>{@link JProgressBar}</code> in this fixture's <code>{@link Container}</code>, which name matches
431 * the specified one.
432 * @param name the name to match.
433 * @return a fixture that manages the <code>JProgressBar</code> found.
434 * @throws ComponentLookupException if a <code>JProgressBar</code> having a matching name could not be found.
435 */
436 JProgressBarFixture progressBar(String name);
437
438 /**
439 * Returns a <code>{@link JRadioButton}</code> found in this fixture's <code>{@link Container}</code>.
440 * @return a fixture that manages the <code>JRadioButton</code> found.
441 * @throws ComponentLookupException if a <code>JRadioButton</code> could not be found.
442 * @throws ComponentLookupException if more than one <code>JRadioButton</code> is found.
443 */
444 JRadioButtonFixture radioButton();
445
446 /**
447 * Finds a <code>{@link JRadioButton}</code> in this fixture's <code>{@link Container}</code>, that matches the
448 * specified search criteria.
449 * @param matcher contains the search criteria for finding a <code>JRadioButton</code>.
450 * @return a fixture that manages the <code>JRadioButton</code> found.
451 * @throws ComponentLookupException if a <code>JRadioButton</code> that matches the given search criteria could not be
452 * found.
453 * @throws ComponentLookupException if more than one <code>JRadioButton</code> that matches the given search criteria
454 * is found.
455 */
456 JRadioButtonFixture radioButton(GenericTypeMatcher<? extends JRadioButton> matcher);
457
458 /**
459 * Finds a <code>{@link JRadioButton}</code> in this fixture's <code>{@link Container}</code>, which name matches
460 * the specified one.
461 * @param name the name to match.
462 * @return a fixture that manages the <code>JRadioButton</code> found.
463 * @throws ComponentLookupException if a <code>JRadioButton</code> having a matching name could not be found.
464 * @throws ComponentLookupException if more than one <code>JRadioButton</code> having a matching name is found.
465 */
466 JRadioButtonFixture radioButton(String name);
467
468 /**
469 * Returns a <code>{@link JScrollBar}</code> found in this fixture's <code>{@link Container}</code>.
470 * @return a fixture that manages the <code>JScrollBar</code> found.
471 * @throws ComponentLookupException if a <code>JScrollBar</code> could not be found.
472 * @throws ComponentLookupException if more than one <code>JScrollBar</code> is found.
473 */
474 JScrollBarFixture scrollBar();
475
476 /**
477 * Finds a <code>{@link JScrollBar}</code> in this fixture's <code>{@link Container}</code>, that matches the
478 * specified search criteria.
479 * @param matcher contains the search criteria for finding a <code>JScrollBar</code>.
480 * @return a fixture that manages the <code>JScrollBar</code> found.
481 * @throws ComponentLookupException if a <code>JScrollBar</code> that matches the given search criteria could not be
482 * found.
483 * @throws ComponentLookupException if more than one <code>JScrollBar</code> that matches the given search criteria is
484 * found.
485 */
486 JScrollBarFixture scrollBar(GenericTypeMatcher<? extends JScrollBar> matcher);
487
488 /**
489 * Finds a <code>{@link JScrollBar}</code> in this fixture's <code>{@link Container}</code>, which name matches the
490 * specified one.
491 * @param name the name to match.
492 * @return a fixture that manages the <code>JScrollBar</code> found.
493 * @throws ComponentLookupException if a <code>JScrollBar</code> having a matching name could not be found.
494 * @throws ComponentLookupException if more than one <code>JScrollBar</code> having a matching name is found.
495 */
496 JScrollBarFixture scrollBar(String name);
497
498 /**
499 * Returns a <code>{@link JScrollPane}</code> found in this fixture's <code>{@link Container}</code>.
500 * @return a fixture that manages the <code>JScrollPane</code> found.
501 * @throws ComponentLookupException if a <code>JScrollPane</code> could not be found.
502 * @throws ComponentLookupException if more than one <code>JScrollPane</code> is found.
503 */
504 JScrollPaneFixture scrollPane();
505
506 /**
507 * Finds a <code>{@link JScrollPane}</code> in this fixture's <code>{@link Container}</code>, that matches the
508 * specified search criteria.
509 * @param matcher contains the search criteria for finding a <code>JScrollPane</code>.
510 * @return a fixture that manages the <code>JScrollPane</code> found.
511 * @throws ComponentLookupException if a <code>JScrollPane</code> that matches the given search criteria could not be
512 * found.
513 * @throws ComponentLookupException if more than one <code>JScrollPane</code> that matches the given search criteria
514 * is found.
515 */
516 JScrollPaneFixture scrollPane(GenericTypeMatcher<? extends JScrollPane> matcher);
517
518 /**
519 * Finds a <code>{@link JScrollPane}</code> in this fixture's <code>{@link Container}</code>, which name matches the
520 * specified one.
521 * @param name the name to match.
522 * @return a fixture that manages the <code>JScrollPane</code> found.
523 * @throws ComponentLookupException if a <code>JScrollPane</code> having a matching name could not be found.
524 * @throws ComponentLookupException if more than one <code>JScrollPane</code> having a matching name is found.
525 */
526 JScrollPaneFixture scrollPane(String name);
527
528 /**
529 * Returns a <code>{@link JSlider}</code> found in this fixture's <code>{@link Container}</code>.
530 * @return a fixture that manages the <code>JSlider</code> found.
531 * @throws ComponentLookupException if a <code>JSlider</code> could not be found.
532 * @throws ComponentLookupException if more than one <code>JSlider</code> is found.
533 */
534 JSliderFixture slider();
535
536 /**
537 * Finds a <code>{@link JSlider}</code> in this fixture's <code>{@link Container}</code>, that matches the
538 * specified search criteria.
539 * @param matcher contains the search criteria for finding a <code>JSlider</code>.
540 * @return a fixture that manages the <code>JSlider</code> found.
541 * @throws ComponentLookupException if a <code>JSlider</code> that matches the given search criteria could not be
542 * found.
543 * @throws ComponentLookupException if more than one <code>JSlider</code> that matches the given search criteria is
544 * found.
545 */
546 JSliderFixture slider(GenericTypeMatcher<? extends JSlider> matcher);
547
548 /**
549 * Finds a <code>{@link JSlider}</code> in this fixture's <code>{@link Container}</code>, which name matches the
550 * specified one.
551 * @param name the name to match.
552 * @return a fixture that manages the <code>JSlider</code> found.
553 * @throws ComponentLookupException if a <code>JSlider</code> having a matching name could not be found.
554 * @throws ComponentLookupException if more than one <code>JSlider</code> having a matching name is found.
555 */
556 JSliderFixture slider(String name);
557
558 /**
559 * Returns a <code>{@link JSpinner}</code> found in this fixture's <code>{@link Container}</code>.
560 * @return a fixture that manages the <code>JSpinner</code> found.
561 * @throws ComponentLookupException if a <code>JSpinner</code> could not be found.
562 * @throws ComponentLookupException if more than one <code>JSpinner</code> is found.
563 */
564 JSpinnerFixture spinner();
565
566 /**
567 * Finds a <code>{@link JSpinner}</code> in this fixture's <code>{@link Container}</code>, that matches the
568 * specified search criteria.
569 * @param matcher contains the search criteria for finding a <code>JSpinner</code>.
570 * @return a fixture that manages the <code>JSpinner</code> found.
571 * @throws ComponentLookupException if a <code>JSpinner</code> that matches the given search criteria could not be
572 * found.
573 * @throws ComponentLookupException if more than one <code>JSpinner</code> that matches the given search criteria is
574 * found.
575 */
576 JSpinnerFixture spinner(GenericTypeMatcher<? extends JSpinner> matcher);
577
578 /**
579 * Finds a <code>{@link JSpinner}</code> in this fixture's <code>{@link Container}</code>, which name matches the
580 * specified one.
581 * @param name the name to match.
582 * @return a fixture that manages the <code>JSpinner</code> found.
583 * @throws ComponentLookupException if a <code>JSpinner</code> having a matching name could not be found.
584 * @throws ComponentLookupException if more than one <code>JSpinner</code> having a matching name is found.
585 */
586 JSpinnerFixture spinner(String name);
587
588 /**
589 * Returns the <code>{@link JSplitPane}</code> found in this fixture's <code>{@link Container}</code>.
590 * @return a fixture that manages the <code>JSplitPane</code> found.
591 * @throws ComponentLookupException if a <code>JSplitPane</code> could not be found.
592 * @throws ComponentLookupException if more than one <code>JSplitPane</code> is found.
593 */
594 JSplitPaneFixture splitPane();
595
596 /**
597 * Finds a <code>{@link JSplitPane}</code> in this fixture's <code>{@link Container}</code>, that matches the
598 * specified search criteria.
599 * @param matcher contains the search criteria for finding a <code>JSplitPane</code>.
600 * @return a fixture that manages the <code>JSplitPane</code> found.
601 * @throws ComponentLookupException if a <code>JSplitPane</code> that matches the given search criteria could not be
602 * found.
603 * @throws ComponentLookupException if more than one <code>JSplitPane</code> that matches the given search criteria is
604 * found.
605 */
606 JSplitPaneFixture splitPane(GenericTypeMatcher<? extends JSplitPane> matcher);
607
608 /**
609 * Finds a <code>{@link JSplitPane}</code> in this fixture's <code>{@link Container}</code>, which name matches
610 * the specified one.
611 * @param name the name to match.
612 * @return a fixture that manages the <code>JSplitPane</code> found.
613 * @throws ComponentLookupException if a <code>JSplitPane</code> having a matching name could not be found.
614 * @throws ComponentLookupException if more than one <code>JSplitPane</code> having a matching name is found.
615 */
616 JSplitPaneFixture splitPane(String name);
617
618 /**
619 * Returns a <code>{@link JTabbedPane}</code> found in this fixture's <code>{@link Container}</code>.
620 * @return a fixture that manages the <code>JTabbedPane</code> found.
621 * @throws ComponentLookupException if a <code>JTabbedPane</code> could not be found.
622 * @throws ComponentLookupException if more than one <code>JTabbedPane</code> is found.
623 */
624 JTabbedPaneFixture tabbedPane();
625
626 /**
627 * Finds a <code>{@link JTabbedPane}</code> in this fixture's <code>{@link Container}</code>, that matches the
628 * specified search criteria.
629 * @param matcher contains the search criteria for finding a <code>JTabbedPane</code>.
630 * @return a fixture that manages the <code>JTabbedPane</code> found.
631 * @throws ComponentLookupException if a <code>JTabbedPane</code> that matches the given search criteria could not be
632 * found.
633 * @throws ComponentLookupException if more than one <code>JTabbedPane</code> that matches the given search criteria
634 * is found.
635 */
636 JTabbedPaneFixture tabbedPane(GenericTypeMatcher<? extends JTabbedPane> matcher);
637
638 /**
639 * Finds a <code>{@link JTabbedPane}</code> in this fixture's <code>{@link Container}</code>, which name matches
640 * the specified one.
641 * @param name the name to match.
642 * @return a fixture that manages the <code>JTabbedPane</code> found.
643 * @throws ComponentLookupException if a <code>JTabbedPane</code> having a matching name could not be found.
644 * @throws ComponentLookupException if more than one <code>JTabbedPane</code> having a matching name is found.
645 */
646 JTabbedPaneFixture tabbedPane(String name);
647
648 /**
649 * Returns a <code>{@link JTable}</code> found in this fixture's <code>{@link Container}</code>.
650 * @return a fixture that manages the <code>JTable</code> found.
651 * @throws ComponentLookupException if a <code>JTable</code> having a matching name could not be found.
652 * @throws ComponentLookupException if more than one <code>JTable</code> having a matching name is found.
653 */
654 JTableFixture table();
655
656 /**
657 * Finds a <code>{@link JTable}</code> in this fixture's <code>{@link Container}</code>, that matches the
658 * specified search criteria.
659 * @param matcher contains the search criteria for finding a <code>JTable</code>.
660 * @return a fixture that manages the <code>JTable</code> found.
661 * @throws ComponentLookupException if a <code>JTable</code> that matches the given search criteria could not be
662 * found.
663 * @throws ComponentLookupException if more than one <code>JTable</code> that matches the given search criteria is
664 * found.
665 */
666 JTableFixture table(GenericTypeMatcher<? extends JTable> matcher);
667
668 /**
669 * Finds a <code>{@link JTable}</code> in this fixture's <code>{@link Container}</code>, which name matches the
670 * specified one.
671 * @param name the name to match.
672 * @return a fixture that manages the <code>JTable</code> found.
673 * @throws ComponentLookupException if a <code>JTable</code> having a matching name could not be found.
674 * @throws ComponentLookupException if more than one <code>JTable</code> having a matching name is found.
675 */
676 JTableFixture table(String name);
677
678 /**
679 * Returns a <code>{@link JTextComponent}</code> found in this fixture's <code>{@link Container}</code>.
680 * @return a fixture that manages the <code>JTextComponent</code> found.
681 * @throws ComponentLookupException if a <code>JTextComponent</code> having a matching name could not be found.
682 * @throws ComponentLookupException if more than one <code>JTextComponent</code> having a matching name is found.
683 */
684 JTextComponentFixture textBox();
685
686 /**
687 * Finds a <code>{@link JTextComponent}</code> in this fixture's <code>{@link Container}</code> managed by this
688 * fixture, that matches the specified search criteria.
689 * @param matcher contains the search criteria for finding a <code>JTextComponent</code>.
690 * @return a fixture that manages the <code>JTextComponent</code> found.
691 * @throws ComponentLookupException if a <code>JTextComponent</code> that matches the given search criteria could not
692 * be found.
693 * @throws ComponentLookupException if more than one <code>JTextComponent</code> that matches the given search
694 * criteria is found.
695 */
696 JTextComponentFixture textBox(GenericTypeMatcher<? extends JTextComponent> matcher);
697
698 /**
699 * Finds a <code>{@link JTextComponent}</code> in this fixture's <code>{@link Container}</code> managed by this
700 * fixture, which name matches the specified one.
701 * @param name the name to match.
702 * @return a fixture that manages the <code>JTextComponent</code> found.
703 * @throws ComponentLookupException if a <code>JTextComponent</code> having a matching name could not be found.
704 * @throws ComponentLookupException if more than one <code>JTextComponent</code> having a matching name is found.
705 */
706 JTextComponentFixture textBox(String name);
707
708 /**
709 * Returns a <code>{@link JToggleButton}</code> found in this fixture's <code>{@link Container}</code>.
710 * @return a fixture that manages the <code>JToggleButton</code> found.
711 * @throws ComponentLookupException if a <code>JToggleButton</code> could not be found.
712 * @throws ComponentLookupException if more than one <code>JToggleButton</code> is found.
713 */
714 JToggleButtonFixture toggleButton();
715
716 /**
717 * Finds a <code>{@link JToggleButton}</code> in this fixture's <code>{@link Container}</code>, that matches the
718 * specified search criteria.
719 * @param matcher contains the search criteria for finding a <code>JToggleButton</code>.
720 * @return a fixture that manages the <code>JToggleButton</code> found.
721 * @throws ComponentLookupException if a <code>JToggleButton</code> that matches the given search criteria could not
722 * be found.
723 * @throws ComponentLookupException if more than one <code>JToggleButton</code> that matches the given search criteria
724 * is found.
725 */
726 JToggleButtonFixture toggleButton(GenericTypeMatcher<? extends JToggleButton> matcher);
727
728 /**
729 * Finds a <code>{@link JToggleButton}</code> in this fixture's <code>{@link Container}</code>, which name matches
730 * the specified one.
731 * @param name the name to match.
732 * @return a fixture that manages the <code>JToggleButton</code> found.
733 * @throws ComponentLookupException if a <code>JToggleButton</code> having a matching name could not be found.
734 * @throws ComponentLookupException if more than one <code>JToggleButton</code> having a matching name is found.
735 */
736 JToggleButtonFixture toggleButton(String name);
737
738 /**
739 * Returns a <code>{@link JToolBar}</code> found in this fixture's <code>{@link Container}</code>.
740 * @return a fixture that manages the <code>JToolBar</code> found.
741 * @throws ComponentLookupException if a <code>JToolBar</code> having a matching name could not be found.
742 * @throws ComponentLookupException if more than one <code>JToolBar</code> having a matching name could is found.
743 */
744 JToolBarFixture toolBar();
745
746 /**
747 * Finds a <code>{@link JToolBar}</code> in this fixture's <code>{@link Container}</code>, that matches the
748 * specified search criteria.
749 * @param matcher contains the search criteria for finding a <code>JToolBar</code>.
750 * @return a fixture that manages the <code>JToolBar</code> found.
751 * @throws ComponentLookupException if a <code>JToolBar</code> that matches the given search criteria could not be
752 * found.
753 * @throws ComponentLookupException if more than one <code>JToolBar</code> that matches the given search criteria is
754 * found.
755 */
756 JToolBarFixture toolBar(GenericTypeMatcher<? extends JToolBar> matcher);
757
758 /**
759 * Finds a <code>{@link JToolBar}</code> in this fixture's <code>{@link Container}</code>, which name matches the
760 * specified one.
761 * @param name the name to match.
762 * @return a fixture that manages the <code>JToolBar</code> found.
763 * @throws ComponentLookupException if a <code>JToolBar</code> having a matching name could not be found.
764 * @throws ComponentLookupException if more than one <code>JToolBar</code> having a matching name is found.
765 */
766 JToolBarFixture toolBar(String name);
767
768 /**
769 * Returns a <code>{@link JTree}</code> found in this fixture's <code>{@link Container}</code>.
770 * @return a fixture that manages the <code>JTree</code> found.
771 * @throws ComponentLookupException if a <code>JTree</code> having a matching name could not be found.
772 * @throws ComponentLookupException if more than one <code>JTree</code> having a matching name is found.
773 */
774 JTreeFixture tree();
775
776 /**
777 * Finds a <code>{@link JTree}</code> in this fixture's <code>{@link Container}</code>, that matches the
778 * specified search criteria.
779 * @param matcher contains the search criteria for finding a <code>JTree</code>.
780 * @return a fixture that manages the <code>JTree</code> found.
781 * @throws ComponentLookupException if a <code>JTree</code> that matches the given search criteria could not be found.
782 * @throws ComponentLookupException if more than one <code>JTree</code> that matches the given search criteria is
783 * found.
784 */
785 JTreeFixture tree(GenericTypeMatcher<? extends JTree> matcher);
786
787 /**
788 * Finds a <code>{@link JTree}</code> in this fixture's <code>{@link Container}</code>, which name matches the
789 * specified one.
790 * @param name the name to match.
791 * @return a fixture that manages the <code>JTree</code> found.
792 * @throws ComponentLookupException if a <code>JTree</code> having a matching name could not be found.
793 * @throws ComponentLookupException if more than one <code>JTree</code> having a matching name is found.
794 */
795 JTreeFixture tree(String name);
796
797 /**
798 * Returns a <code>{@link ComponentFixture}</code> managing a component inside this fixture's
799 * <code>{@link Container}</code>. This is an extension method, to allow implementations of
800 * <code>{@link ContainerFixture}</code> handle custom GUI components.
801 * @param <C> the type of <code>Component</code> the fixture to return can handle.
802 * @param <F> the type of <code>ComponentFixture</code> to return.
803 * @param extension the <code>ComponentFixtureExtension</code> that creates the <code>ComponentFixture</code> to
804 * return.
805 * @return a <code>ComponentFixture</code> managing a component inside this fixture's <code>Container</code>.
806 */
807 <C extends Component, F extends ComponentFixture<C>> F with(ComponentFixtureExtension<C, F> extension);
808 }