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 |
|
77 |
1.1 |
|
78 |
1.1 |
|
79 |
1.1 |
|
83 |
1.1 |
|
86 |
1.1 |
|
88 |
1.1 |
|
89 |
1.1 |
|
91 |
1.1 |
|
92 |
1.1 |
|
93 |
1.1 |
|
94 |
1.1 |
|
96 |
1.1 |
|
97 |
1.1 |
|
100 |
1.1 |
|
102 |
1.1 |
|
103 |
1.1 |
|
104 |
1.1 |
|
105 |
1.1 |
|
108 |
1.1 |
|
109 |
1.1 |
|
110 |
1.1 |
|
111 |
1.1 |
|
114 |
1.1 |
|
115 |
1.1 |
|
116 |
1.1 |
|
118 |
1.1 |
|
121 |
1.1 |
|
124 |
1.1 |
|
126 |
1.1 |
|
129 |
1.1 |
|
136 |
1.1 |
|
140 |
1.1 |
|
144 |
1.1 |
|
148 |
1.1 |
|
152 |
1.1 |
|
156 |
1.1 |