MenuWindows.java

1
package com.jsql.view.swing.menubar;
2
3
import com.formdev.flatlaf.intellijthemes.FlatDarkFlatIJTheme;
4
import com.formdev.flatlaf.intellijthemes.FlatHighContrastIJTheme;
5
import com.formdev.flatlaf.intellijthemes.FlatLightFlatIJTheme;
6
import com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMTGitHubDarkIJTheme;
7
import com.formdev.flatlaf.intellijthemes.materialthemeuilite.FlatMTGitHubIJTheme;
8
import com.formdev.flatlaf.themes.FlatMacDarkLaf;
9
import com.formdev.flatlaf.themes.FlatMacLightLaf;
10
import com.jsql.model.InjectionModel;
11
import com.jsql.util.I18nUtil;
12
import com.jsql.util.LogLevelUtil;
13
import com.jsql.util.PreferencesUtil;
14
import com.jsql.view.swing.action.ActionNewWindow;
15
import com.jsql.view.swing.dialog.translate.Language;
16
import com.jsql.view.swing.panel.PanelPreferences;
17
import com.jsql.view.swing.sql.SqlEngine;
18
import com.jsql.view.swing.tab.TabHeader;
19
import com.jsql.view.swing.util.I18nViewUtil;
20
import com.jsql.view.swing.util.MediatorHelper;
21
import com.jsql.view.swing.util.RadioItemPreventClose;
22
import com.jsql.view.swing.util.UiUtil;
23
import org.apache.logging.log4j.LogManager;
24
import org.apache.logging.log4j.Logger;
25
26
import javax.swing.*;
27
import java.awt.*;
28
import java.awt.event.ActionEvent;
29
import java.awt.event.InputEvent;
30
import java.awt.event.KeyEvent;
31
import java.awt.event.MouseEvent;
32
import java.util.AbstractMap;
33
import java.util.Arrays;
34
import java.util.Locale;
35
import java.util.concurrent.atomic.AtomicBoolean;
36
import java.util.concurrent.atomic.AtomicInteger;
37
import java.util.prefs.Preferences;
38
39
public class MenuWindows extends JMenu {
40
41
    /**
42
     * Log4j logger sent to view.
43
     */
44
    private static final Logger LOGGER = LogManager.getRootLogger();
45
46
    private static final String I18N_SQL_ENGINE = "MENUBAR_SQL_ENGINE";
47
    private static final String I18N_PREFERENCES = "MENUBAR_PREFERENCES";
48
    private final AppMenubar appMenubar;
49
50
    private final JMenu menuView;
51
52
    public MenuWindows(AppMenubar appMenubar) {
53
        super(I18nUtil.valueByKey("MENUBAR_WINDOWS"));
54
        this.appMenubar = appMenubar;
55
56 1 1. <init> : removed call to com/jsql/view/swing/menubar/MenuWindows::setName → NO_COVERAGE
        this.setName("menuWindows");
57 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey("MENUBAR_WINDOWS", this);
58 1 1. <init> : removed call to com/jsql/view/swing/menubar/MenuWindows::setMnemonic → NO_COVERAGE
        this.setMnemonic('W');
59
60
        JMenuItem itemNewWindows = new JMenuItem(new ActionNewWindow());
61 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey("NEW_WINDOW_MENU", itemNewWindows);
62
63
        this.add(itemNewWindows);
64
        var menuAppearance = new JMenu(I18nUtil.valueByKey("MENUBAR_APPEARANCE"));
65 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey("MENUBAR_APPEARANCE", menuAppearance);
66 1 1. <init> : removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE
        menuAppearance.setMnemonic('A');
67
68
        JMenuItem itemNewWindows4k = new JMenuItem(
69
            new ActionNewWindow("New 4K Window", "-Dsun.java2d.uiScale=2.5")
70
        );
71
        menuAppearance.add(itemNewWindows4k);
72
73
        var groupRadio = new ButtonGroup();
74
        var menuThemes = new JMenu(I18nUtil.valueByKey("MENUBAR_THEMES"));
75 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey("MENUBAR_THEMES", menuAppearance);
76 1 1. <init> : removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE
        menuThemes.setMnemonic('T');
77
78
        Arrays.asList(
79
            new AbstractMap.SimpleEntry<>(FlatLightFlatIJTheme.class.getName(), "IntelliJ"),
80
            new AbstractMap.SimpleEntry<>(FlatDarkFlatIJTheme.class.getName(), "IntelliJ Dark"),
81
            new AbstractMap.SimpleEntry<>(FlatMacLightLaf.class.getName(), "macOS"),
82
            new AbstractMap.SimpleEntry<>(FlatMacDarkLaf.class.getName(), "macOS Dark"),
83
            new AbstractMap.SimpleEntry<>(FlatMTGitHubIJTheme.class.getName(), "GitHub"),
84
            new AbstractMap.SimpleEntry<>(FlatMTGitHubDarkIJTheme.class.getName(), "GitHub Dark"),
85
            new AbstractMap.SimpleEntry<>(FlatHighContrastIJTheme.class.getName(), "High contrast")
86 1 1. <init> : removed call to java/util/List::forEach → NO_COVERAGE
        ).forEach(entry -> {
87
            JMenuItem item = new RadioItemPreventClose(
88
                new AbstractAction() {
89
                    @Override
90
                    public void actionPerformed(ActionEvent e) {
91 1 1. actionPerformed : removed call to com/jsql/view/swing/menubar/AppMenubar::applyTheme → NO_COVERAGE
                        AppMenubar.applyTheme(entry.getKey());
92
                    }
93
                }
94
            );
95 1 1. lambda$new$0 : removed call to javax/swing/JMenuItem::setText → NO_COVERAGE
            item.setText(entry.getValue());
96 1 1. lambda$new$0 : removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE
            item.setSelected(entry.getKey().equals(MediatorHelper.model().getMediatorUtils().getPreferencesUtil().getThemeFlatLafName()));
97 1 1. lambda$new$0 : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
            groupRadio.add(item);
98
            menuThemes.add(item);
99
        });
100
101
        this.add(itemNewWindows);
102
        this.add(menuAppearance);
103
        this.add(menuThemes);
104
        this.add(new JSeparator());
105
        this.add(this.initMenuTranslation());
106
        this.add(new JSeparator());
107
108
        this.menuView = new JMenu(I18nUtil.valueByKey("MENUBAR_VIEW"));
109 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey("MENUBAR_VIEW", this.menuView);
110 1 1. <init> : removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE
        this.menuView.setMnemonic('V');
111
112
        AtomicInteger accelerator = new AtomicInteger(0x31);
113
        AtomicInteger tabPosition = new AtomicInteger();
114 1 1. <init> : removed call to java/util/List::forEach → NO_COVERAGE
        MediatorHelper.frame().getTabManagers().getIconsTabs().forEach(entry -> {
115
            var menuItem = new JMenuItem(I18nUtil.valueByKey(entry.getKeyLabel()), entry.getIcon());
116 1 1. lambda$new$2 : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
            I18nViewUtil.addComponentForKey(entry.getKeyLabel(), menuItem);
117 1 1. lambda$new$2 : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
            menuItem.setName(entry.getKeyLabel());  // required by card manager switch
118
            this.menuView.add(menuItem);
119
120 1 1. lambda$new$2 : removed call to javax/swing/JMenuItem::setAccelerator → NO_COVERAGE
            menuItem.setAccelerator(KeyStroke.getKeyStroke(
121
                KeyEvent.getExtendedKeyCodeForChar(accelerator.getAndIncrement()),
122
                InputEvent.CTRL_DOWN_MASK
123
            ));
124
125
            final var position = tabPosition.get();  // required by closure
126 1 1. lambda$new$2 : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
            menuItem.addActionListener(actionEvent -> {  // setAction() could set action+text+icon but i18n not easy
127
                CardLayout cardLayout = (CardLayout) MediatorHelper.tabManagersCards().getLayout();
128 1 1. lambda$new$1 : removed call to java/awt/CardLayout::show → NO_COVERAGE
                cardLayout.show(MediatorHelper.tabManagersCards(), menuItem.getName());
129 1 1. lambda$new$1 : removed call to com/jsql/view/swing/tab/TabManagers::setSelectedIndex → NO_COVERAGE
                MediatorHelper.frame().getTabManagers().setSelectedIndex(position);
130
            });
131
            tabPosition.getAndIncrement();
132
        });
133
134
        this.add(this.menuView);
135
136
        Preferences preferences = Preferences.userRoot().node(InjectionModel.class.getName());
137
138
        var menuPanel = new JMenu(I18nUtil.valueByKey("MENUBAR_PANEL"));
139 1 1. <init> : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey("MENUBAR_PANEL", menuPanel);
140 1 1. <init> : removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE
        menuPanel.setMnemonic('C');
141
142
        Arrays.asList(
143
            new ModelCheckboxMenu(
144
                "CONSOLE_CHUNK_LABEL",
145
                PreferencesUtil.CHUNK_VISIBLE,
146 1 1. lambda$new$3 : removed call to com/jsql/view/swing/panel/PanelConsoles::insertChunkTab → NO_COVERAGE
                () -> MediatorHelper.panelConsoles().insertChunkTab(),
147
                UiUtil.CHUNK.getIcon()
148
            ),
149
            new ModelCheckboxMenu(
150
                "CONSOLE_BINARY_LABEL",
151
                PreferencesUtil.BINARY_VISIBLE,
152 1 1. lambda$new$4 : removed call to com/jsql/view/swing/panel/PanelConsoles::insertBooleanTab → NO_COVERAGE
                () -> MediatorHelper.panelConsoles().insertBooleanTab(),
153
                UiUtil.BINARY.getIcon()
154
            ),
155
            new ModelCheckboxMenu(
156
                "CONSOLE_NETWORK_LABEL",
157
                PreferencesUtil.NETWORK_VISIBLE,
158 1 1. lambda$new$5 : removed call to com/jsql/view/swing/panel/PanelConsoles::insertNetworkTab → NO_COVERAGE
                () -> MediatorHelper.panelConsoles().insertNetworkTab(),
159
                UiUtil.NETWORK.getIcon()
160
            ),
161
            new ModelCheckboxMenu(
162
                "CONSOLE_JAVA_LABEL",
163
                PreferencesUtil.JAVA_VISIBLE,
164 1 1. lambda$new$6 : removed call to com/jsql/view/swing/panel/PanelConsoles::insertJavaTab → NO_COVERAGE
                () -> MediatorHelper.panelConsoles().insertJavaTab(),
165
                UiUtil.CUP.getIcon()
166
            )
167 1 1. <init> : removed call to java/util/List::forEach → NO_COVERAGE
        ).forEach(model -> {
168
            var menuItem = new JCheckBoxMenuItem(
169
                I18nUtil.valueByKey(model.i18n),
170
                model.icon,
171
                preferences.getBoolean(model.keyPref, true)
172
            ) {
173
                @Override
174
                protected void processMouseEvent(MouseEvent e) {
175 1 1. processMouseEvent : negated conditional → NO_COVERAGE
                    if (!RadioItemPreventClose.preventClose(e, this)) {
176 1 1. processMouseEvent : removed call to javax/swing/JCheckBoxMenuItem::processMouseEvent → NO_COVERAGE
                        super.processMouseEvent(e);
177
                    }
178
                }
179
            };
180 1 1. lambda$new$8 : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
            I18nViewUtil.addComponentForKey(model.i18n, menuItem);
181
            menuPanel.add(menuItem);
182
183 1 1. lambda$new$8 : removed call to com/jsql/view/swing/menubar/MenuWindows$2::addActionListener → NO_COVERAGE
            menuItem.addActionListener(actionEvent -> {
184 1 1. lambda$new$7 : negated conditional → NO_COVERAGE
                if (menuItem.isSelected()) {
185 1 1. lambda$new$7 : removed call to java/lang/Runnable::run → NO_COVERAGE
                    model.runnableInsertTab.run();
186
                } else {
187
                    try {  // fix #95874: IndexOutOfBoundsException on remove()
188 1 1. lambda$new$7 : removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::remove → NO_COVERAGE
                        MediatorHelper.tabConsoles().remove(MediatorHelper.tabConsoles().indexOfTab(model.icon));
189
                    } catch (IndexOutOfBoundsException e) {  // should not occur
190
                        LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e);
191
                    }
192
                }
193
            });
194
        });
195
196
        this.add(menuPanel);
197
        this.add(new JSeparator());
198
        this.add(this.getMenuItemSqlEngine());
199
        this.add(this.getMenuItemPreferences());
200
    }
201
202
    private JMenuItem getMenuItemSqlEngine() {
203
        var itemSqlEngine = new JMenuItem(I18nUtil.valueByKey(MenuWindows.I18N_SQL_ENGINE));
204 1 1. getMenuItemSqlEngine : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey(MenuWindows.I18N_SQL_ENGINE, itemSqlEngine);
205 1 1. getMenuItemSqlEngine : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
        itemSqlEngine.setName("itemSqlEngine");
206 1 1. getMenuItemSqlEngine : removed call to javax/swing/JMenuItem::setMnemonic → NO_COVERAGE
        itemSqlEngine.setMnemonic('S');
207
208
        // Render the SQL Engine dialog behind scene
209
        var titleTabSqlEngine = "SQL Engine";
210
211 1 1. getMenuItemSqlEngine : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
        itemSqlEngine.addActionListener(actionEvent -> {
212 2 1. lambda$getMenuItemSqlEngine$9 : negated conditional → NO_COVERAGE
2. lambda$getMenuItemSqlEngine$9 : changed conditional boundary → NO_COVERAGE
            for (var i = 0 ; i < MediatorHelper.tabResults().getTabCount() ; i++) {
213 1 1. lambda$getMenuItemSqlEngine$9 : negated conditional → NO_COVERAGE
                if (titleTabSqlEngine.equals(MediatorHelper.tabResults().getTitleAt(i))) {
214 1 1. lambda$getMenuItemSqlEngine$9 : removed call to com/jsql/view/swing/tab/TabResults::setSelectedIndex → NO_COVERAGE
                    MediatorHelper.tabResults().setSelectedIndex(i);
215
                    return;
216
                }
217
            }
218
219 1 1. lambda$getMenuItemSqlEngine$9 : removed call to com/jsql/view/swing/panel/split/SplitNS::initSplitOrientation → NO_COVERAGE
            MediatorHelper.frame().getSplitNS().initSplitOrientation();
220
221
            var panelSqlEngine = new SqlEngine();
222 1 1. lambda$getMenuItemSqlEngine$9 : removed call to com/jsql/view/swing/tab/TabResults::addTab → NO_COVERAGE
            MediatorHelper.tabResults().addTab(titleTabSqlEngine, panelSqlEngine);
223 1 1. lambda$getMenuItemSqlEngine$9 : removed call to com/jsql/view/swing/tab/TabResults::setSelectedComponent → NO_COVERAGE
            MediatorHelper.tabResults().setSelectedComponent(panelSqlEngine);  // Focus on the new tab
224
225
            // Create a custom tab header
226
            var header = new TabHeader(I18nViewUtil.valueByKey(MenuWindows.I18N_SQL_ENGINE), UiUtil.COG.getIcon());
227 1 1. lambda$getMenuItemSqlEngine$9 : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
            I18nViewUtil.addComponentForKey(MenuWindows.I18N_SQL_ENGINE, header.getTabLabel());
228
229
            // Apply the custom header to the tab
230 1 1. lambda$getMenuItemSqlEngine$9 : removed call to com/jsql/view/swing/tab/TabResults::setTabComponentAt → NO_COVERAGE
            MediatorHelper.tabResults().setTabComponentAt(MediatorHelper.tabResults().indexOfComponent(panelSqlEngine), header);
231 1 1. lambda$getMenuItemSqlEngine$9 : removed call to com/jsql/view/swing/tab/TabResults::updateUI → NO_COVERAGE
            MediatorHelper.tabResults().updateUI();  // required: light, open/close prefs, dark => light artifacts
232
        });
233
234 1 1. getMenuItemSqlEngine : replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::getMenuItemSqlEngine → NO_COVERAGE
        return itemSqlEngine;
235
    }
236
237
    private JMenuItem getMenuItemPreferences() {
238
        JMenuItem itemPreferences = new JMenuItem(I18nUtil.valueByKey(MenuWindows.I18N_PREFERENCES), 'P');
239 1 1. getMenuItemPreferences : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey(MenuWindows.I18N_PREFERENCES, itemPreferences);
240 1 1. getMenuItemPreferences : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
        itemPreferences.setName("itemPreferences");
241
242
        // Render the Preferences dialog behind scene
243
        var titleTabPreferences = "Preferences";
244
245 1 1. getMenuItemPreferences : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
        itemPreferences.addActionListener(actionEvent -> {
246 2 1. lambda$getMenuItemPreferences$10 : changed conditional boundary → NO_COVERAGE
2. lambda$getMenuItemPreferences$10 : negated conditional → NO_COVERAGE
            for (var i = 0 ; i < MediatorHelper.tabResults().getTabCount() ; i++) {
247 1 1. lambda$getMenuItemPreferences$10 : negated conditional → NO_COVERAGE
                if (titleTabPreferences.equals(MediatorHelper.tabResults().getTitleAt(i))) {
248 1 1. lambda$getMenuItemPreferences$10 : removed call to com/jsql/view/swing/tab/TabResults::setSelectedIndex → NO_COVERAGE
                    MediatorHelper.tabResults().setSelectedIndex(i);
249
                    return;
250
                }
251
            }
252
253 1 1. lambda$getMenuItemPreferences$10 : removed call to com/jsql/view/swing/panel/split/SplitNS::initSplitOrientation → NO_COVERAGE
            MediatorHelper.frame().getSplitNS().initSplitOrientation();
254
255
            var panelPreferences = new PanelPreferences();
256 1 1. lambda$getMenuItemPreferences$10 : removed call to com/jsql/view/swing/tab/TabResults::addTab → NO_COVERAGE
            MediatorHelper.tabResults().addTab(titleTabPreferences, panelPreferences);
257 1 1. lambda$getMenuItemPreferences$10 : removed call to com/jsql/view/swing/tab/TabResults::setSelectedComponent → NO_COVERAGE
            MediatorHelper.tabResults().setSelectedComponent(panelPreferences);  // Focus on the new tab
258
259
            // Create a custom tab header
260
            var header = new TabHeader(I18nViewUtil.valueByKey(MenuWindows.I18N_PREFERENCES), UiUtil.COG.getIcon());
261 1 1. lambda$getMenuItemPreferences$10 : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
            I18nViewUtil.addComponentForKey(MenuWindows.I18N_PREFERENCES, header.getTabLabel());
262
263
            // Apply the custom header to the tab
264 1 1. lambda$getMenuItemPreferences$10 : removed call to com/jsql/view/swing/tab/TabResults::setTabComponentAt → NO_COVERAGE
            MediatorHelper.tabResults().setTabComponentAt(MediatorHelper.tabResults().indexOfComponent(panelPreferences), header);
265
266 1 1. lambda$getMenuItemPreferences$10 : removed call to com/jsql/view/swing/tab/TabResults::updateUI → NO_COVERAGE
            MediatorHelper.tabResults().updateUI();  // required: light, open/close prefs, dark => light artifacts
267
        });
268
269 1 1. getMenuItemPreferences : replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::getMenuItemPreferences → NO_COVERAGE
        return itemPreferences;
270
    }
271
272
    private JMenu initMenuTranslation() {
273
        var menuTranslation = new JMenu(I18nUtil.valueByKey("MENUBAR_LANGUAGE"));
274 1 1. initMenuTranslation : removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE
        I18nViewUtil.addComponentForKey("MENUBAR_LANGUAGE", menuTranslation);
275 1 1. initMenuTranslation : removed call to javax/swing/JMenu::setName → NO_COVERAGE
        menuTranslation.setName("menuTranslation");
276 1 1. initMenuTranslation : removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE
        menuTranslation.setMnemonic('L');
277
278
        var groupRadioLanguage = new ButtonGroup();
279
        var atomicIsAnySelected = new AtomicBoolean(false);
280 1 1. initMenuTranslation : removed call to java/util/List::forEach → NO_COVERAGE
        AppMenubar.MODELS_ITEM.forEach(model -> {
281 3 1. lambda$initMenuTranslation$12 : removed call to java/util/concurrent/atomic/AtomicBoolean::set → NO_COVERAGE
2. lambda$initMenuTranslation$12 : negated conditional → NO_COVERAGE
3. lambda$initMenuTranslation$12 : negated conditional → NO_COVERAGE
            atomicIsAnySelected.set(atomicIsAnySelected.get() || model.getLanguage().isCurrentLanguage());
282 1 1. lambda$initMenuTranslation$12 : removed call to com/jsql/view/swing/menubar/ModelItemTranslate::setMenuItem → NO_COVERAGE
            model.setMenuItem(new RadioItemPreventClose(
283
                model.getLanguage().getMenuItemLabel(),
284
                model.getLanguage().getFlag(),
285
                model.getLanguage().isCurrentLanguage()
286
            ));
287 1 1. lambda$initMenuTranslation$12 : removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE
            model.getMenuItem().addActionListener(actionEvent -> {
288 1 1. lambda$initMenuTranslation$11 : removed call to com/jsql/view/swing/menubar/AppMenubar::switchLocale → NO_COVERAGE
                this.appMenubar.switchLocale(
289 1 1. lambda$initMenuTranslation$11 : negated conditional → NO_COVERAGE
                    model.getLanguage() == Language.EN
290
                    ? Locale.ROOT  // required as no bundle 'en'
291
                    : Locale.forLanguageTag(model.getLanguage().getLanguageTag())
292
                );
293 1 1. lambda$initMenuTranslation$11 : removed call to com/jsql/util/PreferencesUtil::persist → NO_COVERAGE
                MediatorHelper.model().getMediatorUtils().getPreferencesUtil().withLanguageTag(model.getLanguage().getLanguageTag()).persist();
294
            });
295
            menuTranslation.add(model.getMenuItem());
296 1 1. lambda$initMenuTranslation$12 : removed call to javax/swing/ButtonGroup::add → NO_COVERAGE
            groupRadioLanguage.add(model.getMenuItem());
297
        });
298
299 2 1. lambda$initMenuTranslation$13 : replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$initMenuTranslation$13 → NO_COVERAGE
2. lambda$initMenuTranslation$13 : negated conditional → NO_COVERAGE
        AppMenubar.MODELS_ITEM.stream().filter(model -> model.getLanguage() == Language.EN)
300 1 1. initMenuTranslation : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
        .forEach(modelItem -> {
301 2 1. lambda$initMenuTranslation$14 : negated conditional → NO_COVERAGE
2. lambda$initMenuTranslation$14 : removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE
            modelItem.getMenuItem().setSelected(!atomicIsAnySelected.get());
302 1 1. lambda$initMenuTranslation$14 : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
            modelItem.getMenuItem().setName("itemEnglish");
303
        });
304 2 1. lambda$initMenuTranslation$15 : negated conditional → NO_COVERAGE
2. lambda$initMenuTranslation$15 : replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$initMenuTranslation$15 → NO_COVERAGE
        AppMenubar.MODELS_ITEM.stream().filter(model -> model.getLanguage() == Language.RU)
305 2 1. initMenuTranslation : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$initMenuTranslation$16 : removed call to javax/swing/JMenuItem::setName → NO_COVERAGE
        .forEach(modelItem -> modelItem.getMenuItem().setName("itemRussian"));
306 2 1. lambda$initMenuTranslation$17 : replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$initMenuTranslation$17 → NO_COVERAGE
2. lambda$initMenuTranslation$17 : negated conditional → NO_COVERAGE
        AppMenubar.MODELS_ITEM.stream().filter(model -> model.getLanguage() == Language.AR)
307 2 1. initMenuTranslation : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
2. lambda$initMenuTranslation$18 : removed call to javax/swing/JMenuItem::setComponentOrientation → NO_COVERAGE
        .forEach(modelItem -> modelItem.getMenuItem().setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT));
308
309 1 1. initMenuTranslation : replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::initMenuTranslation → NO_COVERAGE
        return menuTranslation;
310
    }
311
312
    public void switchLocaleFromPreferences() {
313
        AppMenubar.MODELS_ITEM.stream()
314 2 1. lambda$switchLocaleFromPreferences$19 : replaced boolean return with false for com/jsql/view/swing/menubar/MenuWindows::lambda$switchLocaleFromPreferences$19 → NO_COVERAGE
2. lambda$switchLocaleFromPreferences$19 : replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$switchLocaleFromPreferences$19 → NO_COVERAGE
        .filter(model -> model.getLanguage().getLanguageTag().equals(
315
            MediatorHelper.model().getMediatorUtils().getPreferencesUtil().getLanguageTag()
316
        ))
317 2 1. lambda$switchLocaleFromPreferences$20 : removed call to javax/swing/JMenuItem::doClick → NO_COVERAGE
2. switchLocaleFromPreferences : removed call to java/util/stream/Stream::forEach → NO_COVERAGE
        .forEach(modelItem -> modelItem.getMenuItem().doClick());
318
    }
319
320
321
    // Getter and setter
322
323
    public JMenu getMenuView() {
324 1 1. getMenuView : replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::getMenuView → NO_COVERAGE
        return this.menuView;
325
    }
326
}

Mutations

56

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/menubar/MenuWindows::setName → NO_COVERAGE

57

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

58

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/menubar/MenuWindows::setMnemonic → NO_COVERAGE

61

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

65

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

66

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE

75

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

76

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE

86

1.1
Location : <init>
Killed by : none
removed call to java/util/List::forEach → NO_COVERAGE

91

1.1
Location : actionPerformed
Killed by : none
removed call to com/jsql/view/swing/menubar/AppMenubar::applyTheme → NO_COVERAGE

95

1.1
Location : lambda$new$0
Killed by : none
removed call to javax/swing/JMenuItem::setText → NO_COVERAGE

96

1.1
Location : lambda$new$0
Killed by : none
removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE

97

1.1
Location : lambda$new$0
Killed by : none
removed call to javax/swing/ButtonGroup::add → NO_COVERAGE

109

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

110

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE

114

1.1
Location : <init>
Killed by : none
removed call to java/util/List::forEach → NO_COVERAGE

116

1.1
Location : lambda$new$2
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

117

1.1
Location : lambda$new$2
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

120

1.1
Location : lambda$new$2
Killed by : none
removed call to javax/swing/JMenuItem::setAccelerator → NO_COVERAGE

126

1.1
Location : lambda$new$2
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

128

1.1
Location : lambda$new$1
Killed by : none
removed call to java/awt/CardLayout::show → NO_COVERAGE

129

1.1
Location : lambda$new$1
Killed by : none
removed call to com/jsql/view/swing/tab/TabManagers::setSelectedIndex → NO_COVERAGE

139

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

140

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE

146

1.1
Location : lambda$new$3
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertChunkTab → NO_COVERAGE

152

1.1
Location : lambda$new$4
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertBooleanTab → NO_COVERAGE

158

1.1
Location : lambda$new$5
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertNetworkTab → NO_COVERAGE

164

1.1
Location : lambda$new$6
Killed by : none
removed call to com/jsql/view/swing/panel/PanelConsoles::insertJavaTab → NO_COVERAGE

167

1.1
Location : <init>
Killed by : none
removed call to java/util/List::forEach → NO_COVERAGE

175

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

176

1.1
Location : processMouseEvent
Killed by : none
removed call to javax/swing/JCheckBoxMenuItem::processMouseEvent → NO_COVERAGE

180

1.1
Location : lambda$new$8
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

183

1.1
Location : lambda$new$8
Killed by : none
removed call to com/jsql/view/swing/menubar/MenuWindows$2::addActionListener → NO_COVERAGE

184

1.1
Location : lambda$new$7
Killed by : none
negated conditional → NO_COVERAGE

185

1.1
Location : lambda$new$7
Killed by : none
removed call to java/lang/Runnable::run → NO_COVERAGE

188

1.1
Location : lambda$new$7
Killed by : none
removed call to com/jsql/view/swing/tab/TabbedPaneWheeled::remove → NO_COVERAGE

204

1.1
Location : getMenuItemSqlEngine
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

205

1.1
Location : getMenuItemSqlEngine
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

206

1.1
Location : getMenuItemSqlEngine
Killed by : none
removed call to javax/swing/JMenuItem::setMnemonic → NO_COVERAGE

211

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

212

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
changed conditional boundary → NO_COVERAGE

213

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
negated conditional → NO_COVERAGE

214

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::setSelectedIndex → NO_COVERAGE

219

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
removed call to com/jsql/view/swing/panel/split/SplitNS::initSplitOrientation → NO_COVERAGE

222

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addTab → NO_COVERAGE

223

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::setSelectedComponent → NO_COVERAGE

227

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

230

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::setTabComponentAt → NO_COVERAGE

231

1.1
Location : lambda$getMenuItemSqlEngine$9
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::updateUI → NO_COVERAGE

234

1.1
Location : getMenuItemSqlEngine
Killed by : none
replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::getMenuItemSqlEngine → NO_COVERAGE

239

1.1
Location : getMenuItemPreferences
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

240

1.1
Location : getMenuItemPreferences
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

245

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

246

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : lambda$getMenuItemPreferences$10
Killed by : none
negated conditional → NO_COVERAGE

247

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
negated conditional → NO_COVERAGE

248

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::setSelectedIndex → NO_COVERAGE

253

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
removed call to com/jsql/view/swing/panel/split/SplitNS::initSplitOrientation → NO_COVERAGE

256

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::addTab → NO_COVERAGE

257

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::setSelectedComponent → NO_COVERAGE

261

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

264

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::setTabComponentAt → NO_COVERAGE

266

1.1
Location : lambda$getMenuItemPreferences$10
Killed by : none
removed call to com/jsql/view/swing/tab/TabResults::updateUI → NO_COVERAGE

269

1.1
Location : getMenuItemPreferences
Killed by : none
replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::getMenuItemPreferences → NO_COVERAGE

274

1.1
Location : initMenuTranslation
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → NO_COVERAGE

275

1.1
Location : initMenuTranslation
Killed by : none
removed call to javax/swing/JMenu::setName → NO_COVERAGE

276

1.1
Location : initMenuTranslation
Killed by : none
removed call to javax/swing/JMenu::setMnemonic → NO_COVERAGE

280

1.1
Location : initMenuTranslation
Killed by : none
removed call to java/util/List::forEach → NO_COVERAGE

281

1.1
Location : lambda$initMenuTranslation$12
Killed by : none
removed call to java/util/concurrent/atomic/AtomicBoolean::set → NO_COVERAGE

2.2
Location : lambda$initMenuTranslation$12
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : lambda$initMenuTranslation$12
Killed by : none
negated conditional → NO_COVERAGE

282

1.1
Location : lambda$initMenuTranslation$12
Killed by : none
removed call to com/jsql/view/swing/menubar/ModelItemTranslate::setMenuItem → NO_COVERAGE

287

1.1
Location : lambda$initMenuTranslation$12
Killed by : none
removed call to javax/swing/JMenuItem::addActionListener → NO_COVERAGE

288

1.1
Location : lambda$initMenuTranslation$11
Killed by : none
removed call to com/jsql/view/swing/menubar/AppMenubar::switchLocale → NO_COVERAGE

289

1.1
Location : lambda$initMenuTranslation$11
Killed by : none
negated conditional → NO_COVERAGE

293

1.1
Location : lambda$initMenuTranslation$11
Killed by : none
removed call to com/jsql/util/PreferencesUtil::persist → NO_COVERAGE

296

1.1
Location : lambda$initMenuTranslation$12
Killed by : none
removed call to javax/swing/ButtonGroup::add → NO_COVERAGE

299

1.1
Location : lambda$initMenuTranslation$13
Killed by : none
replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$initMenuTranslation$13 → NO_COVERAGE

2.2
Location : lambda$initMenuTranslation$13
Killed by : none
negated conditional → NO_COVERAGE

300

1.1
Location : initMenuTranslation
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

301

1.1
Location : lambda$initMenuTranslation$14
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : lambda$initMenuTranslation$14
Killed by : none
removed call to javax/swing/JMenuItem::setSelected → NO_COVERAGE

302

1.1
Location : lambda$initMenuTranslation$14
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

304

1.1
Location : lambda$initMenuTranslation$15
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : lambda$initMenuTranslation$15
Killed by : none
replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$initMenuTranslation$15 → NO_COVERAGE

305

1.1
Location : initMenuTranslation
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

2.2
Location : lambda$initMenuTranslation$16
Killed by : none
removed call to javax/swing/JMenuItem::setName → NO_COVERAGE

306

1.1
Location : lambda$initMenuTranslation$17
Killed by : none
replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$initMenuTranslation$17 → NO_COVERAGE

2.2
Location : lambda$initMenuTranslation$17
Killed by : none
negated conditional → NO_COVERAGE

307

1.1
Location : initMenuTranslation
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

2.2
Location : lambda$initMenuTranslation$18
Killed by : none
removed call to javax/swing/JMenuItem::setComponentOrientation → NO_COVERAGE

309

1.1
Location : initMenuTranslation
Killed by : none
replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::initMenuTranslation → NO_COVERAGE

314

1.1
Location : lambda$switchLocaleFromPreferences$19
Killed by : none
replaced boolean return with false for com/jsql/view/swing/menubar/MenuWindows::lambda$switchLocaleFromPreferences$19 → NO_COVERAGE

2.2
Location : lambda$switchLocaleFromPreferences$19
Killed by : none
replaced boolean return with true for com/jsql/view/swing/menubar/MenuWindows::lambda$switchLocaleFromPreferences$19 → NO_COVERAGE

317

1.1
Location : lambda$switchLocaleFromPreferences$20
Killed by : none
removed call to javax/swing/JMenuItem::doClick → NO_COVERAGE

2.2
Location : switchLocaleFromPreferences
Killed by : none
removed call to java/util/stream/Stream::forEach → NO_COVERAGE

324

1.1
Location : getMenuView
Killed by : none
replaced return value with null for com/jsql/view/swing/menubar/MenuWindows::getMenuView → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.1