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