|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ComponentLookupScope | Line # 23 | 2 | 0% | 2 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* | |
| 2 | * Created on Jan 7, 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 | /** | |
| 19 | * Understands scopes of GUI component lookup. | |
| 20 | * | |
| 21 | * @author Alex Ruiz | |
| 22 | */ | |
| 23 | public enum ComponentLookupScope { | |
| 24 | ||
| 25 | /** | |
| 26 | * For most of the cases, only GUI components that are being shown on the screen participate in a component lookup. | |
| 27 | * Currently, the only exception is <code>{@link javax.swing.JMenuItem}</code>, which participates in a component | |
| 28 | * lookup regardless if it is showing or not. | |
| 29 | */ | |
| 30 | DEFAULT(true), | |
| 31 | ||
| 32 | /** All GUI components participate in a component lookup, regardless if they are being shown on the screen or not. */ | |
| 33 | ALL(false), | |
| 34 | ||
| 35 | /** Only components that are being shown on the screen can participate in a component lookup. */ | |
| 36 | SHOWING_ONLY(true); | |
| 37 | ||
| 38 | private final boolean requireShowing; | |
| 39 | ||
| 40 | 1782 |
private ComponentLookupScope(boolean requireShowing) { |
| 41 | 1782 | this.requireShowing = requireShowing; |
| 42 | } | |
| 43 | ||
| 44 | /** | |
| 45 | * Returns whether showing components are the only ones participating in component lookups. | |
| 46 | * @return <code>true</code> if only showing components participate in component lookups; <code>false</code> if | |
| 47 | * any component (showing or not showing) can participate in component lookup. | |
| 48 | */ | |
| 49 | 280 |
public boolean requireShowing() { return requireShowing; } |
| 50 | } | |
|
||||||||||||