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 1 1. <init> : removed call to javax/swing/JTextArea::setCaretPosition → NO_COVERAGE
        textfieldCustomUserAgent.setCaretPosition(0);
37
        var scrollPane = new JScrollPane(textfieldCustomUserAgent);
38
39
        var labelOrigin = new JLabel("<html><b>Connection user agent</b></html>");
40 1 1. <init> : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE
        labelOrigin.setBorder(PanelGeneral.MARGIN);
41
42
        var groupLayout = new GroupLayout(this);
43 1 1. <init> : removed call to com/jsql/view/swing/panel/preferences/PanelUserAgent::setLayout → NO_COVERAGE
        this.setLayout(groupLayout);
44
45 1 1. <init> : removed call to javax/swing/GroupLayout::setHorizontalGroup → NO_COVERAGE
        groupLayout.setHorizontalGroup(
46
            groupLayout
47
            .createSequentialGroup()
48
            .addGroup(
49
                groupLayout
50
                .createParallelGroup(GroupLayout.Alignment.LEADING)
51
                .addComponent(labelOrigin)
52
                .addComponent(this.checkboxIsCustomUserAgent)
53
                .addComponent(scrollPane)
54
            )
55
        );
56
57 1 1. <init> : removed call to javax/swing/GroupLayout::setVerticalGroup → NO_COVERAGE
        groupLayout.setVerticalGroup(
58
            groupLayout
59
            .createSequentialGroup()
60
            .addGroup(
61
                groupLayout
62
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
63
                .addComponent(labelOrigin)
64
            )
65
            .addGroup(
66
                groupLayout
67
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
68
                .addComponent(this.checkboxIsCustomUserAgent)
69
            )
70
            .addGroup(
71
                groupLayout
72
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
73
                .addComponent(scrollPane)
74
            )
75
        );
76
    }
77
78
    public JCheckBox getCheckboxIsCustomUserAgent() {
79 1 1. getCheckboxIsCustomUserAgent : replaced return value with null for com/jsql/view/swing/panel/preferences/PanelUserAgent::getCheckboxIsCustomUserAgent → NO_COVERAGE
        return this.checkboxIsCustomUserAgent;
80
    }
81
}

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

36

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

40

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

43

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

45

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

57

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

79

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