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