SplitHorizontalTopBottom.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.panel.split;
12
13
import com.jsql.model.InjectionModel;
14
import com.jsql.view.swing.panel.PanelConsoles;
15
import com.jsql.view.swing.splitpane.JSplitPaneWithZeroSizeDivider;
16
import com.jsql.view.swing.tab.TabManagersProxy;
17
import com.jsql.view.swing.tab.TabResults;
18
import com.jsql.view.swing.tab.TabbedPaneMouseWheelListener;
19
import com.jsql.view.swing.util.MediatorHelper;
20
import com.jsql.view.swing.util.UiUtil;
21
22
import javax.swing.*;
23
import javax.swing.plaf.basic.BasicArrowButton;
24
import java.awt.*;
25
import java.util.prefs.Preferences;
26
27
/**
28
 * SplitPane composed of tree and tabs on top, and info tabs on bottom.
29
 */
30
public class SplitHorizontalTopBottom extends JSplitPaneWithZeroSizeDivider {
31
    
32
    /**
33
     * Name of preference for splitter vertical.
34
     * Reset divider position for current application version.
35
     */
36
    private static final String NAME_LEFT_RIGHT_SPLITPANE = "verticalSplitter-";
37
    
38
    /**
39
     * Name of preference for splitter horizontal.
40
     * Reset divider position for current application version.
41
     */
42
    private static final String NAME_TOP_BOTTOM_SPLITPANE = "horizontalSplitter-";
43
    
44
    private static final int LOC_LEFT_RIGHT_SPLITTER = 350;
45
46
    /**
47
     * SplitPane containing Manager panels on the left and result tabs on the right.
48
     */
49
    private final JSplitPaneWithZeroSizeDivider splitVerticalLeftRight;
50
51
    private static final JPanel PANEL_HIDDEN_CONSOLES = new JPanel();
52
    
53
    /**
54
     * MouseAdapter used on arrow on tabbedpane header and on
55
     * ersatz button when bottom panel is hidden.
56
     */
57
    private static final ActionHideShowConsole ACTION_HIDE_SHOW_CONSOLE = new ActionHideShowConsole(PANEL_HIDDEN_CONSOLES);
58
    private static final ActionHideShowResult ACTION_HIDE_SHOW_RESULT= new ActionHideShowResult();
59
60
    private final JLabel labelPlaceholderResult;
61
    
62
    /**
63
     * Create main panel with Manager panels on the left, result tabs on the right,
64
     * and consoles in the bottom.
65
     */
66
    public SplitHorizontalTopBottom() {
67
        
68
        super(JSplitPane.VERTICAL_SPLIT);
69
70
        var preferences = Preferences.userRoot().node(InjectionModel.class.getName());
71
        var verticalLeftRightSplitter = preferences.getInt(SplitHorizontalTopBottom.NAME_LEFT_RIGHT_SPLITPANE, LOC_LEFT_RIGHT_SPLITTER);
72
73
        var tabManagersProxy = new TabManagersProxy();
74 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(tabManagersProxy);
75
76
        var tabResults = new TabResults();
77 1 1. <init> : removed call to com/jsql/view/swing/tab/TabResults::setName → NO_COVERAGE
        tabResults.setName("tabResults");
78 1 1. <init> : removed call to com/jsql/view/swing/tab/TabResults::addMouseWheelListener → NO_COVERAGE
        tabResults.addMouseWheelListener(new TabbedPaneMouseWheelListener());
79 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(tabResults);
80
81
        // Tree and tabs on top
82
        this.splitVerticalLeftRight = new JSplitPaneWithZeroSizeDivider(JSplitPane.HORIZONTAL_SPLIT);
83 1 1. <init> : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setLeftComponent → NO_COVERAGE
        this.splitVerticalLeftRight.setLeftComponent(tabManagersProxy);
84
        
85
        this.labelPlaceholderResult = new JLabel(UiUtil.IMG_BUG);
86 1 1. <init> : removed call to javax/swing/JLabel::setMinimumSize → NO_COVERAGE
        this.labelPlaceholderResult.setMinimumSize(new Dimension(100, 0));
87
88 1 1. <init> : removed call to javax/swing/JLabel::setAlignmentX → NO_COVERAGE
        this.labelPlaceholderResult.setAlignmentX(Component.CENTER_ALIGNMENT);
89 1 1. <init> : removed call to javax/swing/JLabel::setAlignmentY → NO_COVERAGE
        this.labelPlaceholderResult.setAlignmentY(Component.CENTER_ALIGNMENT);
90
      
91 1 1. <init> : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setRightComponent → NO_COVERAGE
        this.splitVerticalLeftRight.setRightComponent(this.labelPlaceholderResult);
92 1 1. <init> : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerLocation → NO_COVERAGE
        this.splitVerticalLeftRight.setDividerLocation(verticalLeftRightSplitter);
93 1 1. <init> : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerSize → NO_COVERAGE
        this.splitVerticalLeftRight.setDividerSize(0);
94 1 1. <init> : removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setBorder → NO_COVERAGE
        this.splitVerticalLeftRight.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UiUtil.COLOR_COMPONENT_BORDER));
95
96 1 1. <init> : removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setDividerSize → NO_COVERAGE
        this.setDividerSize(0);
97 1 1. <init> : removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setBorder → NO_COVERAGE
        this.setBorder(null);
98
99
        var panelManagerResult = new JPanel(new BorderLayout());
100 1 1. <init> : removed call to javax/swing/JPanel::add → NO_COVERAGE
        panelManagerResult.add(this.splitVerticalLeftRight, BorderLayout.CENTER);
101
102 1 1. <init> : removed call to javax/swing/JPanel::setLayout → NO_COVERAGE
        PANEL_HIDDEN_CONSOLES.setLayout(new BorderLayout());
103 1 1. <init> : removed call to javax/swing/JPanel::setOpaque → NO_COVERAGE
        PANEL_HIDDEN_CONSOLES.setOpaque(false);
104 1 1. <init> : removed call to javax/swing/JPanel::setPreferredSize → NO_COVERAGE
        PANEL_HIDDEN_CONSOLES.setPreferredSize(new Dimension(17, 22));
105 1 1. <init> : removed call to javax/swing/JPanel::setMaximumSize → NO_COVERAGE
        PANEL_HIDDEN_CONSOLES.setMaximumSize(new Dimension(17, 22));
106
        
107
        JButton buttonShowConsoles = new BasicArrowButton(SwingConstants.NORTH);
108 1 1. <init> : removed call to javax/swing/JButton::setBorderPainted → NO_COVERAGE
        buttonShowConsoles.setBorderPainted(false);
109 1 1. <init> : removed call to javax/swing/JButton::setOpaque → NO_COVERAGE
        buttonShowConsoles.setOpaque(false);
110 1 1. <init> : removed call to javax/swing/JButton::addActionListener → NO_COVERAGE
        buttonShowConsoles.addActionListener(SplitHorizontalTopBottom.ACTION_HIDE_SHOW_CONSOLE);
111 1 1. <init> : removed call to javax/swing/JButton::setName → NO_COVERAGE
        buttonShowConsoles.setName("buttonShowConsolesHidden");
112
        
113
        PANEL_HIDDEN_CONSOLES.add(Box.createHorizontalGlue());
114 1 1. <init> : removed call to javax/swing/JPanel::add → NO_COVERAGE
        PANEL_HIDDEN_CONSOLES.add(buttonShowConsoles, BorderLayout.LINE_END);
115 1 1. <init> : removed call to javax/swing/JPanel::setBorder → NO_COVERAGE
        PANEL_HIDDEN_CONSOLES.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UiUtil.COLOR_COMPONENT_BORDER));
116 1 1. <init> : removed call to javax/swing/JPanel::setVisible → NO_COVERAGE
        PANEL_HIDDEN_CONSOLES.setVisible(false);
117
118 1 1. <init> : removed call to javax/swing/JPanel::add → NO_COVERAGE
        panelManagerResult.add(PANEL_HIDDEN_CONSOLES, BorderLayout.SOUTH);
119
120
        // Setting for top and bottom components
121 1 1. <init> : removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setTopComponent → NO_COVERAGE
        this.setTopComponent(panelManagerResult);
122
123
        var panelConsoles = new PanelConsoles();
124 1 1. <init> : removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE
        MediatorHelper.register(panelConsoles);
125
126 1 1. <init> : removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setBottomComponent → NO_COVERAGE
        this.setBottomComponent(panelConsoles);
127
128
        // defines left and bottom pane
129 1 1. <init> : removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setResizeWeight → NO_COVERAGE
        this.setResizeWeight(1);
130
    }
131
    
132
    
133
    // Getter and setter
134
135
    public static String getNameVSplitpane() {
136 1 1. getNameVSplitpane : replaced return value with "" for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getNameVSplitpane → NO_COVERAGE
        return NAME_LEFT_RIGHT_SPLITPANE;
137
    }
138
139
    public static String getNameHSplitpane() {
140 1 1. getNameHSplitpane : replaced return value with "" for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getNameHSplitpane → NO_COVERAGE
        return NAME_TOP_BOTTOM_SPLITPANE;
141
    }
142
143
    public JSplitPaneWithZeroSizeDivider getSplitVerticalLeftRight() {
144 1 1. getSplitVerticalLeftRight : replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getSplitVerticalLeftRight → NO_COVERAGE
        return this.splitVerticalLeftRight;
145
    }
146
147
    public static ActionHideShowConsole getActionHideShowConsole() {
148 1 1. getActionHideShowConsole : replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getActionHideShowConsole → NO_COVERAGE
        return ACTION_HIDE_SHOW_CONSOLE;
149
    }
150
    
151
    public static ActionHideShowResult getActionHideShowResult() {
152 1 1. getActionHideShowResult : replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getActionHideShowResult → NO_COVERAGE
        return ACTION_HIDE_SHOW_RESULT;
153
    }
154
155
    public JLabel getLabelPlaceholderResult() {
156 1 1. getLabelPlaceholderResult : replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getLabelPlaceholderResult → NO_COVERAGE
        return this.labelPlaceholderResult;
157
    }
158
}

Mutations

74

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

77

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

78

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

79

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

83

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setLeftComponent → NO_COVERAGE

86

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

88

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

89

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

91

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setRightComponent → NO_COVERAGE

92

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerLocation → NO_COVERAGE

93

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setDividerSize → NO_COVERAGE

94

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/splitpane/JSplitPaneWithZeroSizeDivider::setBorder → NO_COVERAGE

96

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setDividerSize → NO_COVERAGE

97

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setBorder → NO_COVERAGE

100

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

102

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

103

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

104

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

105

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

108

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

109

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

110

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

111

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

114

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

115

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

116

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

118

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

121

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setTopComponent → NO_COVERAGE

124

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/MediatorHelper::register → NO_COVERAGE

126

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setBottomComponent → NO_COVERAGE

129

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::setResizeWeight → NO_COVERAGE

136

1.1
Location : getNameVSplitpane
Killed by : none
replaced return value with "" for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getNameVSplitpane → NO_COVERAGE

140

1.1
Location : getNameHSplitpane
Killed by : none
replaced return value with "" for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getNameHSplitpane → NO_COVERAGE

144

1.1
Location : getSplitVerticalLeftRight
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getSplitVerticalLeftRight → NO_COVERAGE

148

1.1
Location : getActionHideShowConsole
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getActionHideShowConsole → NO_COVERAGE

152

1.1
Location : getActionHideShowResult
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getActionHideShowResult → NO_COVERAGE

156

1.1
Location : getLabelPlaceholderResult
Killed by : none
replaced return value with null for com/jsql/view/swing/panel/split/SplitHorizontalTopBottom::getLabelPlaceholderResult → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1