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.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 | import com.jsql.view.swing.util.UiUtil; | |
17 | ||
18 | import javax.swing.*; | |
19 | import java.awt.*; | |
20 | ||
21 | /** | |
22 | * Column model creating a checkbox. | |
23 | * Used by renderer and editor. | |
24 | */ | |
25 | public class NodeModelColumn extends NodeModelEmpty { | |
26 | | |
27 | /** | |
28 | * Node as a column model. | |
29 | * @param column Element column coming from model | |
30 | */ | |
31 | public NodeModelColumn(Column column) { | |
32 | super(column); | |
33 | } | |
34 | ||
35 | @Override | |
36 | public Component getComponent( | |
37 | final JTree tree, Object nodeRenderer, final boolean isSelected, boolean isLeaf, boolean hasFocus | |
38 | ) { | |
39 | var checkbox = new JCheckBox(this.toString(), this.isSelected()); | |
40 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setText → NO_COVERAGE |
checkbox.setText(UiStringUtil.detectUtf8HtmlNoWrap(this.toString())); |
41 | ||
42 |
1
1. getComponent : negated conditional → NO_COVERAGE |
if (isSelected) { |
43 |
1
1. getComponent : negated conditional → NO_COVERAGE |
if (hasFocus) { |
44 | | |
45 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setBackground → NO_COVERAGE |
checkbox.setBackground(UiUtil.COLOR_FOCUS_GAINED); |
46 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setBorder → NO_COVERAGE |
checkbox.setBorder(UiUtil.BORDER_FOCUS_GAINED); |
47 | | |
48 | } else { | |
49 | | |
50 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setBackground → NO_COVERAGE |
checkbox.setBackground(UiUtil.COLOR_FOCUS_LOST); |
51 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setBorder → NO_COVERAGE |
checkbox.setBorder(UiUtil.BORDER_FOCUS_LOST); |
52 | } | |
53 | } else { | |
54 | | |
55 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setBackground → NO_COVERAGE |
checkbox.setBackground(Color.WHITE); |
56 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setBorder → NO_COVERAGE |
checkbox.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1)); |
57 | } | |
58 | | |
59 |
1
1. getComponent : removed call to javax/swing/JCheckBox::setComponentOrientation → NO_COVERAGE |
checkbox.setComponentOrientation(ComponentOrientation.getOrientation(I18nUtil.getLocaleDefault())); |
60 | | |
61 |
1
1. getComponent : replaced return value with null for com/jsql/view/swing/tree/model/NodeModelColumn::getComponent → NO_COVERAGE |
return checkbox; |
62 | } | |
63 | } | |
Mutations | ||
40 |
1.1 |
|
42 |
1.1 |
|
43 |
1.1 |
|
45 |
1.1 |
|
46 |
1.1 |
|
50 |
1.1 |
|
51 |
1.1 |
|
55 |
1.1 |
|
56 |
1.1 |
|
59 |
1.1 |
|
61 |
1.1 |