| 1 | package com.jsql.view.swing.tab.dnd; | |
| 2 | ||
| 3 | import com.jsql.util.LogLevelUtil; | |
| 4 | import com.jsql.view.swing.action.ActionCloseTabResult; | |
| 5 | import org.apache.logging.log4j.LogManager; | |
| 6 | import org.apache.logging.log4j.Logger; | |
| 7 | ||
| 8 | import javax.swing.*; | |
| 9 | import java.awt.*; | |
| 10 | import java.awt.dnd.DragSource; | |
| 11 | import java.awt.event.MouseAdapter; | |
| 12 | import java.awt.event.MouseEvent; | |
| 13 | import java.beans.PropertyChangeEvent; | |
| 14 | import java.beans.PropertyChangeListener; | |
| 15 | import java.util.Objects; | |
| 16 | import java.util.Optional; | |
| 17 | ||
| 18 | public class DnDTabbedPane extends JTabbedPane { | |
| 19 | ||
| 20 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
| 21 | ||
| 22 | private static final int SCROLL_SIZE = 20; // Test | |
| 23 | private static final int BUTTON_SIZE = 30; // 30 is magic number of scroll button size | |
| 24 | private static final int LINE_WIDTH = 3; | |
| 25 | private static final Rectangle RECT_BACKWARD = new Rectangle(); | |
| 26 | private static final Rectangle RECT_FORWARD = new Rectangle(); | |
| 27 | protected static final Rectangle RECT_LINE = new Rectangle(); | |
| 28 | protected int dragTabIndex = -1; | |
| 29 | private transient DnDDropLocation dropLocation; | |
| 30 | ||
| 31 | public static final class DnDDropLocation extends TransferHandler.DropLocation { | |
| 32 | | |
| 33 | private final int index; | |
| 34 | private boolean dropable = true; | |
| 35 | | |
| 36 | private DnDDropLocation(Point p, int index) { | |
| 37 | super(p); | |
| 38 | this.index = index; | |
| 39 | } | |
| 40 | | |
| 41 | public int getIndex() { | |
| 42 |
1
1. getIndex : replaced int return with 0 for com/jsql/view/swing/tab/dnd/DnDTabbedPane$DnDDropLocation::getIndex → NO_COVERAGE |
return this.index; |
| 43 | } | |
| 44 | | |
| 45 | public void setDroppable(boolean flag) { | |
| 46 | this.dropable = flag; | |
| 47 | } | |
| 48 | | |
| 49 | public boolean isDroppable() { | |
| 50 |
2
1. isDroppable : replaced boolean return with true for com/jsql/view/swing/tab/dnd/DnDTabbedPane$DnDDropLocation::isDroppable → NO_COVERAGE 2. isDroppable : replaced boolean return with false for com/jsql/view/swing/tab/dnd/DnDTabbedPane$DnDDropLocation::isDroppable → NO_COVERAGE |
return this.dropable; |
| 51 | } | |
| 52 | } | |
| 53 | | |
| 54 | private void clickArrowButton(String actionKey) { | |
| 55 | JButton scrollForwardButton = null; | |
| 56 | JButton scrollBackwardButton = null; | |
| 57 | | |
| 58 | for (Component c: this.getComponents()) { | |
| 59 |
1
1. clickArrowButton : negated conditional → NO_COVERAGE |
if (c instanceof JButton) { |
| 60 |
1
1. clickArrowButton : negated conditional → NO_COVERAGE |
if (scrollForwardButton == null) { |
| 61 | scrollForwardButton = (JButton) c; | |
| 62 |
1
1. clickArrowButton : negated conditional → NO_COVERAGE |
} else if (scrollBackwardButton == null) { |
| 63 | scrollBackwardButton = (JButton) c; | |
| 64 | } | |
| 65 | } | |
| 66 | } | |
| 67 | | |
| 68 |
1
1. clickArrowButton : negated conditional → NO_COVERAGE |
JButton button = "scrollTabsForwardAction".equals(actionKey) ? scrollForwardButton : scrollBackwardButton; |
| 69 | Optional.ofNullable(button) | |
| 70 | .filter(JButton::isEnabled) | |
| 71 |
1
1. clickArrowButton : removed call to java/util/Optional::ifPresent → NO_COVERAGE |
.ifPresent(JButton::doClick); |
| 72 | } | |
| 73 | | |
| 74 | public void autoScrollTest(Point pt) { | |
| 75 | Rectangle r = this.getTabAreaBounds(); | |
| 76 | | |
| 77 |
1
1. autoScrollTest : negated conditional → NO_COVERAGE |
if (DnDTabbedPane.isTopBottomTabPlacement(this.getTabPlacement())) { |
| 78 |
1
1. autoScrollTest : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE |
DnDTabbedPane.RECT_BACKWARD.setBounds(r.x, r.y, DnDTabbedPane.SCROLL_SIZE, r.height); |
| 79 |
4
1. autoScrollTest : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE 2. autoScrollTest : Replaced integer addition with subtraction → NO_COVERAGE 3. autoScrollTest : Replaced integer subtraction with addition → NO_COVERAGE 4. autoScrollTest : Replaced integer subtraction with addition → NO_COVERAGE |
DnDTabbedPane.RECT_FORWARD.setBounds(r.x + r.width - DnDTabbedPane.SCROLL_SIZE - DnDTabbedPane.BUTTON_SIZE, r.y, DnDTabbedPane.SCROLL_SIZE + DnDTabbedPane.BUTTON_SIZE, r.height); |
| 80 | } else { | |
| 81 |
1
1. autoScrollTest : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE |
DnDTabbedPane.RECT_BACKWARD.setBounds(r.x, r.y, r.width, DnDTabbedPane.SCROLL_SIZE); |
| 82 |
4
1. autoScrollTest : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE 2. autoScrollTest : Replaced integer addition with subtraction → NO_COVERAGE 3. autoScrollTest : Replaced integer subtraction with addition → NO_COVERAGE 4. autoScrollTest : Replaced integer subtraction with addition → NO_COVERAGE |
DnDTabbedPane.RECT_FORWARD.setBounds(r.x, r.y + r.height - DnDTabbedPane.SCROLL_SIZE - DnDTabbedPane.BUTTON_SIZE, r.width, DnDTabbedPane.SCROLL_SIZE + DnDTabbedPane.BUTTON_SIZE); |
| 83 | } | |
| 84 | | |
| 85 |
1
1. autoScrollTest : negated conditional → NO_COVERAGE |
if (DnDTabbedPane.RECT_BACKWARD.contains(pt)) { |
| 86 |
1
1. autoScrollTest : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::clickArrowButton → NO_COVERAGE |
this.clickArrowButton("scrollTabsBackwardAction"); |
| 87 |
1
1. autoScrollTest : negated conditional → NO_COVERAGE |
} else if (DnDTabbedPane.RECT_FORWARD.contains(pt)) { |
| 88 |
1
1. autoScrollTest : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::clickArrowButton → NO_COVERAGE |
this.clickArrowButton("scrollTabsForwardAction"); |
| 89 | } | |
| 90 | } | |
| 91 | | |
| 92 | protected DnDTabbedPane() { | |
| 93 | super(); | |
| 94 | | |
| 95 | var h = new Handler(); | |
| 96 |
1
1. <init> : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::addMouseListener → NO_COVERAGE |
this.addMouseListener(h); |
| 97 |
1
1. <init> : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::addMouseMotionListener → NO_COVERAGE |
this.addMouseMotionListener(h); |
| 98 |
1
1. <init> : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::addPropertyChangeListener → NO_COVERAGE |
this.addPropertyChangeListener(h); |
| 99 | } | |
| 100 | | |
| 101 | public DnDDropLocation dropLocationForPointDnD(Point p) { | |
| 102 |
2
1. dropLocationForPointDnD : negated conditional → NO_COVERAGE 2. dropLocationForPointDnD : changed conditional boundary → NO_COVERAGE |
for (var i = 0; i < this.getTabCount(); i++) { |
| 103 |
1
1. dropLocationForPointDnD : negated conditional → NO_COVERAGE |
if (this.getBoundsAt(i).contains(p)) { |
| 104 |
1
1. dropLocationForPointDnD : replaced return value with null for com/jsql/view/swing/tab/dnd/DnDTabbedPane::dropLocationForPointDnD → NO_COVERAGE |
return new DnDDropLocation(p, i); |
| 105 | } | |
| 106 | } | |
| 107 | | |
| 108 |
1
1. dropLocationForPointDnD : negated conditional → NO_COVERAGE |
if (this.getTabAreaBounds().contains(p)) { |
| 109 |
1
1. dropLocationForPointDnD : replaced return value with null for com/jsql/view/swing/tab/dnd/DnDTabbedPane::dropLocationForPointDnD → NO_COVERAGE |
return new DnDDropLocation(p, this.getTabCount()); |
| 110 | } | |
| 111 | | |
| 112 |
1
1. dropLocationForPointDnD : replaced return value with null for com/jsql/view/swing/tab/dnd/DnDTabbedPane::dropLocationForPointDnD → NO_COVERAGE |
return new DnDDropLocation(p, -1); |
| 113 | } | |
| 114 | | |
| 115 | public void setDropLocation(TransferHandler.DropLocation location, boolean forDrop) { | |
| 116 | DnDDropLocation old = this.dropLocation; | |
| 117 | | |
| 118 |
2
1. setDropLocation : negated conditional → NO_COVERAGE 2. setDropLocation : negated conditional → NO_COVERAGE |
if (Objects.isNull(location) || !forDrop) { |
| 119 | this.dropLocation = new DnDDropLocation(new Point(), -1); | |
| 120 |
1
1. setDropLocation : negated conditional → NO_COVERAGE |
} else if (location instanceof DnDDropLocation) { |
| 121 | this.dropLocation = (DnDDropLocation) location; | |
| 122 | } | |
| 123 | | |
| 124 |
1
1. setDropLocation : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::firePropertyChange → NO_COVERAGE |
this.firePropertyChange("dropLocation", old, this.dropLocation); |
| 125 | } | |
| 126 | | |
| 127 | public void exportTab(int dragIndex, JTabbedPane target, int targetIndex) { | |
| 128 | var cmp = this.getComponentAt(dragIndex); | |
| 129 | var tab = this.getTabComponentAt(dragIndex); | |
| 130 | String title = this.getTitleAt(dragIndex); | |
| 131 | var icon = this.getIconAt(dragIndex); | |
| 132 | String tip = this.getToolTipTextAt(dragIndex); | |
| 133 | boolean isEnabled = this.isEnabledAt(dragIndex); | |
| 134 | | |
| 135 |
1
1. exportTab : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::remove → NO_COVERAGE |
this.remove(dragIndex); |
| 136 |
1
1. exportTab : removed call to javax/swing/JTabbedPane::insertTab → NO_COVERAGE |
target.insertTab(title, icon, cmp, tip, targetIndex); |
| 137 |
1
1. exportTab : removed call to javax/swing/JTabbedPane::setEnabledAt → NO_COVERAGE |
target.setEnabledAt(targetIndex, isEnabled); |
| 138 | ||
| 139 |
1
1. exportTab : removed call to javax/swing/JTabbedPane::setTabComponentAt → NO_COVERAGE |
target.setTabComponentAt(targetIndex, tab); |
| 140 |
1
1. exportTab : removed call to javax/swing/JTabbedPane::setSelectedIndex → NO_COVERAGE |
target.setSelectedIndex(targetIndex); |
| 141 | | |
| 142 |
1
1. exportTab : negated conditional → NO_COVERAGE |
if (tab instanceof JComponent) { |
| 143 |
1
1. exportTab : removed call to javax/swing/JComponent::scrollRectToVisible → NO_COVERAGE |
((JComponent) tab).scrollRectToVisible(tab.getBounds()); |
| 144 | } | |
| 145 | } | |
| 146 | | |
| 147 | public void convertTab(int prev, int next) { | |
| 148 | var cmp = this.getComponentAt(prev); | |
| 149 | var tab = this.getTabComponentAt(prev); | |
| 150 | String title = this.getTitleAt(prev); | |
| 151 | var icon = this.getIconAt(prev); | |
| 152 | String tip = this.getToolTipTextAt(prev); | |
| 153 | boolean isEnabled = this.isEnabledAt(prev); | |
| 154 |
3
1. convertTab : negated conditional → NO_COVERAGE 2. convertTab : Replaced integer subtraction with addition → NO_COVERAGE 3. convertTab : changed conditional boundary → NO_COVERAGE |
int tgtindex = prev > next ? next : next - 1; |
| 155 | | |
| 156 |
1
1. convertTab : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::remove → NO_COVERAGE |
this.remove(prev); |
| 157 |
1
1. convertTab : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::insertTab → NO_COVERAGE |
this.insertTab(title, icon, cmp, tip, tgtindex); |
| 158 |
1
1. convertTab : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::setEnabledAt → NO_COVERAGE |
this.setEnabledAt(tgtindex, isEnabled); |
| 159 | | |
| 160 | // When you drag'n'drop a disabled tab, it finishes enabled and selected. | |
| 161 | // pointed out by dlorde | |
| 162 |
1
1. convertTab : negated conditional → NO_COVERAGE |
if (isEnabled) { |
| 163 |
1
1. convertTab : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::setSelectedIndex → NO_COVERAGE |
this.setSelectedIndex(tgtindex); |
| 164 | } | |
| 165 | | |
| 166 | // I have a component in all tabs (jlabel with an X to close the tab) and when I move a tab the component disappear. | |
| 167 | // pointed out by Daniel Dario Morales Salas | |
| 168 |
1
1. convertTab : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::setTabComponentAt → NO_COVERAGE |
this.setTabComponentAt(tgtindex, tab); |
| 169 | } | |
| 170 | | |
| 171 | public Optional<Rectangle> getDropLineRect() { | |
| 172 | int index = Optional.ofNullable(this.getDropLocation()) | |
| 173 | .filter(DnDDropLocation::isDroppable) | |
| 174 | .map(DnDDropLocation::getIndex) | |
| 175 | .orElse(-1); | |
| 176 | | |
| 177 |
2
1. getDropLineRect : negated conditional → NO_COVERAGE 2. getDropLineRect : changed conditional boundary → NO_COVERAGE |
if (index < 0) { |
| 178 |
1
1. getDropLineRect : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE |
DnDTabbedPane.RECT_LINE.setBounds(0, 0, 0, 0); |
| 179 | return Optional.empty(); | |
| 180 | } | |
| 181 | | |
| 182 | int a = Math.min(index, 1); | |
| 183 |
2
1. getDropLineRect : Replaced integer subtraction with addition → NO_COVERAGE 2. getDropLineRect : Replaced integer multiplication with division → NO_COVERAGE |
Rectangle r = this.getBoundsAt(a * (index - 1)); |
| 184 | | |
| 185 |
1
1. getDropLineRect : negated conditional → NO_COVERAGE |
if (DnDTabbedPane.isTopBottomTabPlacement(this.getTabPlacement())) { |
| 186 |
4
1. getDropLineRect : Replaced integer subtraction with addition → NO_COVERAGE 2. getDropLineRect : Replaced integer addition with subtraction → NO_COVERAGE 3. getDropLineRect : Replaced integer multiplication with division → NO_COVERAGE 4. getDropLineRect : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE |
DnDTabbedPane.RECT_LINE.setBounds(r.x - DnDTabbedPane.LINE_WIDTH / 2 + r.width * a, r.y, DnDTabbedPane.LINE_WIDTH, r.height); |
| 187 | } else { | |
| 188 |
4
1. getDropLineRect : Replaced integer subtraction with addition → NO_COVERAGE 2. getDropLineRect : Replaced integer multiplication with division → NO_COVERAGE 3. getDropLineRect : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE 4. getDropLineRect : Replaced integer addition with subtraction → NO_COVERAGE |
DnDTabbedPane.RECT_LINE.setBounds(r.x, r.y - DnDTabbedPane.LINE_WIDTH / 2 + r.height * a, r.width, DnDTabbedPane.LINE_WIDTH); |
| 189 | } | |
| 190 | | |
| 191 |
1
1. getDropLineRect : replaced return value with Optional.empty for com/jsql/view/swing/tab/dnd/DnDTabbedPane::getDropLineRect → NO_COVERAGE |
return Optional.of(DnDTabbedPane.RECT_LINE); |
| 192 | } | |
| 193 | | |
| 194 | public Rectangle getTabAreaBounds() { | |
| 195 | Rectangle tabbedRect = this.getBounds(); | |
| 196 | int xx = tabbedRect.x; | |
| 197 | int yy = tabbedRect.y; | |
| 198 | | |
| 199 | Rectangle compRect = Optional.ofNullable(this.getSelectedComponent()) | |
| 200 | .map(Component::getBounds) | |
| 201 | .orElseGet(Rectangle::new); | |
| 202 | ||
| 203 | int tabPlacement = this.getTabPlacement(); | |
| 204 | | |
| 205 |
1
1. getTabAreaBounds : negated conditional → NO_COVERAGE |
if (DnDTabbedPane.isTopBottomTabPlacement(tabPlacement)) { |
| 206 |
1
1. getTabAreaBounds : Replaced integer subtraction with addition → NO_COVERAGE |
tabbedRect.height = tabbedRect.height - compRect.height; |
| 207 |
1
1. getTabAreaBounds : negated conditional → NO_COVERAGE |
if (tabPlacement == SwingConstants.BOTTOM) { |
| 208 |
2
1. getTabAreaBounds : Replaced integer addition with subtraction → NO_COVERAGE 2. getTabAreaBounds : Replaced integer addition with subtraction → NO_COVERAGE |
tabbedRect.y += compRect.y + compRect.height; |
| 209 | } | |
| 210 | } else { | |
| 211 |
1
1. getTabAreaBounds : Replaced integer subtraction with addition → NO_COVERAGE |
tabbedRect.width = tabbedRect.width - compRect.width; |
| 212 |
1
1. getTabAreaBounds : negated conditional → NO_COVERAGE |
if (tabPlacement == SwingConstants.RIGHT) { |
| 213 |
2
1. getTabAreaBounds : Replaced integer addition with subtraction → NO_COVERAGE 2. getTabAreaBounds : Replaced integer addition with subtraction → NO_COVERAGE |
tabbedRect.x += compRect.x + compRect.width; |
| 214 | } | |
| 215 | } | |
| 216 | | |
| 217 |
3
1. getTabAreaBounds : removed call to java/awt/Rectangle::translate → NO_COVERAGE 2. getTabAreaBounds : removed negation → NO_COVERAGE 3. getTabAreaBounds : removed negation → NO_COVERAGE |
tabbedRect.translate(-xx, -yy); |
| 218 |
1
1. getTabAreaBounds : replaced return value with null for com/jsql/view/swing/tab/dnd/DnDTabbedPane::getTabAreaBounds → NO_COVERAGE |
return tabbedRect; |
| 219 | } | |
| 220 | ||
| 221 | public static boolean isTopBottomTabPlacement(int tabPlacement) { | |
| 222 |
3
1. isTopBottomTabPlacement : replaced boolean return with true for com/jsql/view/swing/tab/dnd/DnDTabbedPane::isTopBottomTabPlacement → NO_COVERAGE 2. isTopBottomTabPlacement : negated conditional → NO_COVERAGE 3. isTopBottomTabPlacement : negated conditional → NO_COVERAGE |
return tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM; |
| 223 | } | |
| 224 | ||
| 225 | private class Handler extends MouseAdapter implements PropertyChangeListener { // , BeforeDrag | |
| 226 | | |
| 227 | private Point startPt; | |
| 228 | private final int gestureMotionThreshold = DragSource.getDragThreshold(); | |
| 229 | ||
| 230 | private void repaintDropLocation() { | |
| 231 | Component c = DnDTabbedPane.this.getRootPane().getGlassPane(); | |
| 232 |
1
1. repaintDropLocation : negated conditional → NO_COVERAGE |
if (c instanceof GhostGlassPane) { |
| 233 | GhostGlassPane glassPane = (GhostGlassPane) c; | |
| 234 |
1
1. repaintDropLocation : removed call to com/jsql/view/swing/tab/dnd/GhostGlassPane::setTargetTabbedPane → NO_COVERAGE |
glassPane.setTargetTabbedPane(DnDTabbedPane.this); |
| 235 |
1
1. repaintDropLocation : removed call to com/jsql/view/swing/tab/dnd/GhostGlassPane::repaint → NO_COVERAGE |
glassPane.repaint(); |
| 236 | } | |
| 237 | } | |
| 238 | | |
| 239 | // PropertyChangeListener | |
| 240 | @Override | |
| 241 | public void propertyChange(PropertyChangeEvent e) { | |
| 242 | String propertyName = e.getPropertyName(); | |
| 243 |
1
1. propertyChange : negated conditional → NO_COVERAGE |
if ("dropLocation".equals(propertyName)) { |
| 244 |
1
1. propertyChange : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane$Handler::repaintDropLocation → NO_COVERAGE |
this.repaintDropLocation(); |
| 245 | } | |
| 246 | } | |
| 247 | | |
| 248 | // MouseListener | |
| 249 | @Override | |
| 250 | public void mousePressed(MouseEvent e) { | |
| 251 | DnDTabbedPane src = (DnDTabbedPane) e.getComponent(); | |
| 252 |
2
1. mousePressed : negated conditional → NO_COVERAGE 2. mousePressed : changed conditional boundary → NO_COVERAGE |
boolean isOnlyOneTab = src.getTabCount() <= 1; |
| 253 |
1
1. mousePressed : negated conditional → NO_COVERAGE |
if (isOnlyOneTab) { |
| 254 | this.startPt = null; | |
| 255 | return; | |
| 256 | } | |
| 257 | | |
| 258 | var tabPt = e.getPoint(); | |
| 259 | int idx; | |
| 260 | // Fix #95782: IllegalArgumentException on indexAtLocation() | |
| 261 | try { | |
| 262 | idx = src.indexAtLocation(tabPt.x, tabPt.y); | |
| 263 | } catch (IllegalArgumentException err) { | |
| 264 | LOGGER.log(LogLevelUtil.CONSOLE_JAVA, err); | |
| 265 | return; | |
| 266 | } | |
| 267 | | |
| 268 | // disabled tab, null component problem. | |
| 269 | // pointed out by daryl. NullPointerException: i.e. addTab("Tab", null) | |
| 270 |
4
1. mousePressed : negated conditional → NO_COVERAGE 2. mousePressed : negated conditional → NO_COVERAGE 3. mousePressed : changed conditional boundary → NO_COVERAGE 4. mousePressed : negated conditional → NO_COVERAGE |
boolean flag = idx < 0 || !src.isEnabledAt(idx) || Objects.isNull(src.getComponentAt(idx)); |
| 271 | | |
| 272 |
1
1. mousePressed : negated conditional → NO_COVERAGE |
this.startPt = flag ? null : tabPt; |
| 273 | } | |
| 274 | | |
| 275 | @Override | |
| 276 | public void mouseDragged(MouseEvent e) { | |
| 277 | var tabPt = e.getPoint(); | |
| 278 |
3
1. mouseDragged : negated conditional → NO_COVERAGE 2. mouseDragged : negated conditional → NO_COVERAGE 3. mouseDragged : changed conditional boundary → NO_COVERAGE |
if (Objects.nonNull(this.startPt) && this.startPt.distance(tabPt) > this.gestureMotionThreshold) { |
| 279 | DnDTabbedPane src = (DnDTabbedPane) e.getComponent(); | |
| 280 | var th = src.getTransferHandler(); | |
| 281 | DnDTabbedPane.this.dragTabIndex = src.indexAtLocation(tabPt.x, tabPt.y); | |
| 282 | | |
| 283 | // Unhandled NoClassDefFoundError #56620: Could not initialize class java.awt.dnd.DragSource | |
| 284 |
1
1. mouseDragged : removed call to javax/swing/TransferHandler::exportAsDrag → NO_COVERAGE |
th.exportAsDrag(src, e, TransferHandler.MOVE); |
| 285 | ||
| 286 |
1
1. mouseDragged : removed call to java/awt/Rectangle::setBounds → NO_COVERAGE |
DnDTabbedPane.RECT_LINE.setBounds(0, 0, 0, 0); |
| 287 |
1
1. mouseDragged : removed call to java/awt/Component::setVisible → NO_COVERAGE |
src.getRootPane().getGlassPane().setVisible(true); |
| 288 |
1
1. mouseDragged : removed call to com/jsql/view/swing/tab/dnd/DnDTabbedPane::setDropLocation → NO_COVERAGE |
src.setDropLocation(new DnDDropLocation(tabPt, -1), true); |
| 289 | | |
| 290 | this.startPt = null; | |
| 291 | } | |
| 292 | } | |
| 293 | ||
| 294 | @Override | |
| 295 | public void mouseClicked(MouseEvent e) { | |
| 296 | var tabPt = e.getPoint(); | |
| 297 | JTabbedPane src = (JTabbedPane) e.getSource(); | |
| 298 | | |
| 299 | int i = src.indexAtLocation(tabPt.x, tabPt.y); | |
| 300 |
3
1. mouseClicked : negated conditional → NO_COVERAGE 2. mouseClicked : negated conditional → NO_COVERAGE 3. mouseClicked : changed conditional boundary → NO_COVERAGE |
if (-1 < i && e.getButton() == MouseEvent.BUTTON2) { |
| 301 |
1
1. mouseClicked : removed call to com/jsql/view/swing/action/ActionCloseTabResult::perform → NO_COVERAGE |
ActionCloseTabResult.perform(i); |
| 302 | } | |
| 303 | } | |
| 304 | } | |
| 305 | | |
| 306 | public final DnDDropLocation getDropLocation() { | |
| 307 |
1
1. getDropLocation : replaced return value with null for com/jsql/view/swing/tab/dnd/DnDTabbedPane::getDropLocation → NO_COVERAGE |
return this.dropLocation; |
| 308 | } | |
| 309 | } | |
Mutations | ||
| 42 |
1.1 |
|
| 50 |
1.1 2.2 |
|
| 59 |
1.1 |
|
| 60 |
1.1 |
|
| 62 |
1.1 |
|
| 68 |
1.1 |
|
| 71 |
1.1 |
|
| 77 |
1.1 |
|
| 78 |
1.1 |
|
| 79 |
1.1 2.2 3.3 4.4 |
|
| 81 |
1.1 |
|
| 82 |
1.1 2.2 3.3 4.4 |
|
| 85 |
1.1 |
|
| 86 |
1.1 |
|
| 87 |
1.1 |
|
| 88 |
1.1 |
|
| 96 |
1.1 |
|
| 97 |
1.1 |
|
| 98 |
1.1 |
|
| 102 |
1.1 2.2 |
|
| 103 |
1.1 |
|
| 104 |
1.1 |
|
| 108 |
1.1 |
|
| 109 |
1.1 |
|
| 112 |
1.1 |
|
| 118 |
1.1 2.2 |
|
| 120 |
1.1 |
|
| 124 |
1.1 |
|
| 135 |
1.1 |
|
| 136 |
1.1 |
|
| 137 |
1.1 |
|
| 139 |
1.1 |
|
| 140 |
1.1 |
|
| 142 |
1.1 |
|
| 143 |
1.1 |
|
| 154 |
1.1 2.2 3.3 |
|
| 156 |
1.1 |
|
| 157 |
1.1 |
|
| 158 |
1.1 |
|
| 162 |
1.1 |
|
| 163 |
1.1 |
|
| 168 |
1.1 |
|
| 177 |
1.1 2.2 |
|
| 178 |
1.1 |
|
| 183 |
1.1 2.2 |
|
| 185 |
1.1 |
|
| 186 |
1.1 2.2 3.3 4.4 |
|
| 188 |
1.1 2.2 3.3 4.4 |
|
| 191 |
1.1 |
|
| 205 |
1.1 |
|
| 206 |
1.1 |
|
| 207 |
1.1 |
|
| 208 |
1.1 2.2 |
|
| 211 |
1.1 |
|
| 212 |
1.1 |
|
| 213 |
1.1 2.2 |
|
| 217 |
1.1 2.2 3.3 |
|
| 218 |
1.1 |
|
| 222 |
1.1 2.2 3.3 |
|
| 232 |
1.1 |
|
| 234 |
1.1 |
|
| 235 |
1.1 |
|
| 243 |
1.1 |
|
| 244 |
1.1 |
|
| 252 |
1.1 2.2 |
|
| 253 |
1.1 |
|
| 270 |
1.1 2.2 3.3 4.4 |
|
| 272 |
1.1 |
|
| 278 |
1.1 2.2 3.3 |
|
| 284 |
1.1 |
|
| 286 |
1.1 |
|
| 287 |
1.1 |
|
| 288 |
1.1 |
|
| 300 |
1.1 2.2 3.3 |
|
| 301 |
1.1 |
|
| 307 |
1.1 |