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   94   7   1.29
0   28   0.78   7
7     1  
1    
 
  FrameFinder       Line # 32 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.*;
19    import java.util.concurrent.TimeUnit;
20   
21    import org.fest.swing.core.GenericTypeMatcher;
22    import org.fest.swing.core.Robot;
23    import org.fest.swing.fixture.FrameFixture;
24   
25    /**
26    * Understands a finder for <code>{@link Frame}</code>s. This class cannot be used directly, please see
27    * <code>{@link WindowFinder}</code>.
28    *
29    * @author Alex Ruiz
30    * @author Yvonne Wang
31    */
 
32    public class FrameFinder extends WindowFinderTemplate<Frame> {
33   
34    /**
35    * Creates a new </code>{@link FrameFinder}</code>.
36    * @param frameName the name of the {@code Frame} to look for.
37    */
 
38  8 toggle protected FrameFinder(String frameName) {
39  8 super(frameName, Frame.class);
40    }
41   
42    /**
43    * Creates a new </code>{@link FrameFinder}</code>.
44    * @param matcher specifies the search criteria to use when looking up a {@code Frame}.
45    */
 
46  9 toggle protected FrameFinder(GenericTypeMatcher<? extends Frame> matcher) {
47  9 super(matcher);
48    }
49   
50    /**
51    * Creates a new </code>{@link FrameFinder}</code>.
52    * @param frameType the type of {@code Frame} to look for.
53    */
 
54  6 toggle protected FrameFinder(Class<? extends Frame> frameType) {
55  6 super(frameType);
56    }
57   
58    /**
59    * Sets the timeout for this finder. The window to search should be found within the given time period.
60    * @param timeout the number of milliseconds before stopping the search.
61    * @return this finder.
62    */
 
63  10 toggle @Override public FrameFinder withTimeout(long timeout) {
64  10 super.withTimeout(timeout);
65  7 return this;
66    }
67   
68    /**
69    * Sets the timeout for this finder. The window to search should be found within the given time period.
70    * @param timeout the period of time the search should be performed.
71    * @param unit the time unit for <code>timeout</code>.
72    * @return this finder.
73    */
 
74  6 toggle @Override public FrameFinder withTimeout(long timeout, TimeUnit unit) {
75  6 super.withTimeout(timeout, unit);
76  3 return this;
77    }
78   
79    /**
80    * Finds a <code>{@link Frame}</code> by name or type.
81    * @param robot contains the underlying finding to delegate the search to.
82    * @return a <code>FrameFixture</code> managing the found <code>Frame</code>.
83    * @throws org.fest.swing.exception.WaitTimedOutError if a <code>Frame</code> could not be found.
84    */
 
85  17 toggle public FrameFixture using(Robot robot) {
86  17 return new FrameFixture(robot, findComponentWith(robot));
87    }
88   
89    /**
90    * Casts the given {@code Component} to <code>{@link Frame}</code>.
91    * @return the given {@code Component}, casted to {@code Frame}.
92    */
 
93  13 toggle protected Frame cast(Component c) { return (Frame) c; }
94    }