This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 247556
Collapse All | Expand All

(-)a/openide.explorer/apichanges.xml (+17 lines)
Lines 50-55 Link Here
50
<apidef name="explorer">Explorer API</apidef>
50
<apidef name="explorer">Explorer API</apidef>
51
</apidefs>
51
</apidefs>
52
<changes>
52
<changes>
53
    <change id="HideIcons">
54
        <api name="explorer"/>
55
        <summary>Hide node icons in OutlineView and TreeView.</summary>
56
        <version major="6" minor="59"/>
57
        <date day="13" month="10" year="2014"/>
58
        <author login="mentlicher"/>
59
        <compatibility binary="compatible" source="compatible" deprecation="no" deletion="no" addition="yes"/>
60
        <description>
61
            It is possible not to show icons in OutlineView and in TreeView and it's descendants.
62
            Methods OutlineView.setShowNodeIcons(boolean)/isShowNodeIcons()
63
            and NodeRenderer.setShowIcons(boolean)/isShowIcons()
64
            are added for this purpose.
65
        </description>
66
        <class package="org.openide.explorer.view" name="OutlineView"/>
67
        <class package="org.openide.explorer.view" name="NodeRenderer"/>
68
        <issue number="247556"/>
69
    </change>
53
    <change id="NoAutoComplete">
70
    <change id="NoAutoComplete">
54
        <api name="explorer"/>
71
        <api name="explorer"/>
55
        <summary>Turn auto-complete in combo box editor off.</summary>
72
        <summary>Turn auto-complete in combo box editor off.</summary>
(-)a/openide.explorer/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.openide.explorer
2
OpenIDE-Module: org.openide.explorer
3
OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/explorer/Bundle.properties
4
AutoUpdate-Essential-Module: true
4
AutoUpdate-Essential-Module: true
5
OpenIDE-Module-Specification-Version: 6.58
5
OpenIDE-Module-Specification-Version: 6.59
6
6
(-)a/openide.explorer/src/org/openide/explorer/view/NodeRenderDataProvider.java (+37 lines)
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
}
(-)a/openide.explorer/src/org/openide/explorer/view/NodeRenderer.java (+20 lines)
Lines 76-81 Link Here
76
76
77
    /** Flag indicating if to use big icons. */
77
    /** Flag indicating if to use big icons. */
78
    private boolean bigIcons = false;
78
    private boolean bigIcons = false;
79
    /** Flag indicating whether to show icons. */
80
    private boolean showIcons = true;
81
    private int labelGap;
79
    private HtmlRenderer.Renderer renderer = HtmlRenderer.createRenderer();
82
    private HtmlRenderer.Renderer renderer = HtmlRenderer.createRenderer();
80
83
81
    /** Creates default renderer. */
84
    /** Creates default renderer. */
Lines 112-117 Link Here
112
115
113
        return instance;
116
        return instance;
114
    }
117
    }
118
    
119
    public final void setShowIcons(boolean showIcons) {
120
        this.showIcons = showIcons;
121
        if (!showIcons) {
122
            labelGap = new JLabel().getIconTextGap();
123
        }
124
    }
125
    
126
    public final boolean isShowIcons() {
127
        return showIcons;
128
    }
115
129
116
    /** Finds the component that is capable of drawing the cell in a tree.
130
    /** Finds the component that is capable of drawing the cell in a tree.
117
     * @param value value can be either <code>Node</code>
131
     * @param value value can be either <code>Node</code>
Lines 212-217 Link Here
212
    private int configureFrom(
226
    private int configureFrom(
213
        HtmlRenderer.Renderer ren, Container target, boolean useOpenedIcon, boolean sel, VisualizerNode vis
227
        HtmlRenderer.Renderer ren, Container target, boolean useOpenedIcon, boolean sel, VisualizerNode vis
214
    ) {
228
    ) {
229
        if (!isShowIcons()) {
230
            ren.setIcon(null);
231
            ren.setIndent(labelGap);
232
            return 24;
233
        }
234
        
215
        Icon icon = vis.getIcon(useOpenedIcon, bigIcons);
235
        Icon icon = vis.getIcon(useOpenedIcon, bigIcons);
216
236
217
        if (icon.getIconWidth() > 0) {
237
        if (icon.getIconWidth() > 0) {
(-)a/openide.explorer/src/org/openide/explorer/view/OutlineView.java (-1 / +22 lines)
Lines 229-234 Link Here
229
    private Component searchPanel;
229
    private Component searchPanel;
230
    private final Object searchConstraints = new Object();
230
    private final Object searchConstraints = new Object();
231
    private KeyListener qsKeyListener;
231
    private KeyListener qsKeyListener;
232
    
233
    private NodeRenderDataProvider nodeRenderer;
232
234
233
    /** Creates a new instance of TableView */
235
    /** Creates a new instance of TableView */
234
    public OutlineView() {
236
    public OutlineView() {
Lines 260-266 Link Here
260
        };
262
        };
261
        outline.addKeyListener(qsKeyListener);
263
        outline.addKeyListener(qsKeyListener);
262
        rowModel.setOutline(outline);
264
        rowModel.setOutline(outline);
263
        outline.setRenderDataProvider(new NodeRenderDataProvider(outline));
265
        nodeRenderer = new NodeRenderDataProvider(outline);
266
        outline.setRenderDataProvider(nodeRenderer);
264
        SheetCell tableCell = new SheetCell.OutlineSheetCell(outline);
267
        SheetCell tableCell = new SheetCell.OutlineSheetCell(outline);
265
        outline.setDefaultRenderer(Node.Property.class, tableCell);
268
        outline.setDefaultRenderer(Node.Property.class, tableCell);
266
        outline.setDefaultEditor(Node.Property.class, tableCell);
269
        outline.setDefaultEditor(Node.Property.class, tableCell);
Lines 1367-1372 Link Here
1367
        }
1370
        }
1368
        return res;
1371
        return res;
1369
    }
1372
    }
1373
    
1374
    /**
1375
     * Turn node icon rendering on/off. Node icons are shown by default.
1376
     * @param showNodeIcons whether to show node icons or not.
1377
     * @since 6.59
1378
     */
1379
    public final void setShowNodeIcons(boolean showNodeIcons) {
1380
        nodeRenderer.setShowIcons(showNodeIcons);
1381
    }
1382
    
1383
    /**
1384
     * Test whether the node icons are shown.
1385
     * @return <code>true</code> when node icons are shown, <code>false</code> otherwise.
1386
     * @since 6.59
1387
     */
1388
    public final boolean isShowNodeIcons() {
1389
        return nodeRenderer.isShowIcons();
1390
    }
1370
1391
1371
    /**
1392
    /**
1372
     * Listener attached to the explorer manager and also to the
1393
     * Listener attached to the explorer manager and also to the

Return to bug 247556