AbstractNodeModel.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.model;
12
13
import com.jsql.model.bean.database.AbstractElementDatabase;
14
import com.jsql.model.suspendable.AbstractSuspendable;
15
import com.jsql.util.I18nUtil;
16
import com.jsql.util.LogLevelUtil;
17
import com.jsql.util.StringUtil;
18
import com.jsql.view.swing.menubar.JMenuItemWithMargin;
19
import com.jsql.view.swing.tree.*;
20
import com.jsql.view.swing.util.I18nViewUtil;
21
import com.jsql.view.swing.util.MediatorHelper;
22
import com.jsql.view.swing.util.UiStringUtil;
23
import com.jsql.view.swing.util.UiUtil;
24
import org.apache.logging.log4j.LogManager;
25
import org.apache.logging.log4j.Logger;
26
27
import javax.swing.*;
28
import javax.swing.tree.DefaultMutableTreeNode;
29
import javax.swing.tree.TreePath;
30
import java.awt.*;
31
import java.awt.event.MouseEvent;
32
33
/**
34
 * Model adding functional layer to the node ; used by renderer and editor.
35
 */
36
public abstract class AbstractNodeModel {
37
    
38
    /**
39
     * Log4j logger sent to view.
40
     */
41
    private static final Logger LOGGER = LogManager.getRootLogger();
42
    
43
    /**
44
     * Element from injection model in a linked list.
45
     */
46
    private AbstractElementDatabase elementDatabase;
47
48
    /**
49
     * Text for empty node.
50
     */
51
    private String textEmptyNode;
52
53
    /**
54
     * Current item injection progress regarding total number of elements.
55
     */
56
    private int indexProgress = 0;
57
58
    /**
59
     * Used by checkbox node ; true if checkbox is checked, false otherwise.
60
     */
61
    private boolean isSelected = false;
62
63
    /**
64
     * Indicates if process on current node is running.
65
     */
66
    private boolean isRunning = false;
67
68
    /**
69
     * True if current table node has checkbox selected, false otherwise.
70
     * Used to display popup menu and block injection start if no checkbox selected.
71
     */
72
    private boolean isContainingSelection = false;
73
74
    /**
75
     * True if current node has already been filled, false otherwise.
76
     * Used to display correct popup menu and block injection start if already done.
77
     */
78
    private boolean isLoaded = false;
79
80
    /**
81
     * True if current node is loading with unknown total number, false otherwise.
82
     * Used to display gif loader.
83
     */
84
    private boolean isProgressing = false;
85
86
    /**
87
     * True if current node is loading with total number known, false otherwise.
88
     * Used to display progress bar.
89
     */
90
    private boolean isLoading = false;
91
    
92
    private PanelNode panelNode;
93
94
    private boolean isEdited;
95
96
    /**
97
     * Create a functional model for tree node.
98
     * @param elementDatabase Database structural component
99
     */
100
    protected AbstractNodeModel(AbstractElementDatabase elementDatabase) {
101
        this.elementDatabase = elementDatabase;
102
    }
103
104
    /**
105
     * Create an empty model for tree node.
106
     * @param emptyObject Empty tree default node
107
     */
108
    protected AbstractNodeModel(String emptyObject) {
109
        this.textEmptyNode = emptyObject;
110
    }
111
    
112
    /**
113
     * Display a popupmenu on mouse right click if needed.
114
     * @param tablePopupMenu Menu to display
115
     * @param path Treepath of current node
116
     */
117
    protected abstract void buildMenu(JPopupMenuCustomExtract tablePopupMenu, TreePath path);
118
    
119
    /**
120
     * Check if menu should be opened.
121
     * i.e: does not show menu on database except during injection.
122
     * @return True if popupup should be opened, false otherwise
123
     */
124
    public abstract boolean isPopupDisplayable();
125
    
126
    /**
127
     * Get icon displayed next to the node text.
128
     * @param isLeaf True will display an arrow icon, false won't
129
     * @return Icon to display
130
     */
131
    protected abstract Icon getLeafIcon(boolean isLeaf);
132
    
133
    /**
134
     * Run injection process (see GUIMediator.model().dao).
135
     * Used by database and table nodes.
136
     */
137
    public abstract void runAction();
138
139
    /**
140
     * Display a popup menu for a database or table node.
141
     * @param currentTableNode Current node
142
     * @param path Path of current node
143
     */
144
    public void showPopup(DefaultMutableTreeNode currentTableNode, TreePath path, MouseEvent e) {
145
        
146
        var popupMenu = new JPopupMenuCustomExtract();
147
        AbstractSuspendable suspendableTask = MediatorHelper.model().getMediatorUtils().getThreadUtil().get(this.elementDatabase);
148
149 1 1. showPopup : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeItemLoadPause → NO_COVERAGE
        this.initializeItemLoadPause(currentTableNode, popupMenu, suspendableTask);
150 1 1. showPopup : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeItemRenameReload → NO_COVERAGE
        this.initializeItemRenameReload(currentTableNode, path, popupMenu);
151
152 1 1. showPopup : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::buildMenu → NO_COVERAGE
        this.buildMenu(popupMenu, path);
153
        
154 1 1. showPopup : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::displayPopupMenu → NO_COVERAGE
        this.displayPopupMenu(e, popupMenu);
155
    }
156
157
    private void displayPopupMenu(MouseEvent e, JPopupMenuCustomExtract popupMenu) {
158
        
159 1 1. displayPopupMenu : removed call to com/jsql/view/swing/tree/model/JPopupMenuCustomExtract::applyComponentOrientation → NO_COVERAGE
        popupMenu.applyComponentOrientation(ComponentOrientation.getOrientation(I18nUtil.getLocaleDefault()));
160
161 1 1. displayPopupMenu : removed call to com/jsql/view/swing/tree/model/JPopupMenuCustomExtract::show → NO_COVERAGE
        popupMenu.show(
162
            MediatorHelper.treeDatabase(),
163 1 1. displayPopupMenu : negated conditional → NO_COVERAGE
            ComponentOrientation.RIGHT_TO_LEFT.equals(ComponentOrientation.getOrientation(I18nUtil.getLocaleDefault()))
164 1 1. displayPopupMenu : Replaced integer subtraction with addition → NO_COVERAGE
            ? e.getX() - popupMenu.getWidth()
165
            : e.getX(),
166
            e.getY()
167
        );
168
        
169 1 1. displayPopupMenu : removed call to com/jsql/view/swing/tree/model/JPopupMenuCustomExtract::setLocation → NO_COVERAGE
        popupMenu.setLocation(
170 1 1. displayPopupMenu : negated conditional → NO_COVERAGE
            ComponentOrientation.RIGHT_TO_LEFT.equals(ComponentOrientation.getOrientation(I18nUtil.getLocaleDefault()))
171 1 1. displayPopupMenu : Replaced integer subtraction with addition → NO_COVERAGE
            ? e.getXOnScreen() - popupMenu.getWidth()
172
            : e.getXOnScreen(),
173
            e.getYOnScreen()
174
        );
175
    }
176
177
    private void initializeItemRenameReload(DefaultMutableTreeNode currentTableNode, TreePath path, JPopupMenuCustomExtract popupMenu) {
178
        
179
        String textReload;
180
        
181 1 1. initializeItemRenameReload : negated conditional → NO_COVERAGE
        if (this instanceof NodeModelDatabase) {
182
            textReload = I18nViewUtil.valueByKey("RELOAD_TABLES");
183 1 1. initializeItemRenameReload : negated conditional → NO_COVERAGE
        } else if (this instanceof NodeModelTable) {
184
            textReload = I18nViewUtil.valueByKey("RELOAD_COLUMNS");
185
        } else {
186
            textReload = "?";
187
        }
188
        
189
        JMenuItem menuItemReload = new JMenuItemWithMargin(textReload);
190
191 2 1. initializeItemRenameReload : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
2. initializeItemRenameReload : negated conditional → NO_COVERAGE
        menuItemReload.setEnabled(!this.isRunning);
192 2 1. initializeItemRenameReload : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
2. lambda$initializeItemRenameReload$0 : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::runAction → NO_COVERAGE
        menuItemReload.addActionListener(actionEvent -> AbstractNodeModel.this.runAction());
193
        
194
        JMenuItem menuItemRename = new JMenuItemWithMargin(I18nViewUtil.valueByKey("RENAME_NODE"));
195
        
196 2 1. initializeItemRenameReload : negated conditional → NO_COVERAGE
2. initializeItemRenameReload : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
        menuItemRename.setEnabled(!this.isRunning);
197 1 1. initializeItemRenameReload : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
        menuItemRename.addActionListener(actionEvent -> {
198
            
199
            AbstractNodeModel nodeModel = (AbstractNodeModel) currentTableNode.getUserObject();
200 1 1. lambda$initializeItemRenameReload$1 : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::setIsEdited → NO_COVERAGE
            nodeModel.setIsEdited(true);
201
            
202 1 1. lambda$initializeItemRenameReload$1 : removed call to javax/swing/JLabel::setVisible → NO_COVERAGE
            AbstractNodeModel.this.getPanel().getLabel().setVisible(false);
203 1 1. lambda$initializeItemRenameReload$1 : removed call to javax/swing/JTextField::setVisible → NO_COVERAGE
            AbstractNodeModel.this.getPanel().getEditable().setVisible(true);
204
            
205 1 1. lambda$initializeItemRenameReload$1 : removed call to com/jsql/view/swing/tree/TreeDatabase::setSelectionPath → NO_COVERAGE
            MediatorHelper.treeDatabase().setSelectionPath(path);
206
        });
207
        
208
        popupMenu.add(new JSeparator());
209
        popupMenu.add(menuItemRename);
210
        popupMenu.add(menuItemReload);
211
    }
212
213
    private void initializeItemLoadPause(
214
        DefaultMutableTreeNode currentTableNode,
215
        JPopupMenuCustomExtract popupMenu,
216
        AbstractSuspendable suspendableTask
217
    ) {
218
        JMenuItem menuItemLoad = new JMenuItemWithMargin(
219 1 1. initializeItemLoadPause : negated conditional → NO_COVERAGE
            this.isRunning
220
            ? I18nViewUtil.valueByKey("THREAD_STOP")
221
            : I18nViewUtil.valueByKey("THREAD_LOAD"),
222
            'o'
223
        );
224
        
225 2 1. initializeItemLoadPause : negated conditional → NO_COVERAGE
2. initializeItemLoadPause : negated conditional → NO_COVERAGE
        if (!this.isContainingSelection && !this.isRunning) {
226 1 1. initializeItemLoadPause : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
            menuItemLoad.setEnabled(false);
227
        }
228
        
229 1 1. initializeItemLoadPause : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
        menuItemLoad.addActionListener(new ActionLoadStop(this, currentTableNode));
230
231
        JMenuItem menuItemPause = new JMenuItemWithMargin(
232
            // Report #133: ignore if thread not found
233 2 1. initializeItemLoadPause : negated conditional → NO_COVERAGE
2. initializeItemLoadPause : negated conditional → NO_COVERAGE
            suspendableTask != null && suspendableTask.isPaused()
234
            ? I18nViewUtil.valueByKey("THREAD_RESUME")
235
            : I18nViewUtil.valueByKey("THREAD_PAUSE"),
236
            's'
237
        );
238
239 1 1. initializeItemLoadPause : negated conditional → NO_COVERAGE
        if (!this.isRunning) {
240 1 1. initializeItemLoadPause : removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE
            menuItemPause.setEnabled(false);
241
        }
242 1 1. initializeItemLoadPause : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
        menuItemPause.addActionListener(new ActionPauseUnpause(this));
243
        
244
        popupMenu.add(menuItemLoad);
245
        popupMenu.add(menuItemPause);
246
    }
247
    
248
    /**
249
     * Draw the panel component based on node model.
250
     * @param tree
251
     * @param nodeRenderer
252
     * @param isSelected
253
     * @param isLeaf
254
     * @param hasFocus
255
     * @return
256
     */
257
    public Component getComponent(
258
        final JTree tree,
259
        Object nodeRenderer,
260
        final boolean isSelected,
261
        boolean isLeaf,
262
        boolean hasFocus
263
    ) {
264
        DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) nodeRenderer;
265
        this.panelNode = new PanelNode(tree, currentNode);
266
267 1 1. getComponent : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeIcon → NO_COVERAGE
        this.initializeIcon(isLeaf);
268
        
269
        AbstractNodeModel nodeModel = (AbstractNodeModel) currentNode.getUserObject();
270
        
271 1 1. getComponent : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeEditable → NO_COVERAGE
        this.initializeEditable(nodeModel.isEdited);
272 1 1. getComponent : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeLabel → NO_COVERAGE
        this.initializeLabel(isSelected, hasFocus, nodeModel.isEdited);
273 1 1. getComponent : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeProgress → NO_COVERAGE
        this.initializeProgress(currentNode);
274
        
275 1 1. getComponent : replaced return value with null for com/jsql/view/swing/tree/model/AbstractNodeModel::getComponent → NO_COVERAGE
        return this.panelNode;
276
    }
277
278
    private void initializeIcon(boolean isLeaf) {
279
        
280 1 1. initializeIcon : removed call to com/jsql/view/swing/tree/PanelNode::showIcon → NO_COVERAGE
        this.panelNode.showIcon();
281 1 1. initializeIcon : removed call to com/jsql/view/swing/tree/PanelNode::setIcon → NO_COVERAGE
        this.panelNode.setIcon(this.getLeafIcon(isLeaf));
282
    }
283
284
    private void initializeProgress(DefaultMutableTreeNode currentNode) {
285
        
286 1 1. initializeProgress : negated conditional → NO_COVERAGE
        if (this.isLoading) {
287
            
288 1 1. initializeProgress : removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::displayProgress → NO_COVERAGE
            this.displayProgress(this.panelNode, currentNode);
289 1 1. initializeProgress : removed call to com/jsql/view/swing/tree/PanelNode::hideIcon → NO_COVERAGE
            this.panelNode.hideIcon();
290
            
291 1 1. initializeProgress : negated conditional → NO_COVERAGE
        } else if (this.isProgressing) {
292
            
293 1 1. initializeProgress : removed call to com/jsql/view/swing/tree/PanelNode::showLoader → NO_COVERAGE
            this.panelNode.showLoader();
294 1 1. initializeProgress : removed call to com/jsql/view/swing/tree/PanelNode::hideIcon → NO_COVERAGE
            this.panelNode.hideIcon();
295
296
            AbstractSuspendable suspendableTask = MediatorHelper.model().getMediatorUtils().getThreadUtil().get(this.elementDatabase);
297 2 1. initializeProgress : negated conditional → NO_COVERAGE
2. initializeProgress : negated conditional → NO_COVERAGE
            if (suspendableTask != null && suspendableTask.isPaused()) {
298
                
299
                ImageIcon animatedGIFPaused = new ImageOverlap(UiUtil.PATH_PROGRESSBAR, UiUtil.PATH_PAUSE);
300
                
301 1 1. initializeProgress : removed call to javax/swing/ImageIcon::setImageObserver → NO_COVERAGE
                animatedGIFPaused.setImageObserver(
302
                    new ImageObserverAnimated(
303
                        MediatorHelper.treeDatabase(),
304
                        currentNode
305
                    )
306
                );
307
                
308 1 1. initializeProgress : removed call to com/jsql/view/swing/tree/PanelNode::setLoaderIcon → NO_COVERAGE
                this.panelNode.setLoaderIcon(animatedGIFPaused);
309
            }
310
        }
311
    }
312
313
    private void initializeLabel(final boolean isSelected, boolean hasFocus, boolean isEdited) {
314
        
315
        // Fix #90521: NullPointerException on setText()
316
        try {
317 1 1. initializeLabel : removed call to javax/swing/JLabel::setText → NO_COVERAGE
            this.panelNode.getLabel().setText(UiStringUtil.detectUtf8Html(this.toString()));
318
        } catch (NullPointerException e) {
319
            LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e);
320
        }
321
        
322 2 1. initializeLabel : removed call to javax/swing/JLabel::setVisible → NO_COVERAGE
2. initializeLabel : negated conditional → NO_COVERAGE
        this.panelNode.getLabel().setVisible(!isEdited);
323
324 1 1. initializeLabel : negated conditional → NO_COVERAGE
        if (isSelected) {
325 1 1. initializeLabel : negated conditional → NO_COVERAGE
            if (hasFocus) {
326
                
327 1 1. initializeLabel : removed call to javax/swing/JLabel::setBackground → NO_COVERAGE
                this.panelNode.getLabel().setBackground(UiUtil.COLOR_FOCUS_GAINED);
328 1 1. initializeLabel : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE
                this.panelNode.getLabel().setBorder(UiUtil.BORDER_FOCUS_GAINED);
329
                
330
            } else {
331
                
332 1 1. initializeLabel : removed call to javax/swing/JLabel::setBackground → NO_COVERAGE
                this.panelNode.getLabel().setBackground(UiUtil.COLOR_FOCUS_LOST);
333 1 1. initializeLabel : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE
                this.panelNode.getLabel().setBorder(UiUtil.BORDER_FOCUS_LOST);
334
            }
335
        } else {
336
            
337 1 1. initializeLabel : removed call to javax/swing/JLabel::setBackground → NO_COVERAGE
            this.panelNode.getLabel().setBackground(Color.WHITE);
338 1 1. initializeLabel : removed call to javax/swing/JLabel::setBorder → NO_COVERAGE
            this.panelNode.getLabel().setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
339
        }
340
    }
341
342
    private void initializeEditable(boolean isEdited) {
343
        
344 1 1. initializeEditable : negated conditional → NO_COVERAGE
        if (StringUtil.isUtf8(this.getElementDatabase().toString())) {
345 1 1. initializeEditable : removed call to javax/swing/JTextField::setFont → NO_COVERAGE
            this.panelNode.getEditable().setFont(UiUtil.FONT_MONO_ASIAN);
346
        } else {
347 1 1. initializeEditable : removed call to javax/swing/JTextField::setFont → NO_COVERAGE
            this.panelNode.getEditable().setFont(UiUtil.FONT_NON_MONO);
348
        }
349
        
350 1 1. initializeEditable : removed call to javax/swing/JTextField::setText → NO_COVERAGE
        this.panelNode.getEditable().setText(StringUtil.detectUtf8(this.getElementDatabase().toString()));
351 1 1. initializeEditable : removed call to javax/swing/JTextField::setVisible → NO_COVERAGE
        this.panelNode.getEditable().setVisible(isEdited);
352
    }
353
    
354
    /**
355
     * Update progressbar ; display the pause icon if node is paused.
356
     * @param panelNode Panel that contains the bar to update
357
     * @param currentNode Functional node model object
358
     */
359
    protected void displayProgress(PanelNode panelNode, DefaultMutableTreeNode currentNode) {
360
        
361
        int dataCount = this.elementDatabase.getChildCount();
362 1 1. displayProgress : removed call to com/jsql/view/swing/tree/ProgressBarPausable::setMaximum → NO_COVERAGE
        panelNode.getProgressBar().setMaximum(dataCount);
363 1 1. displayProgress : removed call to com/jsql/view/swing/tree/ProgressBarPausable::setValue → NO_COVERAGE
        panelNode.getProgressBar().setValue(this.indexProgress);
364 1 1. displayProgress : removed call to com/jsql/view/swing/tree/ProgressBarPausable::setVisible → NO_COVERAGE
        panelNode.getProgressBar().setVisible(true);
365
        
366
        // Report #135: ignore if thread not found
367
        AbstractSuspendable suspendableTask = MediatorHelper.model().getMediatorUtils().getThreadUtil().get(this.elementDatabase);
368
        
369 2 1. displayProgress : negated conditional → NO_COVERAGE
2. displayProgress : negated conditional → NO_COVERAGE
        if (suspendableTask != null && suspendableTask.isPaused()) {
370 1 1. displayProgress : removed call to com/jsql/view/swing/tree/ProgressBarPausable::pause → NO_COVERAGE
            panelNode.getProgressBar().pause();
371
        }
372
    }
373
    
374
    @Override
375
    public String toString() {
376 2 1. toString : negated conditional → NO_COVERAGE
2. toString : replaced return value with "" for com/jsql/view/swing/tree/model/AbstractNodeModel::toString → NO_COVERAGE
        return this.elementDatabase != null ? this.elementDatabase.getLabelCount() : this.textEmptyNode;
377
    }
378
    
379
    
380
    // Getter and setter
381
382
    /**
383
     * Get the database parent of current node.
384
     * @return Parent
385
     */
386
    protected AbstractElementDatabase getParent() {
387 1 1. getParent : replaced return value with null for com/jsql/view/swing/tree/model/AbstractNodeModel::getParent → NO_COVERAGE
        return this.elementDatabase.getParent();
388
    }
389
390
    public AbstractElementDatabase getElementDatabase() {
391 1 1. getElementDatabase : replaced return value with null for com/jsql/view/swing/tree/model/AbstractNodeModel::getElementDatabase → NO_COVERAGE
        return this.elementDatabase;
392
    }
393
394
    public int getIndexProgress() {
395 1 1. getIndexProgress : replaced int return with 0 for com/jsql/view/swing/tree/model/AbstractNodeModel::getIndexProgress → NO_COVERAGE
        return this.indexProgress;
396
    }
397
398
    public void setIndexProgress(int indexProgress) {
399
        this.indexProgress = indexProgress;
400
    }
401
402
    public boolean isSelected() {
403 2 1. isSelected : replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isSelected → NO_COVERAGE
2. isSelected : replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isSelected → NO_COVERAGE
        return this.isSelected;
404
    }
405
406
    public void setSelected(boolean isSelected) {
407
        this.isSelected = isSelected;
408
    }
409
410
    public boolean isRunning() {
411 2 1. isRunning : replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isRunning → NO_COVERAGE
2. isRunning : replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isRunning → NO_COVERAGE
        return this.isRunning;
412
    }
413
414
    public void setRunning(boolean isRunning) {
415
        this.isRunning = isRunning;
416
    }
417
418
    public boolean isContainingSelection() {
419 2 1. isContainingSelection : replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isContainingSelection → NO_COVERAGE
2. isContainingSelection : replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isContainingSelection → NO_COVERAGE
        return this.isContainingSelection;
420
    }
421
422
    public void setContainingSelection(boolean isContainingSelection) {
423
        this.isContainingSelection = isContainingSelection;
424
    }
425
426
    public boolean isLoaded() {
427 2 1. isLoaded : replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoaded → NO_COVERAGE
2. isLoaded : replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoaded → NO_COVERAGE
        return this.isLoaded;
428
    }
429
430
    public void setLoaded(boolean isLoaded) {
431
        this.isLoaded = isLoaded;
432
    }
433
434
    public boolean isProgressing() {
435 2 1. isProgressing : replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isProgressing → NO_COVERAGE
2. isProgressing : replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isProgressing → NO_COVERAGE
        return this.isProgressing;
436
    }
437
438
    public void setProgressing(boolean isProgressing) {
439
        this.isProgressing = isProgressing;
440
    }
441
442
    public boolean isLoading() {
443 2 1. isLoading : replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoading → NO_COVERAGE
2. isLoading : replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoading → NO_COVERAGE
        return this.isLoading;
444
    }
445
446
    public void setLoading(boolean isLoading) {
447
        this.isLoading = isLoading;
448
    }
449
450
    public PanelNode getPanel() {
451 1 1. getPanel : replaced return value with null for com/jsql/view/swing/tree/model/AbstractNodeModel::getPanel → NO_COVERAGE
        return this.panelNode;
452
    }
453
454
    public void setIsEdited(boolean isEdited) {
455
        this.isEdited = isEdited;
456
    }
457
    
458
    public void setText(String textI18n) {
459
        this.textEmptyNode = textI18n;
460
    }
461
}

Mutations

149

1.1
Location : showPopup
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeItemLoadPause → NO_COVERAGE

150

1.1
Location : showPopup
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeItemRenameReload → NO_COVERAGE

152

1.1
Location : showPopup
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::buildMenu → NO_COVERAGE

154

1.1
Location : showPopup
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::displayPopupMenu → NO_COVERAGE

159

1.1
Location : displayPopupMenu
Killed by : none
removed call to com/jsql/view/swing/tree/model/JPopupMenuCustomExtract::applyComponentOrientation → NO_COVERAGE

161

1.1
Location : displayPopupMenu
Killed by : none
removed call to com/jsql/view/swing/tree/model/JPopupMenuCustomExtract::show → NO_COVERAGE

163

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

164

1.1
Location : displayPopupMenu
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

169

1.1
Location : displayPopupMenu
Killed by : none
removed call to com/jsql/view/swing/tree/model/JPopupMenuCustomExtract::setLocation → NO_COVERAGE

170

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

171

1.1
Location : displayPopupMenu
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

181

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

183

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

191

1.1
Location : initializeItemRenameReload
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

2.2
Location : initializeItemRenameReload
Killed by : none
negated conditional → NO_COVERAGE

192

1.1
Location : initializeItemRenameReload
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

2.2
Location : lambda$initializeItemRenameReload$0
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::runAction → NO_COVERAGE

196

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

2.2
Location : initializeItemRenameReload
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

197

1.1
Location : initializeItemRenameReload
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

200

1.1
Location : lambda$initializeItemRenameReload$1
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::setIsEdited → NO_COVERAGE

202

1.1
Location : lambda$initializeItemRenameReload$1
Killed by : none
removed call to javax/swing/JLabel::setVisible → NO_COVERAGE

203

1.1
Location : lambda$initializeItemRenameReload$1
Killed by : none
removed call to javax/swing/JTextField::setVisible → NO_COVERAGE

205

1.1
Location : lambda$initializeItemRenameReload$1
Killed by : none
removed call to com/jsql/view/swing/tree/TreeDatabase::setSelectionPath → NO_COVERAGE

219

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

225

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

2.2
Location : initializeItemLoadPause
Killed by : none
negated conditional → NO_COVERAGE

226

1.1
Location : initializeItemLoadPause
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

229

1.1
Location : initializeItemLoadPause
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

233

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

2.2
Location : initializeItemLoadPause
Killed by : none
negated conditional → NO_COVERAGE

239

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

240

1.1
Location : initializeItemLoadPause
Killed by : none
removed call to javax/swing/JMenuItem::setEnabled → NO_COVERAGE

242

1.1
Location : initializeItemLoadPause
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

267

1.1
Location : getComponent
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeIcon → NO_COVERAGE

271

1.1
Location : getComponent
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeEditable → NO_COVERAGE

272

1.1
Location : getComponent
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeLabel → NO_COVERAGE

273

1.1
Location : getComponent
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::initializeProgress → NO_COVERAGE

275

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

280

1.1
Location : initializeIcon
Killed by : none
removed call to com/jsql/view/swing/tree/PanelNode::showIcon → NO_COVERAGE

281

1.1
Location : initializeIcon
Killed by : none
removed call to com/jsql/view/swing/tree/PanelNode::setIcon → NO_COVERAGE

286

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

288

1.1
Location : initializeProgress
Killed by : none
removed call to com/jsql/view/swing/tree/model/AbstractNodeModel::displayProgress → NO_COVERAGE

289

1.1
Location : initializeProgress
Killed by : none
removed call to com/jsql/view/swing/tree/PanelNode::hideIcon → NO_COVERAGE

291

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

293

1.1
Location : initializeProgress
Killed by : none
removed call to com/jsql/view/swing/tree/PanelNode::showLoader → NO_COVERAGE

294

1.1
Location : initializeProgress
Killed by : none
removed call to com/jsql/view/swing/tree/PanelNode::hideIcon → NO_COVERAGE

297

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

2.2
Location : initializeProgress
Killed by : none
negated conditional → NO_COVERAGE

301

1.1
Location : initializeProgress
Killed by : none
removed call to javax/swing/ImageIcon::setImageObserver → NO_COVERAGE

308

1.1
Location : initializeProgress
Killed by : none
removed call to com/jsql/view/swing/tree/PanelNode::setLoaderIcon → NO_COVERAGE

317

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setText → NO_COVERAGE

322

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setVisible → NO_COVERAGE

2.2
Location : initializeLabel
Killed by : none
negated conditional → NO_COVERAGE

324

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

325

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

327

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setBackground → NO_COVERAGE

328

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setBorder → NO_COVERAGE

332

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setBackground → NO_COVERAGE

333

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setBorder → NO_COVERAGE

337

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setBackground → NO_COVERAGE

338

1.1
Location : initializeLabel
Killed by : none
removed call to javax/swing/JLabel::setBorder → NO_COVERAGE

344

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

345

1.1
Location : initializeEditable
Killed by : none
removed call to javax/swing/JTextField::setFont → NO_COVERAGE

347

1.1
Location : initializeEditable
Killed by : none
removed call to javax/swing/JTextField::setFont → NO_COVERAGE

350

1.1
Location : initializeEditable
Killed by : none
removed call to javax/swing/JTextField::setText → NO_COVERAGE

351

1.1
Location : initializeEditable
Killed by : none
removed call to javax/swing/JTextField::setVisible → NO_COVERAGE

362

1.1
Location : displayProgress
Killed by : none
removed call to com/jsql/view/swing/tree/ProgressBarPausable::setMaximum → NO_COVERAGE

363

1.1
Location : displayProgress
Killed by : none
removed call to com/jsql/view/swing/tree/ProgressBarPausable::setValue → NO_COVERAGE

364

1.1
Location : displayProgress
Killed by : none
removed call to com/jsql/view/swing/tree/ProgressBarPausable::setVisible → NO_COVERAGE

369

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

2.2
Location : displayProgress
Killed by : none
negated conditional → NO_COVERAGE

370

1.1
Location : displayProgress
Killed by : none
removed call to com/jsql/view/swing/tree/ProgressBarPausable::pause → NO_COVERAGE

376

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

2.2
Location : toString
Killed by : none
replaced return value with "" for com/jsql/view/swing/tree/model/AbstractNodeModel::toString → NO_COVERAGE

387

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

391

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

395

1.1
Location : getIndexProgress
Killed by : none
replaced int return with 0 for com/jsql/view/swing/tree/model/AbstractNodeModel::getIndexProgress → NO_COVERAGE

403

1.1
Location : isSelected
Killed by : none
replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isSelected → NO_COVERAGE

2.2
Location : isSelected
Killed by : none
replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isSelected → NO_COVERAGE

411

1.1
Location : isRunning
Killed by : none
replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isRunning → NO_COVERAGE

2.2
Location : isRunning
Killed by : none
replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isRunning → NO_COVERAGE

419

1.1
Location : isContainingSelection
Killed by : none
replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isContainingSelection → NO_COVERAGE

2.2
Location : isContainingSelection
Killed by : none
replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isContainingSelection → NO_COVERAGE

427

1.1
Location : isLoaded
Killed by : none
replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoaded → NO_COVERAGE

2.2
Location : isLoaded
Killed by : none
replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoaded → NO_COVERAGE

435

1.1
Location : isProgressing
Killed by : none
replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isProgressing → NO_COVERAGE

2.2
Location : isProgressing
Killed by : none
replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isProgressing → NO_COVERAGE

443

1.1
Location : isLoading
Killed by : none
replaced boolean return with true for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoading → NO_COVERAGE

2.2
Location : isLoading
Killed by : none
replaced boolean return with false for com/jsql/view/swing/tree/model/AbstractNodeModel::isLoading → NO_COVERAGE

451

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

Active mutators

Tests examined


Report generated by PIT 1.16.1