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