1 | /******************************************************************************* | |
2 | * Copyhacked (H) 2012-2025. | |
3 | * This program and the accompanying materials | |
4 | * are made available under no term at all, use it like | |
5 | * you want, but share and discuss it | |
6 | * every time possible with every body. | |
7 | * | |
8 | * Contributors: | |
9 | * ron190 at ymail dot com - initial implementation | |
10 | ******************************************************************************/ | |
11 | package com.jsql.view.swing.util; | |
12 | ||
13 | import com.formdev.flatlaf.FlatLaf; | |
14 | import com.formdev.flatlaf.intellijthemes.FlatLightFlatIJTheme; | |
15 | import com.jsql.util.I18nUtil; | |
16 | import com.jsql.util.LogLevelUtil; | |
17 | import com.jsql.view.swing.console.JTextPaneAppender; | |
18 | import com.jsql.view.swing.sql.SqlEngine; | |
19 | import com.jsql.view.swing.text.action.DeleteNextCharAction; | |
20 | import com.jsql.view.swing.text.action.DeletePrevCharAction; | |
21 | import org.apache.commons.lang3.StringUtils; | |
22 | import org.apache.logging.log4j.LogManager; | |
23 | import org.apache.logging.log4j.Logger; | |
24 | import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; | |
25 | import org.fife.ui.rsyntaxtextarea.Theme; | |
26 | ||
27 | import javax.swing.*; | |
28 | import javax.swing.border.Border; | |
29 | import javax.swing.text.DefaultCaret; | |
30 | import javax.swing.text.DefaultEditorKit; | |
31 | import javax.swing.text.JTextComponent; | |
32 | import javax.swing.text.StyleConstants; | |
33 | import java.awt.*; | |
34 | import java.io.BufferedInputStream; | |
35 | import java.io.IOException; | |
36 | import java.io.InputStream; | |
37 | import java.lang.reflect.InvocationTargetException; | |
38 | import java.util.ArrayList; | |
39 | import java.util.List; | |
40 | import java.util.Objects; | |
41 | ||
42 | /** | |
43 | * Build default component appearance, keyboard shortcuts and icons. | |
44 | */ | |
45 | public class UiUtil { | |
46 | | |
47 | /** | |
48 | * Log4j logger sent to view. | |
49 | */ | |
50 | private static final Logger LOGGER = LogManager.getRootLogger(); | |
51 | ||
52 | public static final Border BORDER_5PX = BorderFactory.createEmptyBorder(5, 5, 5, 5); | |
53 | ||
54 | public static final ImageIcon ICON_FLAG_AR = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/ar.png"))); | |
55 | public static final ImageIcon ICON_FLAG_ZH = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/zh.png"))); | |
56 | public static final ImageIcon ICON_FLAG_RU = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/ru.png"))); | |
57 | public static final ImageIcon ICON_FLAG_TR = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/tr.png"))); | |
58 | public static final ImageIcon ICON_FLAG_EN = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/en.png"))); | |
59 | public static final ImageIcon ICON_FLAG_FR = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/fr.png"))); | |
60 | public static final ImageIcon ICON_FLAG_HI = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/hi.png"))); | |
61 | public static final ImageIcon ICON_FLAG_CS = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/cs.png"))); | |
62 | public static final ImageIcon ICON_FLAG_DE = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/de.png"))); | |
63 | public static final ImageIcon ICON_FLAG_NL = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/nl.png"))); | |
64 | public static final ImageIcon ICON_FLAG_IN = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/in.png"))); | |
65 | public static final ImageIcon ICON_FLAG_IT = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/it.png"))); | |
66 | public static final ImageIcon ICON_FLAG_ES = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/es.png"))); | |
67 | public static final ImageIcon ICON_FLAG_PT = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/pt.png"))); | |
68 | public static final ImageIcon ICON_FLAG_PL = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/pl.png"))); | |
69 | public static final ImageIcon ICON_FLAG_JA = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/ja.png"))); | |
70 | public static final ImageIcon ICON_FLAG_KO = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/ko.png"))); | |
71 | public static final ImageIcon ICON_FLAG_RO = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/ro.png"))); | |
72 | public static final ImageIcon ICON_FLAG_LK = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/lk.png"))); | |
73 | public static final ImageIcon ICON_FLAG_SE = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/se.png"))); | |
74 | public static final ImageIcon ICON_FLAG_FI = new ImageIcon(Objects.requireNonNull(UiUtil.class.getClassLoader().getResource("swing/images/flags/fi.png"))); | |
75 | ||
76 | public static final ModelSvgIcon DATABASE_BOLD = new ModelSvgIcon("database-bold", 0x1C274C) | |
77 | .withTab("DATABASE_TAB", "DATABASE_TOOLTIP"); | |
78 | public static final ModelSvgIcon ADMIN = new ModelSvgIcon("admin", 0.02f) | |
79 | .withTab("ADMINPAGE_TAB", "ADMINPAGE_TOOLTIP"); | |
80 | public static final ModelSvgIcon DOWNLOAD = new ModelSvgIcon("download", 0.55f) | |
81 | .withTab("FILE_TAB", "FILE_TOOLTIP"); | |
82 | public static final ModelSvgIcon TERMINAL = new ModelSvgIcon("terminal", 0.50f) | |
83 | .withTab("EXPLOIT_TAB", "EXPLOIT_TOOLTIP"); | |
84 | public static final ModelSvgIcon UPLOAD = new ModelSvgIcon("upload", 0.55f); | |
85 | public static final ModelSvgIcon LOCK = new ModelSvgIcon("lock", 0.02f) | |
86 | .withTab("BRUTEFORCE_TAB", "BRUTEFORCE_TOOLTIP"); | |
87 | public static final ModelSvgIcon TEXTFIELD = new ModelSvgIcon("textfield", 0.02f) | |
88 | .withTab("CODER_TAB", "CODER_TOOLTIP"); | |
89 | public static final ModelSvgIcon BATCH = new ModelSvgIcon("batch", 0.02f) | |
90 | .withTab("SCANLIST_TAB", "SCANLIST_TOOLTIP"); | |
91 | ||
92 | public static final ModelSvgIcon TABLE_LINEAR = new ModelSvgIcon("table-linear", 0x212121); | |
93 | public static final ModelSvgIcon TABLE_BOLD = new ModelSvgIcon("table-bold", 0x212121); | |
94 | public static final ModelSvgIcon NETWORK = new ModelSvgIcon("network", 0.02f); | |
95 | public static final ModelSvgIcon DATABASE_LINEAR = new ModelSvgIcon("database-linear", 0x1C274C); | |
96 | public static final ModelSvgIcon CUP = new ModelSvgIcon("cup", 0.02f); | |
97 | public static final ModelSvgIcon CONSOLE = new ModelSvgIcon("console", 0.02f); | |
98 | public static final ModelSvgIcon BINARY = new ModelSvgIcon("binary", 0.02f); | |
99 | public static final ModelSvgIcon CHUNK = new ModelSvgIcon("chunk", 0.02f); | |
100 | public static final ModelSvgIcon COG = new ModelSvgIcon("cog", 0.02f); | |
101 | ||
102 | public static final ModelSvgIcon CROSS_RED = new ModelSvgIcon("cross", new Color(0x0F0F0F), null, LogLevelUtil.COLOR_RED, 0.025f); | |
103 | private static final String NAME_ARROW = "arrow"; | |
104 | public static final ModelSvgIcon ARROW = new ModelSvgIcon(UiUtil.NAME_ARROW, new Color(0x005a96), "ComboBox.buttonArrowColor", 1f); | |
105 | public static final ModelSvgIcon ARROW_HOVER = new ModelSvgIcon(UiUtil.NAME_ARROW, new Color(0x005a96), "ComboBox.buttonHoverArrowColor", 1f); | |
106 | public static final ModelSvgIcon ARROW_PRESSED = new ModelSvgIcon(UiUtil.NAME_ARROW, new Color(0x005a96), "ComboBox.buttonPressedArrowColor", 1f); | |
107 | private static final String NAME_EXPAND = "expand"; | |
108 | public static final ModelSvgIcon EXPAND = new ModelSvgIcon(UiUtil.NAME_EXPAND, Color.BLACK, "ComboBox.buttonArrowColor", 0.02f); | |
109 | public static final ModelSvgIcon EXPAND_HOVER = new ModelSvgIcon(UiUtil.NAME_EXPAND, Color.BLACK, "ComboBox.buttonHoverArrowColor", 0.02f); | |
110 | public static final ModelSvgIcon EXPAND_PRESSED = new ModelSvgIcon(UiUtil.NAME_EXPAND, Color.BLACK, "ComboBox.buttonPressedArrowColor", 0.02f); | |
111 | ||
112 | public static final ModelSvgIcon HOURGLASS = new ModelSvgIcon("hourglass", 0.02f); | |
113 | public static final ModelSvgIcon ARROW_UP = new ModelSvgIcon("arrow-up", 0.02f); | |
114 | public static final ModelSvgIcon ARROW_DOWN = new ModelSvgIcon("arrow-down", 0.02f); | |
115 | public static final ModelSvgIcon SQUARE = new ModelSvgIcon("square", 0.01f); | |
116 | public static final ModelSvgIcon TICK_GREEN = new ModelSvgIcon("tick", Color.BLACK, null, LogLevelUtil.COLOR_GREEN, 0.02f); | |
117 | public static final ModelSvgIcon GLOBE = new ModelSvgIcon("globe", 0.025f); | |
118 | public static final ModelSvgIcon APP_ICON = new ModelSvgIcon("app", 0.04f); | |
119 | public static final ModelSvgIcon APP_BIG = new ModelSvgIcon("app", 0.5f); | |
120 | public static final ModelSvgIcon APP_MIDDLE = new ModelSvgIcon("app", 0.25f); | |
121 | ||
122 | public static final String PATH_PAUSE = "swing/images/icons/pause.png"; | |
123 | ||
124 | public static final String FONT_NAME_MONO_NON_ASIAN = "Ubuntu Mono"; | |
125 | public static final int FONT_SIZE_MONO_NON_ASIAN = 14; | |
126 | public static final String FONT_NAME_MONO_ASIAN = "Monospace"; | |
127 | public static final int FONT_SIZE_MONO_ASIAN = 13; | |
128 | | |
129 | // Used in Translation Dialog | |
130 | // HTML engine considers Monospaced/Monospace to be the same Font | |
131 | // Java engine recognizes only Monospaced | |
132 | public static final String FONT_NAME_MONOSPACED = "Monospaced"; | |
133 | public static final String TEXTAREA_FONT = "TextArea.font"; | |
134 | public static final String TEXTPANE_FONT = "TextPane.font"; | |
135 | public static final Font FONT_MONO_NON_ASIAN = new Font( | |
136 | UiUtil.FONT_NAME_MONO_NON_ASIAN, | |
137 | Font.PLAIN, | |
138 | UIManager.getDefaults().getFont(UiUtil.TEXTAREA_FONT).getSize() + 2 | |
139 | ); | |
140 | | |
141 | public static final Font FONT_MONO_ASIAN = new Font( | |
142 | UiUtil.FONT_NAME_MONO_ASIAN, | |
143 | Font.PLAIN, | |
144 | UIManager.getDefaults().getFont(UiUtil.TEXTPANE_FONT).getSize() | |
145 | ); | |
146 | | |
147 | public static final Font FONT_MONO_ASIAN_BIG = new Font( | |
148 | UiUtil.FONT_NAME_MONO_ASIAN, | |
149 | Font.PLAIN, | |
150 | UIManager.getDefaults().getFont(UiUtil.TEXTPANE_FONT).getSize() + 2 | |
151 | ); | |
152 | ||
153 | public static final Font FONT_NON_MONO = new Font( | |
154 | "Segoe UI", | |
155 | Font.PLAIN, | |
156 | UIManager.getDefaults().getFont(UiUtil.TEXTPANE_FONT).getSize() | |
157 | ); | |
158 | | |
159 | public static final Font FONT_NON_MONO_BIG = new Font( | |
160 | UIManager.getDefaults().getFont("TextField.font").getName(), | |
161 | Font.PLAIN, | |
162 | UIManager.getDefaults().getFont("TextField.font").getSize() + 2 | |
163 | ); | |
164 | ||
165 | private UiUtil() { | |
166 | // Utility class | |
167 | } | |
168 | ||
169 | /** | |
170 | * Change the default style of various components. | |
171 | */ | |
172 | public static void prepareGUI() { | |
173 |
1
1. prepareGUI : removed call to com/jsql/view/swing/util/UiUtil::loadFonts → NO_COVERAGE |
UiUtil.loadFonts(); |
174 | // timer before closing automatically tooltip | |
175 |
2
1. prepareGUI : Replaced integer multiplication with division → NO_COVERAGE 2. prepareGUI : removed call to javax/swing/ToolTipManager::setDismissDelay → NO_COVERAGE |
ToolTipManager.sharedInstance().setDismissDelay(3 * ToolTipManager.sharedInstance().getDismissDelay()); |
176 | UIManager.put(UiUtil.TEXTAREA_FONT, UiUtil.FONT_MONO_NON_ASIAN); // required for basic text like chunks tab | |
177 | UIManager.put(UiUtil.TEXTPANE_FONT, UIManager.getFont(UiUtil.TEXTAREA_FONT)); // align textpane font | |
178 | } | |
179 | ||
180 | private static void loadFonts() { | |
181 | var graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); | |
182 | try (InputStream fontStream = new BufferedInputStream( | |
183 | Objects.requireNonNull(UiUtil.class.getClassLoader().getResourceAsStream("swing/font/UbuntuMono-R-ctrlchar.ttf")) | |
184 | )) { | |
185 | var ubuntuFont = Font.createFont(Font.TRUETYPE_FONT, fontStream); | |
186 | graphicsEnvironment.registerFont(ubuntuFont); | |
187 | } catch (FontFormatException | IOException e) { | |
188 | LOGGER.log(LogLevelUtil.CONSOLE_ERROR, "Loading Font Ubuntu Mono with control characters failed", e); | |
189 | } | |
190 | } | |
191 | ||
192 | /** | |
193 | * Icons for application window. | |
194 | * @return List of a 16x16 (default) and 32x32 icon (alt-tab, taskbar) | |
195 | */ | |
196 | public static List<Image> getIcons() { | |
197 | List<Image> images = new ArrayList<>(); | |
198 | // Fix #2154: NoClassDefFoundError on read() | |
199 | try { | |
200 | images.add(UiUtil.APP_ICON.getIcon().getImage()); | |
201 | images.add(UiUtil.APP_MIDDLE.getIcon().getImage()); | |
202 | images.add(UiUtil.APP_BIG.getIcon().getImage()); | |
203 | } catch (NoClassDefFoundError e) { | |
204 | LOGGER.log(LogLevelUtil.CONSOLE_JAVA, e, e); | |
205 | } | |
206 |
1
1. getIcons : replaced return value with Collections.emptyList for com/jsql/view/swing/util/UiUtil::getIcons → NO_COVERAGE |
return images; |
207 | } | |
208 | | |
209 | public static void drawPlaceholder(JTextComponent textComponent, Graphics g, String placeholderText) { | |
210 |
2
1. drawPlaceholder : Replaced integer addition with subtraction → NO_COVERAGE 2. drawPlaceholder : removed call to com/jsql/view/swing/util/UiUtil::drawPlaceholder → NO_COVERAGE |
UiUtil.drawPlaceholder(textComponent, g, placeholderText, 0, g.getFontMetrics().getAscent() + 2); |
211 | } | |
212 | | |
213 | public static void drawPlaceholder(JTextComponent textComponent, Graphics g, String placeholderText, int x, int y) { | |
214 | int w = textComponent.getWidth(); | |
215 | | |
216 |
1
1. drawPlaceholder : removed call to java/awt/Graphics2D::setRenderingHint → NO_COVERAGE |
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); |
217 | | |
218 | var ins = textComponent.getInsets(); | |
219 | var fm = g.getFontMetrics(); | |
220 | | |
221 | int c0 = UIManager.getColor("TextArea.background").getRGB(); | |
222 | int c1 = UIManager.getColor("TextArea.foreground").getRGB(); | |
223 | var m = 0xfefefefe; | |
224 |
5
1. drawPlaceholder : Replaced Unsigned Shift Right with Shift Left → NO_COVERAGE 2. drawPlaceholder : Replaced bitwise AND with OR → NO_COVERAGE 3. drawPlaceholder : Replaced integer addition with subtraction → NO_COVERAGE 4. drawPlaceholder : Replaced Unsigned Shift Right with Shift Left → NO_COVERAGE 5. drawPlaceholder : Replaced bitwise AND with OR → NO_COVERAGE |
int c2 = ((c0 & m) >>> 1) + ((c1 & m) >>> 1); |
225 | | |
226 |
1
1. drawPlaceholder : removed call to java/awt/Graphics::setColor → NO_COVERAGE |
g.setColor(new Color(c2, true)); |
227 | ||
228 |
1
1. drawPlaceholder : negated conditional → NO_COVERAGE |
var fontNonUbuntu = textComponent.getFont() == UiUtil.FONT_NON_MONO_BIG // when address bar |
229 | ? UiUtil.FONT_MONO_ASIAN_BIG.deriveFont(Font.ITALIC) // bigger font | |
230 | : UiUtil.FONT_MONO_ASIAN.deriveFont(Font.ITALIC); // fine for address bar, console, textfield | |
231 |
1
1. drawPlaceholder : removed call to java/awt/Graphics::setFont → NO_COVERAGE |
g.setFont( |
232 |
1
1. drawPlaceholder : negated conditional → NO_COVERAGE |
I18nViewUtil.isNonUbuntu(I18nUtil.getCurrentLocale()) |
233 | ? fontNonUbuntu | |
234 | : textComponent.getFont().deriveFont(Font.ITALIC) // same | |
235 | ); | |
236 | ||
237 |
1
1. drawPlaceholder : removed call to java/awt/Graphics::drawString → NO_COVERAGE |
g.drawString( |
238 | placeholderText, | |
239 | x + | |
240 |
1
1. drawPlaceholder : negated conditional → NO_COVERAGE |
(ComponentOrientation.RIGHT_TO_LEFT.equals(textComponent.getComponentOrientation()) |
241 |
3
1. drawPlaceholder : Replaced integer subtraction with addition → NO_COVERAGE 2. drawPlaceholder : Replaced integer addition with subtraction → NO_COVERAGE 3. drawPlaceholder : Replaced integer addition with subtraction → NO_COVERAGE |
? w - (fm.stringWidth(placeholderText) + ins.left + 2) |
242 |
2
1. drawPlaceholder : Replaced integer addition with subtraction → NO_COVERAGE 2. drawPlaceholder : Replaced integer addition with subtraction → NO_COVERAGE |
: ins.left + 2), |
243 | y | |
244 | ); | |
245 | } | |
246 | | |
247 | public static void init(JTextComponent component) { | |
248 |
1
1. init : removed call to javax/swing/text/JTextComponent::setCaret → NO_COVERAGE |
component.setCaret(new DefaultCaret() { |
249 | @Override | |
250 | public void setSelectionVisible(boolean visible) { | |
251 |
1
1. setSelectionVisible : removed call to javax/swing/text/DefaultCaret::setSelectionVisible → NO_COVERAGE |
super.setSelectionVisible(true); |
252 | } | |
253 | }); | |
254 |
1
1. init : removed call to javax/swing/ActionMap::put → NO_COVERAGE |
component.getActionMap().put(DefaultEditorKit.deletePrevCharAction, new DeletePrevCharAction()); |
255 |
1
1. init : removed call to javax/swing/ActionMap::put → NO_COVERAGE |
component.getActionMap().put(DefaultEditorKit.deleteNextCharAction, new DeleteNextCharAction()); |
256 | } | |
257 | ||
258 | public static void applySyntaxTheme(RSyntaxTextArea textArea) { | |
259 | try { | |
260 | boolean isDark = UIManager.getLookAndFeel().getName().matches(".*(Dark|High contrast).*"); | |
261 |
1
1. applySyntaxTheme : negated conditional → NO_COVERAGE |
var xmlTheme = String.format("/org/fife/ui/rsyntaxtextarea/themes/%s.xml", isDark ? "dark" : "default"); |
262 | Theme theme = Theme.load(SqlEngine.class.getResourceAsStream(xmlTheme)); | |
263 |
1
1. applySyntaxTheme : removed call to org/fife/ui/rsyntaxtextarea/Theme::apply → NO_COVERAGE |
theme.apply(textArea); |
264 | } catch (IOException e) { | |
265 | throw new IllegalArgumentException(e); | |
266 | } | |
267 | } | |
268 | ||
269 | public static void applyTheme(String nameTheme) { | |
270 | try { | |
271 |
1
1. applyTheme : negated conditional → NO_COVERAGE |
Class<?> c = Class.forName(StringUtils.isEmpty(nameTheme) ? FlatLightFlatIJTheme.class.getName() : nameTheme); |
272 | LookAndFeel lookAndFeel = (LookAndFeel) c.getDeclaredConstructor().newInstance(); | |
273 |
1
1. applyTheme : removed call to javax/swing/UIManager::setLookAndFeel → NO_COVERAGE |
UIManager.setLookAndFeel(lookAndFeel); |
274 | } catch ( | |
275 | ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | | |
276 | InvocationTargetException | UnsupportedLookAndFeelException e | |
277 | ) { | |
278 | throw new IllegalArgumentException(e); | |
279 | } | |
280 |
1
1. applyTheme : removed call to com/formdev/flatlaf/FlatLaf::updateUI → NO_COVERAGE |
FlatLaf.updateUI(); // required |
281 | ||
282 | // required ATTRIBUTE_ALL without color for compatibility with dark/light mode as text is white/black | |
283 |
1
1. applyTheme : removed call to javax/swing/text/StyleConstants::setForeground → NO_COVERAGE |
StyleConstants.setForeground(JTextPaneAppender.ATTRIBUTE_WARN, LogLevelUtil.COLOR_RED); |
284 |
1
1. applyTheme : removed call to javax/swing/text/StyleConstants::setForeground → NO_COVERAGE |
StyleConstants.setForeground(JTextPaneAppender.ATTRIBUTE_INFORM, LogLevelUtil.COLOR_BLU); |
285 |
1
1. applyTheme : removed call to javax/swing/text/StyleConstants::setForeground → NO_COVERAGE |
StyleConstants.setForeground(JTextPaneAppender.ATTRIBUTE_SUCCESS, LogLevelUtil.COLOR_GREEN); |
286 | } | |
287 | ||
288 | public static GridLayout getColumnLayout(int size) { | |
289 |
3
1. getColumnLayout : Replaced integer addition with subtraction → NO_COVERAGE 2. getColumnLayout : Replaced integer division with multiplication → NO_COVERAGE 3. getColumnLayout : replaced return value with null for com/jsql/view/swing/util/UiUtil::getColumnLayout → NO_COVERAGE |
return new GridLayout((size + 1) / 2, 2); |
290 | } | |
291 | } | |
Mutations | ||
173 |
1.1 |
|
175 |
1.1 2.2 |
|
206 |
1.1 |
|
210 |
1.1 2.2 |
|
216 |
1.1 |
|
224 |
1.1 2.2 3.3 4.4 5.5 |
|
226 |
1.1 |
|
228 |
1.1 |
|
231 |
1.1 |
|
232 |
1.1 |
|
237 |
1.1 |
|
240 |
1.1 |
|
241 |
1.1 2.2 3.3 |
|
242 |
1.1 2.2 |
|
248 |
1.1 |
|
251 |
1.1 |
|
254 |
1.1 |
|
255 |
1.1 |
|
261 |
1.1 |
|
263 |
1.1 |
|
271 |
1.1 |
|
273 |
1.1 |
|
280 |
1.1 |
|
283 |
1.1 |
|
284 |
1.1 |
|
285 |
1.1 |
|
289 |
1.1 2.2 3.3 |