CellRendererNode.java

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;
12
13
import com.jsql.view.swing.tree.model.AbstractNodeModel;
14
15
import javax.swing.*;
16
import javax.swing.tree.DefaultMutableTreeNode;
17
import javax.swing.tree.DefaultTreeCellRenderer;
18
import java.awt.*;
19
20
/**
21
 * Render a tree node based on node model.
22
 * Can render default tree node, or node for database, table or column.
23
 */
24
public class CellRendererNode extends DefaultTreeCellRenderer {
25
    
26
    @Override
27
    public Component getTreeCellRendererComponent(
28
        JTree tree, Object nodeRenderer, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus
29
    ) {
30
        
31
        DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) nodeRenderer;
32
        var userObject = currentNode.getUserObject();
33
        AbstractNodeModel dataModel = (AbstractNodeModel) userObject;
34
        
35 1 1. getTreeCellRendererComponent : replaced return value with null for com/jsql/view/swing/tree/CellRendererNode::getTreeCellRendererComponent → NO_COVERAGE
        return dataModel.getComponent(tree, nodeRenderer, selected, leaf, hasFocus);
36
    }
37
}

Mutations

35

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

Active mutators

Tests examined


Report generated by PIT 1.16.1