NodeModelColumn.java

1
/*******************************************************************************
2
 * Copyhacked (H) 2012-2025.
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 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.tree.model;
12
13
import com.jsql.model.bean.database.Column;
14
import com.jsql.util.I18nUtil;
15
import com.jsql.view.swing.util.UiStringUtil;
16
17
import javax.swing.*;
18
import java.awt.*;
19
20
/**
21
 * Column model creating a checkbox.
22
 * Used by renderer and editor.
23
 */
24
public class NodeModelColumn extends NodeModelEmpty {
25
    
26
    /**
27
     * Node as a column model.
28
     * @param column Element column coming from model
29
     */
30
    public NodeModelColumn(Column column) {
31
        super(column);
32
    }
33
34
    @Override
35
    public Component getComponent(
36
        final JTree tree, Object nodeRenderer, final boolean isSelected, boolean isLeaf, boolean hasFocus
37
    ) {
38
        var checkbox = new JCheckBox(this.toString(), this.isSelected());
39 1 1. getComponent : removed call to javax/swing/JCheckBox::setText → NO_COVERAGE
        checkbox.setText(UiStringUtil.detectUtf8HtmlNoWrap(this.toString()));
40 1 1. getComponent : removed call to javax/swing/JCheckBox::setComponentOrientation → NO_COVERAGE
        checkbox.setComponentOrientation(ComponentOrientation.getOrientation(I18nUtil.getCurrentLocale()));
41 1 1. getComponent : removed call to javax/swing/JCheckBox::setBackground → NO_COVERAGE
        checkbox.setBackground(
42 1 1. getComponent : negated conditional → NO_COVERAGE
            isSelected ? UIManager.getColor("Tree.selectionBackground") : UIManager.getColor("Tree.background")
43
        );  // required for transparency
44 1 1. getComponent : removed call to javax/swing/JCheckBox::setForeground → NO_COVERAGE
        checkbox.setForeground(  // required by macOS light (opposite text color)
45 1 1. getComponent : negated conditional → NO_COVERAGE
            isSelected ? UIManager.getColor("Tree.selectionForeground") : UIManager.getColor("Tree.foreground")
46
        );
47 1 1. getComponent : replaced return value with null for com/jsql/view/swing/tree/model/NodeModelColumn::getComponent → NO_COVERAGE
        return checkbox;
48
    }
49
}

Mutations

39

1.1
Location : getComponent
Killed by : none
removed call to javax/swing/JCheckBox::setText → NO_COVERAGE

40

1.1
Location : getComponent
Killed by : none
removed call to javax/swing/JCheckBox::setComponentOrientation → NO_COVERAGE

41

1.1
Location : getComponent
Killed by : none
removed call to javax/swing/JCheckBox::setBackground → NO_COVERAGE

42

1.1
Location : getComponent
Killed by : none
negated conditional → NO_COVERAGE

44

1.1
Location : getComponent
Killed by : none
removed call to javax/swing/JCheckBox::setForeground → NO_COVERAGE

45

1.1
Location : getComponent
Killed by : none
negated conditional → NO_COVERAGE

47

1.1
Location : getComponent
Killed by : none
replaced return value with null for com/jsql/view/swing/tree/model/NodeModelColumn::getComponent → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1