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

Mutations

48

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

49

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

50

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

53

1.1
Location : <init>
Killed by : none
removed call to com/jsql/view/swing/util/I18nViewUtil::addComponentForKey → 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 javax/swing/JMenu::setMnemonic → NO_COVERAGE

67

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

68

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

78

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

83

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

87

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

88

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

89

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

101

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

102

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

106

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

108

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

109

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

112

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

118

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

120

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

121

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

129

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

130

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

136

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

142

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

148

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

154

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

158

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

166

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

167

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

171

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

174

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

175

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

176

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

178

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

191

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

192

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

193

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

198

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

199

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

200

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

201

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

206

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

209

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

210

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

214

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

217

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

218

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

221

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

226

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

227

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

232

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

233

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

234

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

235

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

240

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

243

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

244

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

248

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

251

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

253

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

256

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

261

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

262

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

263

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

267

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

268

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

269

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

274

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

275

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

278

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

279

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

280

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

282

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

283

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

286

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

290

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

291

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

292

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

293

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

296

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

297

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

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

299

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

300

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

302

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

306

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

309

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

310

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

311

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

319

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.22.0