1 | package com.jsql.view.swing.shadow; | |
2 | ||
3 | /* | |
4 | * Copyright (c) 2007-2013 JGoodies Software GmbH. All Rights Reserved. | |
5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * o Redistributions of source code must retain the above copyright notice, | |
10 | * this list of conditions and the following disclaimer. | |
11 | * | |
12 | * o Redistributions in binary form must reproduce the above copyright notice, | |
13 | * this list of conditions and the following disclaimer in the documentation | |
14 | * and/or other materials provided with the distribution. | |
15 | * | |
16 | * o Neither the name of JGoodies Software GmbH nor the names of | |
17 | * its contributors may be used to endorse or promote products derived | |
18 | * from this software without specific prior written permission. | |
19 | * | |
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
24 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
25 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
26 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | |
32 | ||
33 | import com.jsql.util.LogLevelUtil; | |
34 | import org.apache.logging.log4j.LogManager; | |
35 | import org.apache.logging.log4j.Logger; | |
36 | ||
37 | import javax.swing.*; | |
38 | import javax.swing.border.Border; | |
39 | import java.awt.*; | |
40 | import java.awt.image.BufferedImage; | |
41 | import java.util.ArrayList; | |
42 | import java.util.List; | |
43 | ||
44 | /** | |
45 | * Does all the magic for getting popups with drop shadows. | |
46 | * It adds the drop shadow border to the Popup, | |
47 | * in {@code #show} it snapshots the screen background as needed, | |
48 | * and in {@code #hide} it cleans up all changes made before. | |
49 | * | |
50 | * @author Karsten Lentzsch | |
51 | * @version $Revision: 1.12 $ | |
52 | * | |
53 | * see com.jgoodies.looks.common.ShadowPopupBorder | |
54 | * see com.jgoodies.looks.common.ShadowPopupFactory | |
55 | */ | |
56 | public final class ShadowPopup extends Popup { | |
57 | | |
58 | /** | |
59 | * Log4j logger sent to view. | |
60 | */ | |
61 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
62 | ||
63 | /** | |
64 | * Max number of items to store in the cache. | |
65 | */ | |
66 | private static final int MAX_CACHE_SIZE = 5; | |
67 | ||
68 | /** | |
69 | * The cache to use for ShadowPopups. | |
70 | */ | |
71 | private static List<ShadowPopup> cache; | |
72 | ||
73 | /** | |
74 | * The singleton instance used to draw all borders. | |
75 | */ | |
76 | private static final Border SHADOW_BORDER = ShadowPopupBorder.getInstance(); | |
77 | ||
78 | /** | |
79 | * The size of the drop shadow. | |
80 | */ | |
81 | private static final int SHADOW_SIZE = 5; | |
82 | ||
83 | /** | |
84 | * The component mouse coordinates are relative to, may be null. | |
85 | */ | |
86 | private Component owner; | |
87 | ||
88 | /** | |
89 | * The contents of the popup. | |
90 | */ | |
91 | private Component contents; | |
92 | ||
93 | /** | |
94 | * The desired x and y location of the popup. | |
95 | */ | |
96 | private int x; | |
97 | private int y; | |
98 | ||
99 | /** | |
100 | * The real popup. The #show() and #hide() methods will delegate | |
101 | * all calls to these popup. | |
102 | */ | |
103 | private Popup popup; | |
104 | ||
105 | /** | |
106 | * The border of the contents' parent replaced by SHADOW_BORDER. | |
107 | */ | |
108 | private Border oldBorder; | |
109 | ||
110 | /** | |
111 | * The old value of the opaque property of the contents' parent. | |
112 | */ | |
113 | private boolean oldOpaque; | |
114 | ||
115 | /** | |
116 | * The heavyweight container of the popup contents, may be null. | |
117 | */ | |
118 | private Container heavyWeightContainer; | |
119 | ||
120 | /** | |
121 | * The 'scratch pad' objects used to calculate dirty regions of | |
122 | * the screen snapshots. | |
123 | * | |
124 | * @see #snapshot() | |
125 | */ | |
126 | private static final Point POINT = new Point(); | |
127 | private static final Rectangle RECT = new Rectangle(); | |
128 | ||
129 | /** | |
130 | * Returns a previously used {@code ShadowPopup}, or a new one | |
131 | * if none of the popups have been recycled. | |
132 | */ | |
133 | public static Popup getInstance(Component owner, Component contents, int x, int y, Popup delegate) { | |
134 | | |
135 | ShadowPopup result; | |
136 | | |
137 | synchronized (ShadowPopup.class) { | |
138 | | |
139 |
1
1. getInstance : negated conditional → NO_COVERAGE |
if (cache == null) { |
140 | cache = new ArrayList<>(MAX_CACHE_SIZE); | |
141 | } | |
142 | | |
143 |
1
1. getInstance : negated conditional → NO_COVERAGE |
if (!cache.isEmpty()) { |
144 | result = cache.remove(0); | |
145 | } else { | |
146 | result = new ShadowPopup(); | |
147 | } | |
148 | } | |
149 | | |
150 |
1
1. getInstance : removed call to com/jsql/view/swing/shadow/ShadowPopup::reset → NO_COVERAGE |
result.reset(owner, contents, x, y, delegate); |
151 | | |
152 |
1
1. getInstance : replaced return value with null for com/jsql/view/swing/shadow/ShadowPopup::getInstance → NO_COVERAGE |
return result; |
153 | } | |
154 | ||
155 | /** | |
156 | * Recycles the ShadowPopup. | |
157 | */ | |
158 | private static void recycle(ShadowPopup popup) { | |
159 | synchronized (ShadowPopup.class) { | |
160 |
2
1. recycle : changed conditional boundary → NO_COVERAGE 2. recycle : negated conditional → NO_COVERAGE |
if (cache.size() < MAX_CACHE_SIZE) { |
161 | cache.add(popup); | |
162 | } | |
163 | } | |
164 | } | |
165 | ||
166 | /** | |
167 | * Hides and disposes of the {@code Popup}. Once a {@code Popup} | |
168 | * has been disposed you should no longer invoke methods on it. A | |
169 | * {@code dispose}d {@code Popup} may be reclaimed and later used | |
170 | * based on the {@code PopupFactory}. As such, if you invoke methods | |
171 | * on a {@code disposed} {@code Popup}, indeterminate | |
172 | * behavior will result.<p> | |
173 | * | |
174 | * In addition to the superclass behavior, we reset the stored | |
175 | * horizontal and vertical drop shadows - if any. | |
176 | */ | |
177 | @Override | |
178 | public void hide() { | |
179 | | |
180 |
1
1. hide : negated conditional → NO_COVERAGE |
if (this.contents == null) { |
181 | return; | |
182 | } | |
183 | ||
184 | JComponent parent = (JComponent) this.contents.getParent(); | |
185 |
1
1. hide : removed call to javax/swing/Popup::hide → NO_COVERAGE |
this.popup.hide(); |
186 | | |
187 |
2
1. hide : negated conditional → NO_COVERAGE 2. hide : negated conditional → NO_COVERAGE |
if (parent != null && SHADOW_BORDER.equals(parent.getBorder())) { |
188 | | |
189 |
1
1. hide : removed call to javax/swing/JComponent::setBorder → NO_COVERAGE |
parent.setBorder(this.oldBorder); |
190 |
1
1. hide : removed call to javax/swing/JComponent::setOpaque → NO_COVERAGE |
parent.setOpaque(this.oldOpaque); |
191 | this.oldBorder = null; | |
192 | | |
193 |
1
1. hide : negated conditional → NO_COVERAGE |
if (this.heavyWeightContainer != null) { |
194 | | |
195 |
1
1. hide : removed call to javax/swing/JComponent::putClientProperty → NO_COVERAGE |
parent.putClientProperty(ShadowPopupFactory.PROP_HORIZONTAL_BACKGROUND, null); |
196 |
1
1. hide : removed call to javax/swing/JComponent::putClientProperty → NO_COVERAGE |
parent.putClientProperty(ShadowPopupFactory.PROP_VERTICAL_BACKGROUND, null); |
197 | this.heavyWeightContainer = null; | |
198 | } | |
199 | } | |
200 | | |
201 | this.owner = null; | |
202 | this.contents = null; | |
203 | this.popup = null; | |
204 | | |
205 |
1
1. hide : removed call to com/jsql/view/swing/shadow/ShadowPopup::recycle → NO_COVERAGE |
recycle(this); |
206 | } | |
207 | ||
208 | /** | |
209 | * Makes the {@code Popup} visible. If the popup has a | |
210 | * heavy-weight container, we try to snapshot the background. | |
211 | * If the {@code Popup} is currently visible, it remains visible. | |
212 | */ | |
213 | @Override | |
214 | public void show() { | |
215 | | |
216 |
1
1. show : negated conditional → NO_COVERAGE |
if (this.heavyWeightContainer != null) { |
217 |
1
1. show : removed call to com/jsql/view/swing/shadow/ShadowPopup::snapshot → NO_COVERAGE |
this.snapshot(); |
218 | } | |
219 | ||
220 | // Fix #95477: IllegalArgumentException on show() | |
221 | try { | |
222 |
1
1. show : removed call to javax/swing/Popup::show → NO_COVERAGE |
this.popup.show(); |
223 | } catch (IllegalArgumentException e) { | |
224 | LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e.getMessage(), e); | |
225 | } | |
226 | } | |
227 | ||
228 | /** | |
229 | * Reinitializes this ShadowPopup using the given parameters. | |
230 | * | |
231 | * @param owner component mouse coordinates are relative to, may be null | |
232 | * @param contents the contents of the popup | |
233 | * @param x the desired x location of the popup | |
234 | * @param y the desired y location of the popup | |
235 | * @param popup the popup to wrap | |
236 | */ | |
237 | private void reset( | |
238 | Component owner, Component contents, int x, int y, | |
239 | Popup popup | |
240 | ) { | |
241 | | |
242 | this.owner = owner; | |
243 | this.contents = contents; | |
244 | this.popup = popup; | |
245 | this.x = x; | |
246 | this.y = y; | |
247 | | |
248 | // Do not install the shadow border when the contents | |
249 | // has a preferred size less than or equal to 0. | |
250 | // We can't use the size, because it is(0, 0) for new popups. | |
251 | var contentsPrefSize = new Dimension(); | |
252 | | |
253 | // Fix #4172: NullPointerException on getPreferredSize() | |
254 | // Implementation by javax.swing.plaf.metal.MetalToolTipUI.getPreferredSize() | |
255 | try { | |
256 | contentsPrefSize = contents.getPreferredSize(); | |
257 | } catch(NullPointerException e) { | |
258 | LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e); | |
259 | } | |
260 | | |
261 |
4
1. reset : negated conditional → NO_COVERAGE 2. reset : changed conditional boundary → NO_COVERAGE 3. reset : negated conditional → NO_COVERAGE 4. reset : changed conditional boundary → NO_COVERAGE |
if (contentsPrefSize.width <= 0 || contentsPrefSize.height <= 0) { |
262 | return; | |
263 | } | |
264 | | |
265 |
1
1. reset : negated conditional → NO_COVERAGE |
for (Container p = contents.getParent() ; p != null ; p = p.getParent()) { |
266 |
2
1. reset : negated conditional → NO_COVERAGE 2. reset : negated conditional → NO_COVERAGE |
if (p instanceof JWindow || p instanceof Panel) { |
267 | | |
268 | // Workaround for the gray rect problem. | |
269 |
1
1. reset : removed call to java/awt/Container::setBackground → NO_COVERAGE |
p.setBackground(contents.getBackground()); |
270 | this.heavyWeightContainer = p; | |
271 | | |
272 | break; | |
273 | } | |
274 | } | |
275 | | |
276 | JComponent parent = (JComponent) contents.getParent(); | |
277 | this.oldOpaque = parent.isOpaque(); | |
278 | this.oldBorder = parent.getBorder(); | |
279 |
1
1. reset : removed call to javax/swing/JComponent::setOpaque → NO_COVERAGE |
parent.setOpaque(false); |
280 |
1
1. reset : removed call to javax/swing/JComponent::setBorder → NO_COVERAGE |
parent.setBorder(SHADOW_BORDER); |
281 | | |
282 | // Pack it because we have changed the border. | |
283 |
1
1. reset : negated conditional → NO_COVERAGE |
if (this.heavyWeightContainer != null) { |
284 |
1
1. reset : removed call to java/awt/Container::setSize → NO_COVERAGE |
this.heavyWeightContainer.setSize(this.heavyWeightContainer.getPreferredSize()); |
285 | } else { | |
286 |
1
1. reset : removed call to javax/swing/JComponent::setSize → NO_COVERAGE |
parent.setSize(parent.getPreferredSize()); |
287 | } | |
288 | } | |
289 | ||
290 | /** | |
291 | * Snapshots the background. The snapshots are stored as client | |
292 | * properties of the contents' parent. The next time the border is drawn, | |
293 | * this background will be used.<p> | |
294 | * | |
295 | * Uses a robot on the default screen device to capture the screen | |
296 | * region under the drop shadow. Does <em>not</em> use the window's | |
297 | * device, because that may be an outdated device (due to popup reuse) | |
298 | * and the robot's origin seems to be adjusted with the default screen | |
299 | * device. | |
300 | * | |
301 | * @see #show() | |
302 | * see com.jgoodies.looks.common.ShadowPopupBorder | |
303 | * @see Robot#createScreenCapture(Rectangle) | |
304 | */ | |
305 | private void snapshot() { | |
306 | try { | |
307 | Dimension size = this.heavyWeightContainer.getPreferredSize(); | |
308 | int width = size.width; | |
309 | int height = size.height; | |
310 | ||
311 | // Avoid unnecessary and illegal screen captures | |
312 | // for degenerated popups. | |
313 |
4
1. snapshot : negated conditional → NO_COVERAGE 2. snapshot : changed conditional boundary → NO_COVERAGE 3. snapshot : changed conditional boundary → NO_COVERAGE 4. snapshot : negated conditional → NO_COVERAGE |
if (width <= 0 || height <= SHADOW_SIZE) { |
314 | return; | |
315 | } | |
316 | ||
317 | var robot = new Robot(); // uses the default screen device | |
318 | ||
319 |
3
1. snapshot : Replaced integer subtraction with addition → NO_COVERAGE 2. snapshot : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE 3. snapshot : Replaced integer addition with subtraction → NO_COVERAGE |
RECT.setBounds(this.x, this.y + height - SHADOW_SIZE, width, SHADOW_SIZE); |
320 | BufferedImage hShadowBg = robot.createScreenCapture(RECT); | |
321 | ||
322 |
4
1. snapshot : Replaced integer subtraction with addition → NO_COVERAGE 2. snapshot : Replaced integer subtraction with addition → NO_COVERAGE 3. snapshot : Replaced integer addition with subtraction → NO_COVERAGE 4. snapshot : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE |
RECT.setBounds(this.x + width - SHADOW_SIZE, this.y, SHADOW_SIZE, height - SHADOW_SIZE); |
323 | BufferedImage vShadowBg = robot.createScreenCapture(RECT); | |
324 | ||
325 | JComponent parent = (JComponent) this.contents.getParent(); | |
326 |
1
1. snapshot : removed call to javax/swing/JComponent::putClientProperty → NO_COVERAGE |
parent.putClientProperty(ShadowPopupFactory.PROP_HORIZONTAL_BACKGROUND, hShadowBg); |
327 |
1
1. snapshot : removed call to javax/swing/JComponent::putClientProperty → NO_COVERAGE |
parent.putClientProperty(ShadowPopupFactory.PROP_VERTICAL_BACKGROUND, vShadowBg); |
328 | ||
329 | Container layeredPane = this.getLayeredPane(); | |
330 |
1
1. snapshot : negated conditional → NO_COVERAGE |
if (layeredPane == null) { |
331 | return; // This could happen if owner is null. | |
332 | } | |
333 | ||
334 | int layeredPaneWidth = layeredPane.getWidth(); | |
335 | int layeredPaneHeight = layeredPane.getHeight(); | |
336 | ||
337 | POINT.x = this.x; | |
338 | POINT.y = this.y; | |
339 |
1
1. snapshot : removed call to javax/swing/SwingUtilities::convertPointFromScreen → NO_COVERAGE |
SwingUtilities.convertPointFromScreen(POINT, layeredPane); |
340 | ||
341 |
1
1. snapshot : removed call to com/jsql/view/swing/shadow/ShadowPopup::paintHorizontalSnapshot → NO_COVERAGE |
this.paintHorizontalSnapshot(width, height, hShadowBg, layeredPane, layeredPaneWidth, layeredPaneHeight); |
342 | ||
343 |
1
1. snapshot : removed call to com/jsql/view/swing/shadow/ShadowPopup::paintVerticalSnapshot → NO_COVERAGE |
this.paintVerticalSnapshot(width, height, vShadowBg, layeredPane, layeredPaneWidth, layeredPaneHeight); |
344 | | |
345 | } catch (AWTException | SecurityException | IllegalArgumentException e) { | |
346 | LOGGER.log(LogLevelUtil.IGNORE, e); | |
347 | } | |
348 | } | |
349 | ||
350 | private void paintVerticalSnapshot(int width, int height, BufferedImage vShadowBg, Container layeredPane, int layeredPaneWidth, int layeredPaneHeight) { | |
351 | | |
352 | // If needed paint dirty region of the vertical snapshot. | |
353 |
2
1. paintVerticalSnapshot : Replaced integer addition with subtraction → NO_COVERAGE 2. paintVerticalSnapshot : Replaced integer subtraction with addition → NO_COVERAGE |
RECT.x = POINT.x + width - SHADOW_SIZE; |
354 | RECT.y = POINT.y; | |
355 | RECT.width = SHADOW_SIZE; | |
356 |
1
1. paintVerticalSnapshot : Replaced integer subtraction with addition → NO_COVERAGE |
RECT.height = height - SHADOW_SIZE; |
357 | ||
358 |
1
1. paintVerticalSnapshot : removed call to com/jsql/view/swing/shadow/ShadowPopup::extracted → NO_COVERAGE |
this.extracted(vShadowBg, layeredPane, layeredPaneWidth, layeredPaneHeight); |
359 | } | |
360 | ||
361 | private void paintHorizontalSnapshot(int width, int height, BufferedImage hShadowBg, Container layeredPane, int layeredPaneWidth, int layeredPaneHeight) { | |
362 | | |
363 | // If needed paint dirty region of the horizontal snapshot. | |
364 | RECT.x = POINT.x; | |
365 |
2
1. paintHorizontalSnapshot : Replaced integer addition with subtraction → NO_COVERAGE 2. paintHorizontalSnapshot : Replaced integer subtraction with addition → NO_COVERAGE |
RECT.y = POINT.y + height - SHADOW_SIZE; |
366 | RECT.width = width; | |
367 | RECT.height = SHADOW_SIZE; | |
368 | ||
369 |
1
1. paintHorizontalSnapshot : removed call to com/jsql/view/swing/shadow/ShadowPopup::extracted → NO_COVERAGE |
this.extracted(hShadowBg, layeredPane, layeredPaneWidth, layeredPaneHeight); |
370 | } | |
371 | ||
372 | private void extracted(BufferedImage shadowBg, Container layeredPane, int layeredPaneWidth, int layeredPaneHeight) { | |
373 | | |
374 |
3
1. extracted : Replaced integer addition with subtraction → NO_COVERAGE 2. extracted : negated conditional → NO_COVERAGE 3. extracted : changed conditional boundary → NO_COVERAGE |
if ((RECT.x + RECT.width) > layeredPaneWidth) { |
375 |
1
1. extracted : Replaced integer subtraction with addition → NO_COVERAGE |
RECT.width = layeredPaneWidth - RECT.x; |
376 | } | |
377 | | |
378 |
3
1. extracted : negated conditional → NO_COVERAGE 2. extracted : changed conditional boundary → NO_COVERAGE 3. extracted : Replaced integer addition with subtraction → NO_COVERAGE |
if ((RECT.y + RECT.height) > layeredPaneHeight) { |
379 |
1
1. extracted : Replaced integer subtraction with addition → NO_COVERAGE |
RECT.height = layeredPaneHeight - RECT.y; |
380 | } | |
381 | | |
382 |
1
1. extracted : negated conditional → NO_COVERAGE |
if (!RECT.isEmpty()) { |
383 | | |
384 | Graphics g = shadowBg.createGraphics(); | |
385 |
3
1. extracted : removed negation → NO_COVERAGE 2. extracted : removed negation → NO_COVERAGE 3. extracted : removed call to java/awt/Graphics::translate → NO_COVERAGE |
g.translate(-RECT.x, -RECT.y); |
386 |
1
1. extracted : removed call to java/awt/Graphics::setClip → NO_COVERAGE |
g.setClip(RECT); |
387 | | |
388 |
1
1. extracted : negated conditional → NO_COVERAGE |
if (layeredPane instanceof JComponent) { |
389 | | |
390 | JComponent c = (JComponent) layeredPane; | |
391 | boolean doubleBuffered = c.isDoubleBuffered(); | |
392 |
1
1. extracted : removed call to javax/swing/JComponent::setDoubleBuffered → NO_COVERAGE |
c.setDoubleBuffered(false); |
393 |
1
1. extracted : removed call to com/jsql/view/swing/shadow/ShadowPopup::paintAll → NO_COVERAGE |
ShadowPopup.paintAll(c, g); |
394 |
1
1. extracted : removed call to javax/swing/JComponent::setDoubleBuffered → NO_COVERAGE |
c.setDoubleBuffered(doubleBuffered); |
395 | | |
396 | } else { | |
397 |
1
1. extracted : removed call to java/awt/Container::paintAll → NO_COVERAGE |
layeredPane.paintAll(g); |
398 | } | |
399 | | |
400 |
1
1. extracted : removed call to java/awt/Graphics::dispose → NO_COVERAGE |
g.dispose(); |
401 | } | |
402 | } | |
403 | | |
404 | private static void paintAll(JComponent c, Graphics g) { | |
405 | // Fix #3127, Fix #6772, Fix #48907: Multiple Exceptions on paintAll() | |
406 | try { | |
407 |
1
1. paintAll : removed call to javax/swing/JComponent::paintAll → NO_COVERAGE |
c.paintAll(g); |
408 | } catch (IllegalArgumentException | ArrayIndexOutOfBoundsException | NullPointerException e) { | |
409 | LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e.getMessage(), e); | |
410 | } | |
411 | } | |
412 | ||
413 | /** | |
414 | * @return the top level layered pane which contains the owner. | |
415 | */ | |
416 | private Container getLayeredPane() { | |
417 | | |
418 | // The code below is copied from PopupFactory#LightWeightPopup#show() | |
419 | Container parent = null; | |
420 | | |
421 |
1
1. getLayeredPane : negated conditional → NO_COVERAGE |
if (this.owner != null) { |
422 |
1
1. getLayeredPane : negated conditional → NO_COVERAGE |
parent = this.owner instanceof Container |
423 | ? (Container) this.owner | |
424 | : this.owner.getParent(); | |
425 | } | |
426 | | |
427 | // Try to find a JLayeredPane and Window to add | |
428 |
1
1. getLayeredPane : negated conditional → NO_COVERAGE |
for (Container p = parent; p != null; p = p.getParent()) { |
429 |
1
1. getLayeredPane : negated conditional → NO_COVERAGE |
if (p instanceof JRootPane) { |
430 |
1
1. getLayeredPane : negated conditional → NO_COVERAGE |
if (!(p.getParent() instanceof JInternalFrame)) { |
431 | parent = ((JRootPane) p).getLayeredPane(); | |
432 | } | |
433 | // Continue, so that if there is a higher JRootPane, we'll | |
434 | // pick it up. | |
435 |
1
1. getLayeredPane : negated conditional → NO_COVERAGE |
} else if (p instanceof Window) { |
436 | | |
437 |
1
1. getLayeredPane : negated conditional → NO_COVERAGE |
if (parent == null) { |
438 | parent = p; | |
439 | } | |
440 | | |
441 | break; | |
442 | } | |
443 | } | |
444 | | |
445 |
1
1. getLayeredPane : replaced return value with null for com/jsql/view/swing/shadow/ShadowPopup::getLayeredPane → NO_COVERAGE |
return parent; |
446 | } | |
447 | } | |
Mutations | ||
139 |
1.1 |
|
143 |
1.1 |
|
150 |
1.1 |
|
152 |
1.1 |
|
160 |
1.1 2.2 |
|
180 |
1.1 |
|
185 |
1.1 |
|
187 |
1.1 2.2 |
|
189 |
1.1 |
|
190 |
1.1 |
|
193 |
1.1 |
|
195 |
1.1 |
|
196 |
1.1 |
|
205 |
1.1 |
|
216 |
1.1 |
|
217 |
1.1 |
|
222 |
1.1 |
|
261 |
1.1 2.2 3.3 4.4 |
|
265 |
1.1 |
|
266 |
1.1 2.2 |
|
269 |
1.1 |
|
279 |
1.1 |
|
280 |
1.1 |
|
283 |
1.1 |
|
284 |
1.1 |
|
286 |
1.1 |
|
313 |
1.1 2.2 3.3 4.4 |
|
319 |
1.1 2.2 3.3 |
|
322 |
1.1 2.2 3.3 4.4 |
|
326 |
1.1 |
|
327 |
1.1 |
|
330 |
1.1 |
|
339 |
1.1 |
|
341 |
1.1 |
|
343 |
1.1 |
|
353 |
1.1 2.2 |
|
356 |
1.1 |
|
358 |
1.1 |
|
365 |
1.1 2.2 |
|
369 |
1.1 |
|
374 |
1.1 2.2 3.3 |
|
375 |
1.1 |
|
378 |
1.1 2.2 3.3 |
|
379 |
1.1 |
|
382 |
1.1 |
|
385 |
1.1 2.2 3.3 |
|
386 |
1.1 |
|
388 |
1.1 |
|
392 |
1.1 |
|
393 |
1.1 |
|
394 |
1.1 |
|
397 |
1.1 |
|
400 |
1.1 |
|
407 |
1.1 |
|
421 |
1.1 |
|
422 |
1.1 |
|
428 |
1.1 |
|
429 |
1.1 |
|
430 |
1.1 |
|
435 |
1.1 |
|
437 |
1.1 |
|
445 |
1.1 |