From 0666c32eb053e4a7c1c12a7c36d08357a53e868b Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Sun, 16 Mar 2014 02:40:48 +0100 Subject: [PATCH] fix tree demo (missing icons) --- .idea/misc.xml | 2 +- src/com/bulenkov/darcula/DarculaLaf.java | 4 ++ src/com/bulenkov/darcula/DarculaUIUtil.java | 36 ++++++++++++++++-- src/com/bulenkov/darcula/darcula.properties | 2 - .../darcula/icons/treeNodeCollapsed.png | Bin 0 -> 222 bytes .../darcula/icons/treeNodeCollapsed@2x.png | Bin 0 -> 337 bytes .../darcula/icons/treeNodeExpanded.png | Bin 0 -> 216 bytes .../darcula/icons/treeNodeExpanded@2x.png | Bin 0 -> 327 bytes .../bulenkov/darcula/ui/DarculaTreeUI.java | 5 ++- .../sun/swingset3/demos/DemoUtilities.java | 14 ++----- .../sun/swingset3/demos/table/TableDemo.java | 4 +- .../sun/swingset3/utilities/Utilities.java | 11 ++---- 12 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 src/com/bulenkov/darcula/icons/treeNodeCollapsed.png create mode 100644 src/com/bulenkov/darcula/icons/treeNodeCollapsed@2x.png create mode 100644 src/com/bulenkov/darcula/icons/treeNodeExpanded.png create mode 100644 src/com/bulenkov/darcula/icons/treeNodeExpanded@2x.png diff --git a/.idea/misc.xml b/.idea/misc.xml index 3dd2a0c..75af768 100755 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -6,7 +6,7 @@ - + diff --git a/src/com/bulenkov/darcula/DarculaLaf.java b/src/com/bulenkov/darcula/DarculaLaf.java index cd8cfdd..9380dd3 100755 --- a/src/com/bulenkov/darcula/DarculaLaf.java +++ b/src/com/bulenkov/darcula/DarculaLaf.java @@ -16,6 +16,7 @@ package com.bulenkov.darcula; +import com.bulenkov.iconloader.IconLoader; import com.bulenkov.iconloader.util.ColorUtil; import com.bulenkov.iconloader.util.StringUtil; import com.bulenkov.iconloader.util.SystemInfo; @@ -92,6 +93,9 @@ public final class DarculaLaf extends BasicLookAndFeel { patchComboBox(metalDefaults, defaults); defaults.remove("Spinner.arrowButtonBorder"); defaults.put("Spinner.arrowButtonSize", new Dimension(16, 5)); + defaults.put("Tree.collapsedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeCollapsed.png"))); + defaults.put("Tree.expandedIcon", new IconUIResource(IconLoader.getIcon("/com/bulenkov/darcula/icons/treeNodeExpanded.png"))); + return defaults; } catch (Exception ignore) { diff --git a/src/com/bulenkov/darcula/DarculaUIUtil.java b/src/com/bulenkov/darcula/DarculaUIUtil.java index 10eb795..64d809c 100755 --- a/src/com/bulenkov/darcula/DarculaUIUtil.java +++ b/src/com/bulenkov/darcula/DarculaUIUtil.java @@ -15,11 +15,9 @@ */ package com.bulenkov.darcula; -import com.bulenkov.iconloader.util.ColorUtil; -import com.bulenkov.iconloader.util.DoubleColor; -import com.bulenkov.iconloader.util.SystemInfo; -import com.bulenkov.iconloader.util.UIUtil; +import com.bulenkov.iconloader.util.*; +import javax.swing.*; import java.awt.*; /** @@ -140,5 +138,35 @@ public class DarculaUIUtil { g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, oldStrokeControlValue); } + public static Icon getTreeNodeIcon(boolean expanded, boolean selected, boolean focused) { + boolean white = (selected && focused) || UIUtil.isUnderDarcula(); + + Icon selectedIcon = getTreeSelectedExpandedIcon(); + Icon notSelectedIcon = getTreeExpandedIcon(); + + int width = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth()); + int height = Math.max(selectedIcon.getIconWidth(), notSelectedIcon.getIconWidth()); + + return new CenteredIcon(expanded ? (white ? getTreeSelectedExpandedIcon() : getTreeExpandedIcon()) + : (white ? getTreeSelectedCollapsedIcon() : getTreeCollapsedIcon()), + width, height, false + ); + } + + public static Icon getTreeCollapsedIcon() { + return UIManager.getIcon("Tree.collapsedIcon"); + } + + public static Icon getTreeExpandedIcon() { + return UIManager.getIcon("Tree.expandedIcon"); + } + + public static Icon getTreeSelectedCollapsedIcon() { + return getTreeCollapsedIcon(); + } + + public static Icon getTreeSelectedExpandedIcon() { + return getTreeExpandedIcon(); + } } diff --git a/src/com/bulenkov/darcula/darcula.properties b/src/com/bulenkov/darcula/darcula.properties index c1cab5c..9d029a7 100755 --- a/src/com/bulenkov/darcula/darcula.properties +++ b/src/com/bulenkov/darcula/darcula.properties @@ -159,7 +159,5 @@ Hyperlink.linkColor=589df6 #Table.background=45494A #Tree.background=45494A -Tree.collapsedIcon=AllIcons.Mac.Tree_white_right_arrow -Tree.expandedIcon=AllIcons.Mac.Tree_white_down_arrow FileView.fileIcon=AllIcons.FileTypes.Unknown \ No newline at end of file diff --git a/src/com/bulenkov/darcula/icons/treeNodeCollapsed.png b/src/com/bulenkov/darcula/icons/treeNodeCollapsed.png new file mode 100644 index 0000000000000000000000000000000000000000..1bff9016044dba0270a3978c14e3ea6df7823625 GIT binary patch literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s1|(OmDOUqhk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5X8a!PbLn>}1{rUgjo_S*f>#>OKd3S{rLb;Bd->AvM#g&xc z^vIq0qprd_wj{qCsTmi3*f`u_Ix@Y{V#0(Zi2$~pJRRSeH<~FPHF&^q+x}FwcKv?l6bvh?+xpDSpK3S~HAUbwS!;uHxM4g-c*OQ~f! T0h-xBw=j6R`njxgN@xNAB*jiA literal 0 HcmV?d00001 diff --git a/src/com/bulenkov/darcula/icons/treeNodeCollapsed@2x.png b/src/com/bulenkov/darcula/icons/treeNodeCollapsed@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1b034a9c444427c8f93d2057150b1f485616145a GIT binary patch literal 337 zcmV-X0j~auP)I}Wu-VvbiXsSt*%aq{+na1R$2}K3+h@03cz1iA-}9bs z+qM=&8CpOUet%(E)|5vL+g}beP1E&@vsj~#m~<;bDB*wxBGNsMqK!QY(4~hL#}G?o zf=ERg3yhGEj+@htJa*`)c8TWL8E9P%xbz-fi3N$NXgU$i1+jUCimBMa7nG62#C4^= zs0Vsz;rj8e@K|FtxTEJw=tHeg!CY!VPADSf}1{rUgjo_S+KXCuo2CZ%g@qqj4A?0g)!U0Flp zgm79Br@;TC3qSCO$i3^)cCZm|Pnz%}w8Z>6<41Lq*7*w_Nyyc39+{ibb-VG0=(-Cp zm>;N-X2k#cZ-t5qw9)9QFvsHcgx&!NOs{5OZDj$<(@=9za(x Nc)I$ztaD0e0s!_{P51x+ literal 0 HcmV?d00001 diff --git a/src/com/bulenkov/darcula/icons/treeNodeExpanded@2x.png b/src/com/bulenkov/darcula/icons/treeNodeExpanded@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..fa2ad0b8710213c80ec0b0ab47feb1834462cab3 GIT binary patch literal 327 zcmV-N0l5B&P)P-Y{|YKbaq0E}h#Qgkb>(2); filters.add(winnerFilter); filters.add(searchFilter); - RowFilter comboFilter = RowFilter.andFilter((Iterable>) filters); - sorter.setRowFilter(comboFilter); +// RowFilter comboFilter = RowFilter.andFilter((Iterable>) filters); + sorter.setRowFilter(RowFilter.andFilter(filters)); } else if (showOnlyWinners) { sorter.setRowFilter(winnerFilter); } else if (hasFilterString()) { diff --git a/swingset3/com/sun/swingset3/utilities/Utilities.java b/swingset3/com/sun/swingset3/utilities/Utilities.java index 2b19ad6..e8b3751 100644 --- a/swingset3/com/sun/swingset3/utilities/Utilities.java +++ b/swingset3/com/sun/swingset3/utilities/Utilities.java @@ -31,16 +31,11 @@ package com.sun.swingset3.utilities; -import java.awt.Color; -import java.awt.GradientPaint; -import java.awt.Graphics2D; -import java.awt.GraphicsEnvironment; -import java.awt.Transparency; +import javax.swing.*; +import java.awt.*; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.net.URL; -import javax.jnlp.ServiceManager; -import javax.swing.SwingConstants; /** * @@ -53,7 +48,7 @@ public class Utilities { } public static boolean runningFromWebStart() { - return ServiceManager.getServiceNames() != null; + return false; } public static String getURLFileName(URL url) {