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

Mutations

55

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

56

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/menubar/MenuWindows::setMnemonic → NO_COVERAGE

60

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

64

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 javax/swing/JMenu::setMnemonic → NO_COVERAGE

74

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

75

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

85

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

90

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

94

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

95

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

96

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

108

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

109

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

113

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

115

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

116

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

119

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

125

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

127

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

128

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

136

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

137

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

143

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

149

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

155

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

161

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

165

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

173

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

174

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

178

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

181

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

182

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

183

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

185

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

198

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

199

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

200

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

202

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

204

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

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

205

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

206

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

211

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

214

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

215

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

219

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

222

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

223

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

226

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

231

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

232

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

237

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

238

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

239

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

240

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

245

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

248

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

249

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

253

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

256

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

257

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

260

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

265

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

266

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

267

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

271

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

272

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

273

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

278

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

279

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

282

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

283

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

284

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

286

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

287

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

290

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

294

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

295

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

296

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

297

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

300

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

301

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

303

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

304

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

305

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

306

1.1
Location : lambda$initMenuTranslation$18
Killed by : none
removed call to javax/swing/JMenuItem::setName → 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

313

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

316

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

317

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

318

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

326

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