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
5   83   6   0.83
0   21   1.2   6
6     1  
1    
 
  AbstractComponentMatcher       Line # 28 5 0% 6 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Oct 19, 2008
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 @2008-2010 the original author or authors.
15    */
16    package org.fest.swing.core;
17   
18    import java.awt.Component;
19   
20    import org.fest.swing.annotation.RunsInCurrentThread;
21   
22    /**
23    * Understands a base class for implementations of <code>{@link ResettableComponentMatcher}</code>.
24    *
25    * @author Yvonne Wang
26    * @author Alex Ruiz
27    */
 
28    public abstract class AbstractComponentMatcher implements ResettableComponentMatcher {
29   
30    private boolean requireShowing;
31   
32    /**
33    * Creates a new </code>{@link AbstractComponentMatcher}</code>.
34    */
 
35  3 toggle public AbstractComponentMatcher() {
36  3 this(false);
37    }
38   
39    /**
40    * Creates a new </code>{@link AbstractComponentMatcher}</code>.
41    * @param requireShowing indicates if the component to match should be showing or not.
42    */
 
43  1963 toggle public AbstractComponentMatcher(boolean requireShowing) {
44  1963 requireShowing(requireShowing);
45    }
46   
47    /**
48    * Indicates whether the component to match has to be showing.
49    * @return <code>true</code> if the component to find has to be showing, <code>false</code> otherwise.
50    */
 
51  5848 toggle protected final boolean requireShowing() { return requireShowing; }
52   
53    /**
54    * Updates the value of the flag that indicates if the component to match should be showing or not.
55    * @param shouldBeShowing the new value to set.
56    */
 
57  1999 toggle protected final void requireShowing(boolean shouldBeShowing) {
58  1999 requireShowing = shouldBeShowing;
59    }
60   
61    /**
62    * Indicates if the value of the "showing" property of the given component matches the value specified in this
63    * matcher.
64    * <p>
65    * <b>Note:</b> This method is <b>not</b> guaranteed to be executed in the event dispatch thread (EDT.) Clients are
66    * responsible for calling this method from the EDT.
67    * </p>
68    * @param c the component to verify.
69    * @return <code>true</code> if the value of the "isShowing" property of the given component matches the value
70    * specified in this matcher, <code>false</code> otherwise.
71    */
 
72  1062 toggle @RunsInCurrentThread
73    protected final boolean requireShowingMatches(Component c) {
74  1062 return !requireShowing || c.isShowing();
75    }
76   
77    /**
78    * Resets the internal state of this matcher.
79    * @param matchFound indicates whether a match has been found before resetting.
80    * @since 1.2
81    */
 
82  7305 toggle public void reset(boolean matchFound) {}
83    }