Clover Coverage Report - FEST Swing 1.2
Coverage timestamp: Tue Jun 1 2010 15:19:25 PDT
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
9   95   7   1.29
0   29   0.78   7
7     1  
1    
 
  DialogFinder       Line # 33 9 0% 7 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Jul 31, 2007
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5    * in compliance with the License. You may obtain a copy of the License at
6    *
7    * http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software distributed under the License
10    * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11    * or implied. See the License for the specific language governing permissions and limitations under
12    * the License.
13    *
14    * Copyright @2007-2010 the original author or authors.
15    */
16    package org.fest.swing.finder;
17   
18    import java.awt.Component;
19    import java.awt.Dialog;
20    import java.util.concurrent.TimeUnit;
21   
22    import org.fest.swing.core.GenericTypeMatcher;
23    import org.fest.swing.core.Robot;
24    import org.fest.swing.fixture.DialogFixture;
25   
26    /**
27    * Understands a finder for <code>{@link Dialog}</code>s. This class cannot be used directly, please see
28    * <code>{@link WindowFinder}</code>.
29    *
30    * @author Yvonne Wang
31    * @author Alex Ruiz
32    */
 
33    public class DialogFinder extends WindowFinderTemplate<Dialog> {
34   
35    /**
36    * Creates a new </code>{@link DialogFinder}</code>.
37    * @param dialogName the name of the {@code Dialog} to look for.
38    */
 
39  6 toggle protected DialogFinder(String dialogName) {
40  6 super(dialogName, Dialog.class);
41    }
42   
43    /**
44    * Creates a new </code>{@link DialogFinder}</code>.
45    * @param matcher specifies the search criteria to use when looking up a {@code Dialog}.
46    */
 
47  8 toggle protected DialogFinder(GenericTypeMatcher<? extends Dialog> matcher) {
48  8 super(matcher);
49    }
50   
51    /**
52    * Creates a new </code>{@link DialogFinder}</code>.
53    * @param dialogType the type of {@code Dialog} to look for.
54    */
 
55  8 toggle protected DialogFinder(Class<? extends Dialog> dialogType) {
56  8 super(dialogType);
57    }
58   
59    /**
60    * Sets the timeout for this finder. The window to search should be found within the given time period.
61    * @param timeout the number of milliseconds before stopping the search.
62    * @return this finder.
63    */
 
64  9 toggle @Override public DialogFinder withTimeout(long timeout) {
65  9 super.withTimeout(timeout);
66  6 return this;
67    }
68   
69    /**
70    * Sets the timeout for this finder. The window to search should be found within the given time period.
71    * @param timeout the period of time the search should be performed.
72    * @param unit the time unit for <code>timeout</code>.
73    * @return this finder.
74    */
 
75  6 toggle @Override public DialogFinder withTimeout(long timeout, TimeUnit unit) {
76  6 super.withTimeout(timeout, unit);
77  3 return this;
78    }
79   
80    /**
81    * Finds a <code>{@link Dialog}</code> by name or type.
82    * @param robot contains the underlying finding to delegate the search to.
83    * @return a <code>DialogFixture</code> managing the found <code>Dialog</code>.
84    * @throws org.fest.swing.exception.WaitTimedOutError if a <code>Dialog</code> could not be found.
85    */
 
86  16 toggle public DialogFixture using(Robot robot) {
87  16 return new DialogFixture(robot, findComponentWith(robot));
88    }
89   
90    /**
91    * Casts the given {@code Component} to <code>{@link Dialog}</code>.
92    * @return the given {@code Component}, casted to {@code Dialog}.
93    */
 
94  13 toggle protected Dialog cast(Component c) { return (Dialog)c; }
95    }