Lines 43-50
Link Here
|
43 |
*/ |
43 |
*/ |
44 |
package org.openide.explorer.view; |
44 |
package org.openide.explorer.view; |
45 |
|
45 |
|
|
|
46 |
import java.awt.Component; |
47 |
import java.awt.Graphics; |
46 |
import java.util.ArrayList; |
48 |
import java.util.ArrayList; |
47 |
import java.util.Collections; |
49 |
import java.util.Collections; |
|
|
50 |
import javax.swing.Icon; |
48 |
import javax.swing.ImageIcon; |
51 |
import javax.swing.ImageIcon; |
49 |
import javax.swing.tree.AbstractLayoutCache; |
52 |
import javax.swing.tree.AbstractLayoutCache; |
50 |
import javax.swing.tree.TreeNode; |
53 |
import javax.swing.tree.TreeNode; |
Lines 60-65
Link Here
|
60 |
class NodeRenderDataProvider implements CheckRenderDataProvider { |
63 |
class NodeRenderDataProvider implements CheckRenderDataProvider { |
61 |
|
64 |
|
62 |
private Outline table; |
65 |
private Outline table; |
|
|
66 |
private boolean showIcons = true; |
67 |
private Icon emptyIcon; |
63 |
|
68 |
|
64 |
/** Creates a new instance of NodeRenderDataProvider */ |
69 |
/** Creates a new instance of NodeRenderDataProvider */ |
65 |
public NodeRenderDataProvider(Outline table) { |
70 |
public NodeRenderDataProvider(Outline table) { |
Lines 84-91
Link Here
|
84 |
public java.awt.Color getForeground(Object o) { |
89 |
public java.awt.Color getForeground(Object o) { |
85 |
return null; |
90 |
return null; |
86 |
} |
91 |
} |
|
|
92 |
|
93 |
public void setShowIcons(boolean showIcons) { |
94 |
this.showIcons = showIcons; |
95 |
if (!showIcons && emptyIcon == null) { |
96 |
emptyIcon = new EmptyIcon(); |
97 |
} |
98 |
} |
99 |
|
100 |
public boolean isShowIcons() { |
101 |
return showIcons; |
102 |
} |
87 |
|
103 |
|
88 |
public javax.swing.Icon getIcon(Object o) { |
104 |
public javax.swing.Icon getIcon(Object o) { |
|
|
105 |
if (!showIcons) { |
106 |
return emptyIcon; |
107 |
} |
89 |
Node n = Visualizer.findNode(o); |
108 |
Node n = Visualizer.findNode(o); |
90 |
if (n == null) { |
109 |
if (n == null) { |
91 |
throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + o + " of class " + o.getClass().getName()); |
110 |
throw new IllegalStateException("TreeNode must be VisualizerNode but was: " + o + " of class " + o.getClass().getName()); |
Lines 161-165
Link Here
|
161 |
c.setSelected(selected); |
180 |
c.setSelected(selected); |
162 |
} |
181 |
} |
163 |
} |
182 |
} |
|
|
183 |
|
184 |
private static final class EmptyIcon implements Icon { |
185 |
|
186 |
@Override |
187 |
public void paintIcon(Component c, Graphics g, int x, int y) { |
188 |
} |
189 |
|
190 |
@Override |
191 |
public int getIconWidth() { |
192 |
return 0; |
193 |
} |
194 |
|
195 |
@Override |
196 |
public int getIconHeight() { |
197 |
return 0; |
198 |
} |
199 |
|
200 |
} |
164 |
|
201 |
|
165 |
} |
202 |
} |