01/01: Add a more generic method SwingUtil.getIcon with a classifier (Fixes #4040)
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository jaxx. See https://gitlab.nuiton.org/nuiton/jaxx.git commit 6d650b4a8cd77cfca85058aff9b8e9852140ab11 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Sep 16 18:15:35 2016 +0200 Add a more generic method SwingUtil.getIcon with a classifier (Fixes #4040) --- .../src/main/java/jaxx/runtime/SwingUtil.java | 38 ++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java index d80510c..4fd2900 100644 --- a/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java +++ b/jaxx-runtime/src/main/java/jaxx/runtime/SwingUtil.java @@ -233,7 +233,7 @@ public class SwingUtil extends JAXXUtil { } else { throw new IllegalArgumentException( "this method need a DefaultComboBoxModel for " + - "this model but was " + combo.getModel().getClass()); + "this model but was " + combo.getModel().getClass()); } } @@ -273,7 +273,7 @@ public class SwingUtil extends JAXXUtil { } else { throw new IllegalArgumentException( "this method need a DefaultListModel for this model " + - "but was " + listModel.getClass()); + "but was " + listModel.getClass()); } } @@ -339,7 +339,7 @@ public class SwingUtil extends JAXXUtil { } if (!Container.class.isAssignableFrom(top.getClass())) { throw new IllegalArgumentException("top parameter " + top + - " is not a " + Container.class); + " is not a " + Container.class); } Container parent = ((Container) top).getParent(); if (parent != null && !clazz.isAssignableFrom(parent.getClass())) { @@ -533,7 +533,7 @@ public class SwingUtil extends JAXXUtil { i.add((Container) c); String name = c.getName(); if (c instanceof JComponent && - name != null && !"".equals(name)) { + name != null && !"".equals(name)) { allNamedComponent.put(name, (JComponent) c); } } @@ -585,7 +585,6 @@ public class SwingUtil extends JAXXUtil { /** * Try to load the Nimbus look and feel. * - * * @throws UnsupportedLookAndFeelException if nimbus is not applicable * @throws ClassNotFoundException * @throws InstantiationException @@ -873,7 +872,7 @@ public class SwingUtil extends JAXXUtil { @Override public String toString() { return super.toString() + "< reverse:" + reverse + ", index:" + - index + ", size:" + tabs.getTabCount() + " >"; + index + ", size:" + tabs.getTabCount() + " >"; } protected void setReverse(boolean reverse) { @@ -948,7 +947,7 @@ public class SwingUtil extends JAXXUtil { synchronized (cont.getTreeLock()) { if (!(x >= 0 && x < width && y >= 0 && y < height && - cont.isVisible() && cont.isEnabled())) { + cont.isVisible() && cont.isEnabled())) { return null; } @@ -1072,8 +1071,8 @@ public class SwingUtil extends JAXXUtil { try { URL u = he.getURL(); if (u.getProtocol().equalsIgnoreCase("mailto") || - u.getProtocol().equalsIgnoreCase("http") || - u.getProtocol().equalsIgnoreCase("ftp")) { + u.getProtocol().equalsIgnoreCase("http") || + u.getProtocol().equalsIgnoreCase("ftp")) { Desktop.getDesktop().browse(u.toURI()); } } catch (IOException e) { @@ -1177,9 +1176,9 @@ public class SwingUtil extends JAXXUtil { public void run() { for (TreePath path : e.getPaths()) { if (e.isAddedPath(path) && - !tree.isExpanded(path)) { + !tree.isExpanded(path)) { log.info("expand node [" + path - + "]"); + + "]"); // will expand the node tree.expandPath(path); } @@ -1214,7 +1213,7 @@ public class SwingUtil extends JAXXUtil { public void run() { for (TreePath path : e.getPaths()) { if (e.isAddedPath(path) && - !treeTable.isExpanded(path)) { + !treeTable.isExpanded(path)) { log.info("expand node [" + path + "]"); // will expand the node treeTable.expandPath(path); @@ -1309,7 +1308,12 @@ public class SwingUtil extends JAXXUtil { public static ImageIcon createActionIcon(String name) { String iconPath = getIconPath(); - return createIcon(iconPath + "action-" + name + ".png"); + return createIcon("action", name); + } + + public static ImageIcon createIcon(String classifier, String name) { + String iconPath = getIconPath(); + return createIcon(iconPath + classifier + "-" + name + ".png"); } public static ImageIcon createI18nIcon(String name) { @@ -1412,7 +1416,7 @@ public class SwingUtil extends JAXXUtil { if (log.isDebugEnabled()) { log.debug("Select row[" + row + "] column[" + colummn + - "] return : " + result); + "] return : " + result); } } return result; @@ -1423,7 +1427,7 @@ public class SwingUtil extends JAXXUtil { if (rowIndex < -1 || rowIndex >= model.getRowCount()) { throw new ArrayIndexOutOfBoundsException( "the rowIndex was " + rowIndex + ", but should be int [0," - + (model.getRowCount() - 1) + "]"); + + (model.getRowCount() - 1) + "]"); } } @@ -1432,7 +1436,7 @@ public class SwingUtil extends JAXXUtil { if (index < -1 || index >= model.getColumnCount()) { throw new ArrayIndexOutOfBoundsException( "the columnIndex was " + index + ", but should be int [0," - + (model.getColumnCount() - 1) + "]"); + + (model.getColumnCount() - 1) + "]"); } } @@ -1486,7 +1490,7 @@ public class SwingUtil extends JAXXUtil { */ public static char getFirstCharAt(String text, char defaultValue) { return text == null || text.trim().length() == 0 ? - defaultValue : text.charAt(0); + defaultValue : text.charAt(0); } public static void openLink(URI uri) { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm