1 | package com.jsql.view.swing.panel.util; | |
2 | ||
3 | import javax.swing.*; | |
4 | import javax.swing.plaf.UIResource; | |
5 | import javax.swing.plaf.metal.MetalLookAndFeel; | |
6 | import java.awt.*; | |
7 | import java.io.Serializable; | |
8 | ||
9 | public class RadioMenuItemIconCustom implements Icon, UIResource, Serializable { | |
10 | | |
11 | public void paintOceanIcon(Component c, Graphics g, int x, int y) { | |
12 | ||
13 | // Fix #95383, NullPointerException on c.getModel() | |
14 |
1
1. paintOceanIcon : negated conditional → NO_COVERAGE |
if (c == null) { |
15 | return; | |
16 | } | |
17 | ||
18 | ButtonModel model = ((AbstractButton) c).getModel(); | |
19 | boolean isSelected = model.isSelected(); | |
20 | boolean isEnabled = model.isEnabled(); | |
21 | boolean isPressed = model.isPressed(); | |
22 | boolean isArmed = model.isArmed(); | |
23 | ||
24 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::translate → NO_COVERAGE |
g.translate(x, y); |
25 | ||
26 |
1
1. paintOceanIcon : negated conditional → NO_COVERAGE |
if (isEnabled) { |
27 | | |
28 |
2
1. paintOceanIcon : negated conditional → NO_COVERAGE 2. paintOceanIcon : negated conditional → NO_COVERAGE |
if (isPressed || isArmed) { |
29 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(MetalLookAndFeel.getPrimaryControl()); |
30 | } else { | |
31 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(MetalLookAndFeel.getControlHighlight()); |
32 | } | |
33 | | |
34 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(2, 9, 7, 9); |
35 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(9, 2, 9, 7); |
36 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(8, 8, 8, 8); |
37 | ||
38 |
2
1. paintOceanIcon : negated conditional → NO_COVERAGE 2. paintOceanIcon : negated conditional → NO_COVERAGE |
if (isPressed || isArmed) { |
39 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(MetalLookAndFeel.getControlInfo()); |
40 | } else { | |
41 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(MetalLookAndFeel.getControlDarkShadow()); |
42 | } | |
43 | } else { | |
44 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor( MetalLookAndFeel.getMenuDisabledForeground() ); |
45 | } | |
46 | ||
47 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(2, 0, 6, 0); |
48 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(2, 8, 6, 8); |
49 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(0, 2, 0, 6); |
50 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(8, 2, 8, 6); |
51 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(1, 1, 1, 1); |
52 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(7, 1, 7, 1); |
53 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(1, 7, 1, 7); |
54 |
1
1. paintOceanIcon : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(7, 7, 7, 7); |
55 | ||
56 |
1
1. paintOceanIcon : negated conditional → NO_COVERAGE |
if (isSelected) { |
57 |
1
1. paintOceanIcon : removed call to com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::drawSelected → NO_COVERAGE |
this.drawSelected(c, g, model, isEnabled, isArmed); |
58 | } | |
59 | ||
60 |
3
1. paintOceanIcon : removed call to java/awt/Graphics::translate → NO_COVERAGE 2. paintOceanIcon : removed negation → NO_COVERAGE 3. paintOceanIcon : removed negation → NO_COVERAGE |
g.translate(-x, -y); |
61 | } | |
62 | ||
63 | private void drawSelected(Component c, Graphics g, ButtonModel model, boolean isEnabled, boolean isArmed) { | |
64 | | |
65 |
1
1. drawSelected : negated conditional → NO_COVERAGE |
if (isEnabled) { |
66 |
2
1. drawSelected : negated conditional → NO_COVERAGE 2. drawSelected : negated conditional → NO_COVERAGE |
if ( |
67 | isArmed | |
68 |
1
1. drawSelected : negated conditional → NO_COVERAGE |
|| (c instanceof JMenu && model.isSelected()) |
69 | ) { | |
70 |
1
1. drawSelected : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(MetalLookAndFeel.getMenuSelectedForeground()); |
71 | } else { | |
72 |
1
1. drawSelected : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(MetalLookAndFeel.getControlInfo()); |
73 | } | |
74 | } else { | |
75 |
1
1. drawSelected : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(MetalLookAndFeel.getMenuDisabledForeground()); |
76 | } | |
77 | | |
78 |
1
1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(3, 2, 5, 2); |
79 |
1
1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(2, 3, 6, 3); |
80 |
1
1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(2, 4, 6, 4); |
81 |
1
1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(2, 5, 6, 5); |
82 |
1
1. drawSelected : removed call to java/awt/Graphics::drawLine → NO_COVERAGE |
g.drawLine(3, 6, 5, 6); |
83 | } | |
84 | ||
85 | @Override | |
86 | public void paintIcon(Component c, Graphics g, int x, int y) { | |
87 |
1
1. paintIcon : removed call to com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::paintOceanIcon → NO_COVERAGE |
this.paintOceanIcon(c, g, x, y); |
88 | } | |
89 | ||
90 | @Override | |
91 | public int getIconWidth() { | |
92 |
1
1. getIconWidth : replaced int return with 0 for com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::getIconWidth → NO_COVERAGE |
return new Dimension(10, 10).width; |
93 | } | |
94 | ||
95 | @Override | |
96 | public int getIconHeight() { | |
97 |
1
1. getIconHeight : replaced int return with 0 for com/jsql/view/swing/panel/util/RadioMenuItemIconCustom::getIconHeight → NO_COVERAGE |
return new Dimension(10, 10).height; |
98 | } | |
99 | } | |
Mutations | ||
14 |
1.1 |
|
24 |
1.1 |
|
26 |
1.1 |
|
28 |
1.1 2.2 |
|
29 |
1.1 |
|
31 |
1.1 |
|
34 |
1.1 |
|
35 |
1.1 |
|
36 |
1.1 |
|
38 |
1.1 2.2 |
|
39 |
1.1 |
|
41 |
1.1 |
|
44 |
1.1 |
|
47 |
1.1 |
|
48 |
1.1 |
|
49 |
1.1 |
|
50 |
1.1 |
|
51 |
1.1 |
|
52 |
1.1 |
|
53 |
1.1 |
|
54 |
1.1 |
|
56 |
1.1 |
|
57 |
1.1 |
|
60 |
1.1 2.2 3.3 |
|
65 |
1.1 |
|
66 |
1.1 2.2 |
|
68 |
1.1 |
|
70 |
1.1 |
|
72 |
1.1 |
|
75 |
1.1 |
|
78 |
1.1 |
|
79 |
1.1 |
|
80 |
1.1 |
|
81 |
1.1 |
|
82 |
1.1 |
|
87 |
1.1 |
|
92 |
1.1 |
|
97 |
1.1 |