1 | package com.jsql.view.swing.panel.preferences; | |
2 | ||
3 | import com.jsql.util.LogLevelUtil; | |
4 | import com.jsql.view.swing.scrollpane.LightScrollPane; | |
5 | import com.jsql.view.swing.text.JPopupTextArea; | |
6 | import com.jsql.view.swing.text.JTextAreaPlaceholder; | |
7 | import com.jsql.view.swing.text.listener.DocumentListenerEditing; | |
8 | import com.jsql.view.swing.util.MediatorHelper; | |
9 | import com.jsql.view.swing.util.UiUtil; | |
10 | import org.apache.logging.log4j.LogManager; | |
11 | import org.apache.logging.log4j.Logger; | |
12 | ||
13 | import javax.swing.*; | |
14 | import java.awt.*; | |
15 | import java.io.BufferedReader; | |
16 | import java.io.IOException; | |
17 | import java.io.InputStreamReader; | |
18 | import java.nio.charset.StandardCharsets; | |
19 | import java.util.Objects; | |
20 | import java.util.stream.Stream; | |
21 | ||
22 | public class PanelUserAgent extends JPanel { | |
23 | | |
24 | /** | |
25 | * Log4j logger sent to view. | |
26 | */ | |
27 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
28 | ||
29 | private final JCheckBox checkboxIsCustomUserAgent = new JCheckBox(); | |
30 | private final JTextArea textfieldCustomUserAgent = new JPopupTextArea(new JTextAreaPlaceholder("Set User Agent")).getProxy(); | |
31 | | |
32 | public PanelUserAgent() { | |
33 | | |
34 |
1
1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelUserAgent::setBorder → NO_COVERAGE |
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
35 | | |
36 | var jsonScan = new StringBuilder(); | |
37 | | |
38 | try ( | |
39 | var inputStream = UiUtil.class.getClassLoader().getResourceAsStream("swing/list/user-agent.txt"); | |
40 | var inputStreamReader = new InputStreamReader(Objects.requireNonNull(inputStream), StandardCharsets.UTF_8); | |
41 | var reader = new BufferedReader(inputStreamReader) | |
42 | ) { | |
43 | ||
44 | String line; | |
45 |
1
1. <init> : negated conditional → NO_COVERAGE |
while ((line = reader.readLine()) != null) { |
46 | jsonScan.append(line).append(System.lineSeparator()); | |
47 | } | |
48 | } catch (IOException e) { | |
49 | LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e); | |
50 | } | |
51 | | |
52 |
1
1. <init> : removed call to javax/swing/text/Caret::setBlinkRate → NO_COVERAGE |
this.textfieldCustomUserAgent.getCaret().setBlinkRate(500); |
53 |
1
1. <init> : removed call to javax/swing/JTextArea::setText → NO_COVERAGE |
this.textfieldCustomUserAgent.setText(jsonScan.toString()); |
54 |
1
1. <init> : removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE |
MediatorHelper.model().getMediatorUtils().getUserAgentUtil().setCustomUserAgent(jsonScan.toString()); |
55 |
1
1. <init> : removed call to javax/swing/text/Document::addDocumentListener → NO_COVERAGE |
this.textfieldCustomUserAgent.getDocument().addDocumentListener(new DocumentListenerEditing() { |
56 | @Override | |
57 | public void process() { | |
58 |
1
1. process : removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE |
MediatorHelper.model().getMediatorUtils().getUserAgentUtil().setCustomUserAgent( |
59 | PanelUserAgent.this.textfieldCustomUserAgent.getText() | |
60 | ); | |
61 | } | |
62 | }); | |
63 | | |
64 |
1
1. <init> : removed call to javax/swing/JCheckBox::setFocusable → NO_COVERAGE |
this.checkboxIsCustomUserAgent.setFocusable(false); |
65 | var labelIsCheckingUpdate = new JButton("Customize User Agent (randomize multiple agents)"); | |
66 | | |
67 |
1
1. <init> : removed call to javax/swing/JButton::addActionListener → NO_COVERAGE |
labelIsCheckingUpdate.addActionListener(actionEvent -> { |
68 | | |
69 |
2
1. lambda$new$0 : removed call to javax/swing/JCheckBox::setSelected → NO_COVERAGE 2. lambda$new$0 : negated conditional → NO_COVERAGE |
this.checkboxIsCustomUserAgent.setSelected(!this.checkboxIsCustomUserAgent.isSelected()); |
70 | | |
71 |
1
1. lambda$new$0 : removed call to com/jsql/util/UserAgentUtil::setIsCustomUserAgent → NO_COVERAGE |
MediatorHelper.model().getMediatorUtils().getUserAgentUtil().setIsCustomUserAgent( |
72 | this.checkboxIsCustomUserAgent.isSelected() | |
73 | ); | |
74 | }); | |
75 | | |
76 | var textAreaIsTamperingEval = new LightScrollPane(this.textfieldCustomUserAgent); | |
77 |
1
1. <init> : removed call to com/jsql/view/swing/scrollpane/LightScrollPane::setBorder → NO_COVERAGE |
textAreaIsTamperingEval.setBorder(UiUtil.BORDER_FOCUS_LOST); |
78 |
1
1. <init> : removed call to javax/swing/JTextArea::setMinimumSize → NO_COVERAGE |
this.textfieldCustomUserAgent.setMinimumSize(new Dimension(40000, 100)); |
79 | | |
80 | var emptyLabelSessionManagement = new JLabel(); | |
81 | | |
82 | Stream.of(labelIsCheckingUpdate) | |
83 |
1
1. <init> : removed call to java/util/stream/Stream::forEach → NO_COVERAGE |
.forEach(label -> { |
84 | | |
85 |
1
1. lambda$new$1 : removed call to javax/swing/JButton::setHorizontalAlignment → NO_COVERAGE |
label.setHorizontalAlignment(SwingConstants.LEFT); |
86 |
1
1. lambda$new$1 : removed call to javax/swing/JButton::setBorderPainted → NO_COVERAGE |
label.setBorderPainted(false); |
87 |
1
1. lambda$new$1 : removed call to javax/swing/JButton::setContentAreaFilled → NO_COVERAGE |
label.setContentAreaFilled(false); |
88 | }); | |
89 | | |
90 | var groupLayout = new GroupLayout(this); | |
91 |
1
1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelUserAgent::setLayout → NO_COVERAGE |
this.setLayout(groupLayout); |
92 | | |
93 | groupLayout | |
94 |
1
1. <init> : removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE |
.setHorizontalGroup( |
95 | groupLayout | |
96 | .createSequentialGroup() | |
97 | .addGroup( | |
98 | groupLayout | |
99 | .createParallelGroup(GroupLayout.Alignment.TRAILING, false) | |
100 | .addComponent(this.checkboxIsCustomUserAgent) | |
101 | .addComponent(emptyLabelSessionManagement) | |
102 | ) | |
103 | .addGroup( | |
104 | groupLayout | |
105 | .createParallelGroup() | |
106 | .addComponent(labelIsCheckingUpdate) | |
107 | .addComponent(textAreaIsTamperingEval) | |
108 | ) | |
109 | ); | |
110 | ||
111 | groupLayout | |
112 |
1
1. <init> : removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE |
.setVerticalGroup( |
113 | groupLayout | |
114 | .createSequentialGroup() | |
115 | .addGroup( | |
116 | groupLayout | |
117 | .createParallelGroup(GroupLayout.Alignment.BASELINE) | |
118 | .addComponent(this.checkboxIsCustomUserAgent) | |
119 | .addComponent(labelIsCheckingUpdate) | |
120 | ) | |
121 | .addGroup( | |
122 | groupLayout | |
123 | .createParallelGroup(GroupLayout.Alignment.BASELINE) | |
124 | .addComponent(emptyLabelSessionManagement) | |
125 | .addComponent(textAreaIsTamperingEval) | |
126 | ) | |
127 | ); | |
128 | } | |
129 | } | |
Mutations | ||
34 |
1.1 |
|
45 |
1.1 |
|
52 |
1.1 |
|
53 |
1.1 |
|
54 |
1.1 |
|
55 |
1.1 |
|
58 |
1.1 |
|
64 |
1.1 |
|
67 |
1.1 |
|
69 |
1.1 2.2 |
|
71 |
1.1 |
|
77 |
1.1 |
|
78 |
1.1 |
|
83 |
1.1 |
|
85 |
1.1 |
|
86 |
1.1 |
|
87 |
1.1 |
|
91 |
1.1 |
|
94 |
1.1 |
|
112 |
1.1 |