| 1 | package com.jsql.view.swing.util; | |
| 2 | ||
| 3 | import javax.swing.*; | |
| 4 | import javax.swing.border.Border; | |
| 5 | import javax.swing.plaf.basic.BasicSplitPaneDivider; | |
| 6 | import javax.swing.plaf.basic.BasicSplitPaneUI; | |
| 7 | import java.awt.*; | |
| 8 | ||
| 9 | public class JSplitPaneWithZeroSizeDivider extends JSplitPane { | |
| 10 | ||
| 11 | private final int dividerDragOffset = 4; | |
| 12 | ||
| 13 | public JSplitPaneWithZeroSizeDivider(int i) { | |
| 14 | super(i); | |
| 15 |
1
1. <init> : removed call to com/jsql/view/swing/util/JSplitPaneWithZeroSizeDivider::setDividerSize → NO_COVERAGE |
this.setDividerSize(1); |
| 16 |
1
1. <init> : removed call to com/jsql/view/swing/util/JSplitPaneWithZeroSizeDivider::setContinuousLayout → NO_COVERAGE |
this.setContinuousLayout(true); |
| 17 | } | |
| 18 | ||
| 19 | @Override | |
| 20 | public void doLayout() { | |
| 21 |
1
1. doLayout : removed call to javax/swing/JSplitPane::doLayout → NO_COVERAGE |
super.doLayout(); |
| 22 | ||
| 23 | // increase divider width or height | |
| 24 | BasicSplitPaneDivider divider = ((BasicSplitPaneUI) this.getUI()).getDivider(); | |
| 25 | Rectangle bounds = divider.getBounds(); | |
| 26 | int dividerDragSize = 9; | |
| 27 |
1
1. doLayout : negated conditional → NO_COVERAGE |
if (this.orientation == JSplitPane.HORIZONTAL_SPLIT) { |
| 28 |
1
1. doLayout : Replaced integer subtraction with addition → NO_COVERAGE |
bounds.x -= this.dividerDragOffset; |
| 29 | bounds.width = dividerDragSize; | |
| 30 | } else { | |
| 31 |
1
1. doLayout : Replaced integer subtraction with addition → NO_COVERAGE |
bounds.y -= this.dividerDragOffset; |
| 32 | bounds.height = dividerDragSize; | |
| 33 | } | |
| 34 |
1
1. doLayout : removed call to javax/swing/plaf/basic/BasicSplitPaneDivider::setBounds → NO_COVERAGE |
divider.setBounds(bounds); |
| 35 | } | |
| 36 | ||
| 37 | @Override | |
| 38 | public void updateUI() { | |
| 39 |
1
1. updateUI : removed call to com/jsql/view/swing/util/JSplitPaneWithZeroSizeDivider::setUI → NO_COVERAGE |
this.setUI(new SplitPaneWithZeroSizeDividerUI()); |
| 40 |
1
1. updateUI : removed call to com/jsql/view/swing/util/JSplitPaneWithZeroSizeDivider::revalidate → NO_COVERAGE |
this.revalidate(); |
| 41 | } | |
| 42 | ||
| 43 | private class SplitPaneWithZeroSizeDividerUI extends BasicSplitPaneUI { | |
| 44 | ||
| 45 | @Override | |
| 46 | public BasicSplitPaneDivider createDefaultDivider() { | |
| 47 |
1
1. createDefaultDivider : replaced return value with null for com/jsql/view/swing/util/JSplitPaneWithZeroSizeDivider$SplitPaneWithZeroSizeDividerUI::createDefaultDivider → NO_COVERAGE |
return new ZeroSizeDivider(this); |
| 48 | } | |
| 49 | ||
| 50 | @Override | |
| 51 | protected void installDefaults() { | |
| 52 |
1
1. installDefaults : removed call to javax/swing/plaf/basic/BasicSplitPaneUI::installDefaults → NO_COVERAGE |
super.installDefaults(); |
| 53 | ||
| 54 | // make sure that divider is first component (and can overlap left/right components) | |
| 55 |
1
1. installDefaults : negated conditional → NO_COVERAGE |
if (this.splitPane.getComponent(0) != this.divider) { |
| 56 |
1
1. installDefaults : removed call to javax/swing/JSplitPane::setLeftComponent → NO_COVERAGE |
this.splitPane.setLeftComponent(this.splitPane.getLeftComponent()); |
| 57 |
1
1. installDefaults : removed call to javax/swing/JSplitPane::setRightComponent → NO_COVERAGE |
this.splitPane.setRightComponent(this.splitPane.getRightComponent()); |
| 58 | } | |
| 59 | } | |
| 60 | } | |
| 61 | ||
| 62 | private class ZeroSizeDivider extends BasicSplitPaneDivider { | |
| 63 | ||
| 64 | public ZeroSizeDivider(BasicSplitPaneUI ui) { | |
| 65 | super(ui); | |
| 66 |
1
1. <init> : removed call to javax/swing/plaf/basic/BasicSplitPaneDivider::setBorder → NO_COVERAGE |
super.setBorder(null); |
| 67 |
1
1. <init> : removed call to com/jsql/view/swing/util/JSplitPaneWithZeroSizeDivider$ZeroSizeDivider::setBackground → NO_COVERAGE |
this.setBackground(UIManager.getColor("controlShadow")); |
| 68 | } | |
| 69 | ||
| 70 | @Override | |
| 71 | public void setBorder(Border border) { | |
| 72 | // ignore | |
| 73 | } | |
| 74 | ||
| 75 | @Override | |
| 76 | public void paint(Graphics g) { | |
| 77 |
1
1. paint : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(this.getBackground()); |
| 78 |
1
1. paint : negated conditional → NO_COVERAGE |
if (this.orientation == JSplitPane.HORIZONTAL_SPLIT) { |
| 79 |
2
1. paint : removed call to java/awt/Graphics::drawLine → NO_COVERAGE 2. paint : Replaced integer subtraction with addition → NO_COVERAGE |
g.drawLine(JSplitPaneWithZeroSizeDivider.this.dividerDragOffset, 0, JSplitPaneWithZeroSizeDivider.this.dividerDragOffset, this.getHeight() - 1); |
| 80 | } else { | |
| 81 |
2
1. paint : removed call to java/awt/Graphics::drawLine → NO_COVERAGE 2. paint : Replaced integer subtraction with addition → NO_COVERAGE |
g.drawLine(0, JSplitPaneWithZeroSizeDivider.this.dividerDragOffset, this.getWidth() - 1, JSplitPaneWithZeroSizeDivider.this.dividerDragOffset); |
| 82 | } | |
| 83 | } | |
| 84 | ||
| 85 | @Override | |
| 86 | protected void dragDividerTo(int location) { | |
| 87 |
2
1. dragDividerTo : removed call to javax/swing/plaf/basic/BasicSplitPaneDivider::dragDividerTo → NO_COVERAGE 2. dragDividerTo : Replaced integer addition with subtraction → NO_COVERAGE |
super.dragDividerTo(location + JSplitPaneWithZeroSizeDivider.this.dividerDragOffset); |
| 88 | } | |
| 89 | ||
| 90 | @Override | |
| 91 | protected void finishDraggingTo(int location) { | |
| 92 |
2
1. finishDraggingTo : Replaced integer addition with subtraction → NO_COVERAGE 2. finishDraggingTo : removed call to javax/swing/plaf/basic/BasicSplitPaneDivider::finishDraggingTo → NO_COVERAGE |
super.finishDraggingTo(location + JSplitPaneWithZeroSizeDivider.this.dividerDragOffset); |
| 93 | } | |
| 94 | } | |
| 95 | } | |
Mutations | ||
| 15 |
1.1 |
|
| 16 |
1.1 |
|
| 21 |
1.1 |
|
| 27 |
1.1 |
|
| 28 |
1.1 |
|
| 31 |
1.1 |
|
| 34 |
1.1 |
|
| 39 |
1.1 |
|
| 40 |
1.1 |
|
| 47 |
1.1 |
|
| 52 |
1.1 |
|
| 55 |
1.1 |
|
| 56 |
1.1 |
|
| 57 |
1.1 |
|
| 66 |
1.1 |
|
| 67 |
1.1 |
|
| 77 |
1.1 |
|
| 78 |
1.1 |
|
| 79 |
1.1 2.2 |
|
| 81 |
1.1 2.2 |
|
| 87 |
1.1 2.2 |
|
| 92 |
1.1 2.2 |