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