|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| JMenuChildrenFinder | Line # 38 | 3 | 0% | 2 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* | |
| 2 | * Created on Oct 22, 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.hierarchy; | |
| 17 | ||
| 18 | import static java.util.Collections.emptyList; | |
| 19 | import static org.fest.util.Collections.list; | |
| 20 | ||
| 21 | import java.awt.Component; | |
| 22 | import java.awt.Container; | |
| 23 | import java.util.Collection; | |
| 24 | ||
| 25 | import javax.swing.JMenu; | |
| 26 | ||
| 27 | import org.fest.swing.annotation.RunsInCurrentThread; | |
| 28 | ||
| 29 | /** | |
| 30 | * Understands how to find children components in a <code>{@link JMenu}</code>. | |
| 31 | * <p> | |
| 32 | * <b>Note:</b> Methods in this class are <b>not</b> executed in the event dispatch thread (EDT.) Clients are | |
| 33 | * responsible for invoking them in the EDT. | |
| 34 | * </p> | |
| 35 | * | |
| 36 | * @author Yvonne Wang | |
| 37 | */ | |
| 38 | final class JMenuChildrenFinder implements ChildrenFinderStrategy { | |
| 39 | ||
| 40 | 106840 |
@RunsInCurrentThread |
| 41 | public Collection<Component> nonExplicitChildrenOf(Container c) { | |
| 42 | 106815 | if (!(c instanceof JMenu)) return emptyList(); |
| 43 | 25 | return list((Component)((JMenu)c).getPopupMenu()); |
| 44 | } | |
| 45 | } | |
|
||||||||||||