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