PanelUserAgent.java

1
package com.jsql.view.swing.panel.preferences;
2
3
import com.jsql.util.StringUtil;
4
import com.jsql.view.swing.panel.PanelPreferences;
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
10
import javax.swing.*;
11
import java.awt.*;
12
13
public class PanelUserAgent extends JPanel {
14
    
15
    private final JCheckBox checkboxIsCustomUserAgent = new JCheckBox("Randomize agent with the following list:", MediatorHelper.model().getMediatorUtils().getPreferencesUtil().isUserAgentRandom());
16
17
    public PanelUserAgent(PanelPreferences panelPreferences) {
18
        var userAgents = StringUtil.getFile("swing/list/user-agent.txt");
19 1 1. <init> : removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE
        MediatorHelper.model().getMediatorUtils().getUserAgentUtil().setCustomUserAgent(userAgents);
20
21 1 1. <init> : removed call to javax/swing/JCheckBox::addActionListener → NO_COVERAGE
        this.checkboxIsCustomUserAgent.addActionListener(panelPreferences.getActionListenerSave());
22
23
        JTextArea textfieldCustomUserAgent = new JPopupTextArea(new JTextAreaPlaceholder("User agent list")).getProxy();
24 1 1. <init> : removed call to javax/swing/JTextArea::setMinimumSize → NO_COVERAGE
        textfieldCustomUserAgent.setMinimumSize(new Dimension(40000, 100));
25 1 1. <init> : removed call to javax/swing/text/Caret::setBlinkRate → NO_COVERAGE
        textfieldCustomUserAgent.getCaret().setBlinkRate(500);
26 1 1. <init> : removed call to javax/swing/JTextArea::setText → NO_COVERAGE
        textfieldCustomUserAgent.setText(userAgents);
27 1 1. <init> : removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE
        MediatorHelper.model().getMediatorUtils().getUserAgentUtil().setCustomUserAgent(userAgents);
28 1 1. <init> : removed call to javax/swing/text/Document::addDocumentListener → NO_COVERAGE
        textfieldCustomUserAgent.getDocument().addDocumentListener(new DocumentListenerEditing() {
29
            @Override
30
            public void process() {
31 1 1. process : removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE
                MediatorHelper.model().getMediatorUtils().getUserAgentUtil().setCustomUserAgent(
32
                    textfieldCustomUserAgent.getText()
33
                );
34
            }
35
        });
36
        var scrollPane = new JScrollPane(textfieldCustomUserAgent);
37
38
        var labelOrigin = new JLabel("<html><b>Connection user agent</b></html>");
39 1 1. <init> : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE
        labelOrigin.setBorder(PanelGeneral.MARGIN);
40
41
        var groupLayout = new GroupLayout(this);
42 1 1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelUserAgent::setLayout → NO_COVERAGE
        this.setLayout(groupLayout);
43
44 1 1. <init> : removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE
        groupLayout.setHorizontalGroup(
45
            groupLayout
46
            .createSequentialGroup()
47
            .addGroup(
48
                groupLayout
49
                .createParallelGroup(GroupLayout.Alignment.LEADING)
50
                .addComponent(labelOrigin)
51
                .addComponent(this.checkboxIsCustomUserAgent)
52
                .addComponent(scrollPane)
53
            )
54
        );
55
56 1 1. <init> : removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE
        groupLayout.setVerticalGroup(
57
            groupLayout
58
            .createSequentialGroup()
59
            .addGroup(
60
                groupLayout
61
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
62
                .addComponent(labelOrigin)
63
            )
64
            .addGroup(
65
                groupLayout
66
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
67
                .addComponent(this.checkboxIsCustomUserAgent)
68
            )
69
            .addGroup(
70
                groupLayout
71
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
72
                .addComponent(scrollPane)
73
            )
74
        );
75
    }
76
77
    public JCheckBox getCheckboxIsCustomUserAgent() {
78 1 1. getCheckboxIsCustomUserAgent : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelUserAgent::getCheckboxIsCustomUserAgent → NO_COVERAGE
        return this.checkboxIsCustomUserAgent;
79
    }
80
}

Mutations

19

1.1
Location : <init>
Killed by : none
removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE

21

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JCheckBox::addActionListener → NO_COVERAGE

24

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JTextArea::setMinimumSize → NO_COVERAGE

25

1.1
Location : <init>
Killed by : none
removed call to javax/swing/text/Caret::setBlinkRate → NO_COVERAGE

26

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JTextArea::setText → NO_COVERAGE

27

1.1
Location : <init>
Killed by : none
removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE

28

1.1
Location : <init>
Killed by : none
removed call to javax/swing/text/Document::addDocumentListener → NO_COVERAGE

31

1.1
Location : process
Killed by : none
removed call to com/jsql/util/UserAgentUtil::setCustomUserAgent → NO_COVERAGE

39

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JLabel::setBorder → NO_COVERAGE

42

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/preferences/PanelUserAgent::setLayout → NO_COVERAGE

44

1.1
Location : <init>
Killed by : none
removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE

56

1.1
Location : <init>
Killed by : none
removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE

78

1.1
Location : getCheckboxIsCustomUserAgent
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/preferences/PanelUserAgent::getCheckboxIsCustomUserAgent → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1