TabManagers.java

1
/*******************************************************************************
2
 * Copyhacked (H) 2012-2020.
3
 * This program and the accompanying materials
4
 * are made available under no term at all, use it like
5
 * you want, but share and discuss about it
6
 * every time possible with every body.
7
 *
8
 * Contributors:
9
 *      ron190 at ymail dot com - initial implementation
10
 *******************************************************************************/
11
package com.jsql.view.swing.tab;
12
13
import com.jsql.util.I18nUtil;
14
import com.jsql.view.swing.text.JToolTipI18n;
15
import com.jsql.view.swing.ui.CustomMetalTabbedPaneUI;
16
import com.jsql.view.swing.util.I18nViewUtil;
17
import com.jsql.view.swing.util.MediatorHelper;
18
import com.jsql.view.swing.util.UiUtil;
19
20
import javax.swing.*;
21
import java.awt.*;
22
import java.awt.event.MouseAdapter;
23
import java.awt.event.MouseEvent;
24
25
/**
26
 * Panel on the left with functionalities like webshell, file reading and admin page finder.
27
 */
28
public class TabManagers extends TabbedPaneWheeled {
29
    
30
    /**
31
     * Create manager panel.
32
     */
33
    public TabManagers() {
34
        
35 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::setName → NO_COVERAGE
        this.setName("tabManagers");
36
        
37 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::setUI → NO_COVERAGE
        this.setUI(new CustomMetalTabbedPaneUI() {
38
            
39
            @Override
40
            protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) {
41
                
42 1 1. calculateTabWidth : replaced int return with 0 for com/jsql/view/swing/tab/TabManagers$1::calculateTabWidth → NO_COVERAGE
                return Math.max(75, super.calculateTabWidth(tabPlacement, tabIndex, metrics));
43
            }
44
        });
45
46 2 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::addChangeListener → NO_COVERAGE
2. lambda$new$0 : removed call to com/jsql/view/swing/tab/TabManagersProxy::setSelectedIndex → NO_COVERAGE
        this.addChangeListener(e -> MediatorHelper.tabManagers().setSelectedIndex(TabManagers.this.getSelectedIndex()));
47
        
48 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::setMaximumSize → NO_COVERAGE
        this.setMaximumSize(new Dimension(this.getMaximumSize().width, 25));
49 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::setPreferredSize → NO_COVERAGE
        this.setPreferredSize(new Dimension(this.getPreferredSize().width, 25));
50
        
51 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::addMouseClickMenu → NO_COVERAGE
        this.addMouseClickMenu();
52
        
53 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::setMinimumSize → NO_COVERAGE
        this.setMinimumSize(new Dimension(100, 0));
54
        
55 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("DATABASE_TAB", "DATABASE_TOOLTIP", UiUtil.ICON_DATABASE_SERVER, 0);
56 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("ADMINPAGE_TAB", "ADMINPAGE_TOOLTIP", UiUtil.ICON_ADMIN_SERVER, 1);
57 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("FILE_TAB", "FILE_TOOLTIP", UiUtil.ICON_FILE_SERVER, 2);
58 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("WEBSHELL_TAB", "WEBSHELL_TOOLTIP", UiUtil.ICON_SHELL_SERVER, 3);
59 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("SQLSHELL_TAB", "SQLSHELL_TOOLTIP", UiUtil.ICON_SHELL_SERVER, 4);
60 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("UPLOAD_TAB", "UPLOAD_TOOLTIP", UiUtil.ICON_UPLOAD, 5);
61 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("BRUTEFORCE_TAB", "BRUTEFORCE_TOOLTIP", UiUtil.ICON_BRUTER, 6);
62 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("CODER_TAB", "CODER_TOOLTIP", UiUtil.ICON_CODER, 7);
63 1 1. <init> : removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE
        this.buildI18nTab("SCANLIST_TAB", "SCANLIST_TOOLTIP", UiUtil.ICON_SCANLIST, 8);
64
    }
65
    
66
    private void buildI18nTab(String keyLabel, String keyTooltip, Icon icon, int index) {
67
        
68
        final var refTooltip = new JToolTipI18n[]{ new JToolTipI18n(I18nUtil.valueByKey(keyTooltip)) };
69
        
70
        JLabel labelTab = new JLabel(I18nUtil.valueByKey(keyLabel), icon, SwingConstants.CENTER) {
71
            
72
            @Override
73
            public JToolTip createToolTip() {
74
                
75
                JToolTipI18n tipI18n = new JToolTipI18n(I18nUtil.valueByKey(keyTooltip));
76
                refTooltip[0] = tipI18n;
77
                
78 1 1. createToolTip : replaced return value with null for com/jsql/view/swing/tab/TabManagers$2::createToolTip → NO_COVERAGE
                return tipI18n;
79
            }
80
        };
81
        
82 1 1. buildI18nTab : removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE
        labelTab.addMouseListener(new MouseAdapter() {
83
            
84
            @Override
85
            public void mousePressed(MouseEvent e) {
86
                
87 1 1. mousePressed : removed call to com/jsql/view/swing/tab/TabManagersProxy::setSelectedIndex → NO_COVERAGE
                MediatorHelper.tabManagers().setSelectedIndex(index);
88 1 1. mousePressed : removed call to com/jsql/view/swing/tab/TabManagers::setSelectedIndex → NO_COVERAGE
                TabManagers.this.setSelectedIndex(index);
89 1 1. mousePressed : removed call to java/awt/event/MouseAdapter::mousePressed → NO_COVERAGE
                super.mousePressed(e);
90
            }
91
        });
92
93
        // Required for i18n to work
94 1 1. buildI18nTab : removed call to com/jsql/view/swing/tab/TabManagers::addTab → NO_COVERAGE
        this.addTab(I18nUtil.valueByKey(keyLabel), icon, null);
95 1 1. buildI18nTab : removed call to com/jsql/view/swing/tab/TabManagers::setTabComponentAt → NO_COVERAGE
        this.setTabComponentAt(
96
            this.indexOfTab(I18nUtil.valueByKey(keyLabel)),
97
            labelTab
98
        );
99
100 1 1. buildI18nTab : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey(keyLabel, labelTab);
101 1 1. buildI18nTab : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey(keyTooltip, refTooltip[0]);
102
        
103 1 1. buildI18nTab : removed call to javax/swing/JLabel::setToolTipText → NO_COVERAGE
        labelTab.setToolTipText(I18nUtil.valueByKey(keyTooltip));
104 1 1. buildI18nTab : removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE
        labelTab.addMouseListener(new TabMouseAdapter(this));
105
    }
106
}

Mutations

35

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setName → NO_COVERAGE

37

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setUI → NO_COVERAGE

42

1.1
Location : calculateTabWidth
Killed by : none
replaced int return with 0 for com/jsql/view/swing/tab/TabManagers$1::calculateTabWidth → NO_COVERAGE

46

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::addChangeListener → NO_COVERAGE

2.2
Location : lambda$new$0
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::setSelectedIndex → NO_COVERAGE

48

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setMaximumSize → NO_COVERAGE

49

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setPreferredSize → NO_COVERAGE

51

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::addMouseClickMenu → NO_COVERAGE

53

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setMinimumSize → NO_COVERAGE

55

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

56

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

57

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

58

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

59

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

60

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

61

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

62

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

63

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::buildI18nTab → NO_COVERAGE

78

1.1
Location : createToolTip
Killed by : none
replaced return value with null for com/jsql/view/swing/tab/TabManagers$2::createToolTip → NO_COVERAGE

82

1.1
Location : buildI18nTab
Killed by : none
removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE

87

1.1
Location : mousePressed
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagersProxy::setSelectedIndex → NO_COVERAGE

88

1.1
Location : mousePressed
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setSelectedIndex → NO_COVERAGE

89

1.1
Location : mousePressed
Killed by : none
removed call to java/awt/event/MouseAdapter::mousePressed → NO_COVERAGE

94

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::addTab → NO_COVERAGE

95

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setTabComponentAt → NO_COVERAGE

100

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

101

1.1
Location : buildI18nTab
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

103

1.1
Location : buildI18nTab
Killed by : none
removed call to javax/swing/JLabel::setToolTipText → NO_COVERAGE

104

1.1
Location : buildI18nTab
Killed by : none
removed call to javax/swing/JLabel::addMouseListener → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1