1
2
3
4
5
6
7
8
9
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
22
23
24 public class NodeModelColumn extends NodeModelEmpty {
25
26
27
28
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 checkbox.setText(UiStringUtil.detectUtf8HtmlNoWrap(this.toString()));
40 checkbox.setComponentOrientation(ComponentOrientation.getOrientation(I18nUtil.getCurrentLocale()));
41 checkbox.setBackground(
42 isSelected ? UIManager.getColor("Tree.selectionBackground") : UIManager.getColor("Tree.background")
43 );
44 checkbox.setForeground(
45 isSelected ? UIManager.getColor("Tree.selectionForeground") : UIManager.getColor("Tree.foreground")
46 );
47 return checkbox;
48 }
49 }