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 53461
Collapse All | Expand All

(-)openide-spec-vers.properties (-1 / +1 lines)
Lines 4-7 Link Here
4
# Must always be numeric (numbers separated by '.', e.g. 4.11).
4
# Must always be numeric (numbers separated by '.', e.g. 4.11).
5
# See http://openide.netbeans.org/versioning-policy.html for more.
5
# See http://openide.netbeans.org/versioning-policy.html for more.
6
6
7
openide.specification.version=6.4
7
openide.specification.version=6.5
(-)nodes/apichanges.xml (+20 lines)
Lines 19-24 Link Here
19
<changes>
19
<changes>
20
<change>
20
<change>
21
     <api name="nodes"/>
21
     <api name="nodes"/>
22
     <summary>AbstractNode allows using different icon extensions</summary>
23
     <version major="6" minor="5"/>
24
     <date day="13" month="7" year="2005"/>
25
     <author login="pnejedly"/>
26
     <compatibility addition="yes" binary="compatible" source="compatible" semantic="compatible" deprecation="no" deletion="no" modification="no"/>
27
     <description>
28
        Adding possibility for <code>AbstractNode</code> to use PNG files
29
        as icons. Adding new final method
30
        <code>setIconBaseAndExtension(String base,String extension)</code>
31
        which complements original method for manipulating icon base,
32
        <code>setIconBase(String)</code>. The default extension is
33
        <code>".gif"</code> as it used to be.
34
        The original method <code>setIconBase(String)</code> delegates
35
        to the new one, using the default extension.
36
     </description>
37
     <class package="org.openide.nodes" name="AbstractNode"/>
38
     <issue number="53461"/>
39
    </change>
40
<change>
41
     <api name="nodes"/>
22
     <summary>FilterNode allows controlling delegation of getValue/setValue calls</summary>
42
     <summary>FilterNode allows controlling delegation of getValue/setValue calls</summary>
23
     <version major="4" minor="25"/>
43
     <version major="4" minor="25"/>
24
     <date day="13" month="2" year="2004"/>
44
     <date day="13" month="2" year="2004"/>
(-)nodes/src/org/openide/nodes/AbstractNode.java (-19 / +48 lines)
Lines 50-77 Link Here
50
    private static final String[] icons = {
50
    private static final String[] icons = {
51
        
51
        
52
        // color 16x16
52
        // color 16x16
53
        ".gif", // NOI18N
53
        "", // NOI18N
54
54
55
        // color 32x32
55
        // color 32x32
56
        "32.gif", // NOI18N
56
        "32", // NOI18N
57
57
58
        // mono 16x16
58
        // mono 16x16
59
        ".gif", // NOI18N
59
        "", // NOI18N
60
60
61
        // mono 32x32
61
        // mono 32x32
62
        "32.gif", // NOI18N
62
        "32", // NOI18N
63
63
64
        // opened color 16x16
64
        // opened color 16x16
65
        "Open.gif", // NOI18N
65
        "Open", // NOI18N
66
66
67
        // opened color 32x32
67
        // opened color 32x32
68
        "Open32.gif", // NOI18N
68
        "Open32", // NOI18N
69
69
70
        // opened mono 16x16
70
        // opened mono 16x16
71
        "Open.gif", // NOI18N
71
        "Open", // NOI18N
72
72
73
        // opened mono 32x32
73
        // opened mono 32x32
74
        "Open32.gif" // NOI18N
74
        "Open32" // NOI18N
75
    };
75
    };
76
76
77
    /** To index normal icon from previous array use
77
    /** To index normal icon from previous array use
Lines 90-96 Link Here
90
90
91
    /** default icon base for all nodes */
91
    /** default icon base for all nodes */
92
    private static final String DEFAULT_ICON_BASE = "org/openide/resources/defaultNode"; // NOI18N
92
    private static final String DEFAULT_ICON_BASE = "org/openide/resources/defaultNode"; // NOI18N
93
    private static final String DEFAULT_ICON = DEFAULT_ICON_BASE + ".gif"; // NOI18N
93
    private static final String DEFAULT_ICON_EXTENSION = ".gif"; // NOI18N
94
    private static final String DEFAULT_ICON = DEFAULT_ICON_BASE + DEFAULT_ICON_EXTENSION; // NOI18N
95
    
94
    private static final WeakHashMap overridesGetDefaultAction = new WeakHashMap(27);
96
    private static final WeakHashMap overridesGetDefaultAction = new WeakHashMap(27);
95
97
96
    /** Message format to use for creation of the display name.
98
    /** Message format to use for creation of the display name.
Lines 111-116 Link Here
111
    /** Resource base for icons (without suffix denoting right icon)  */
113
    /** Resource base for icons (without suffix denoting right icon)  */
112
    private String iconBase = DEFAULT_ICON_BASE;
114
    private String iconBase = DEFAULT_ICON_BASE;
113
115
116
    /** Resource extension for icons  */
117
    private String iconExtension = DEFAULT_ICON_EXTENSION;
118
    
114
    /** array of cookies for this node */
119
    /** array of cookies for this node */
115
    private Object lookup;
120
    private Object lookup;
116
121
Lines 198-209 Link Here
198
    * the real name of the icon is obtained by the applying icon message
203
    * the real name of the icon is obtained by the applying icon message
199
    * formats.
204
    * formats.
200
    *
205
    *
201
    * <p>For example, for the base <code>resource/MyIcon</code>, the
206
    * The method just delegates to {$link #setIconBaseAndExtension(java.lang.String,%20java.lang.String)}
202
    * following images may be used according to the icon state and
207
    * using ".gif" as extension.
203
    * {@link java.beans.BeanInfo#getIcon presentation type}:
204
    *
208
    *
205
    * <ul><li><code>resource/MyIcon.gif</code><li><code>resource/MyIconOpen.gif</code>
209
    * @param base base resouce name (no initial slash)
206
    * <li><code>resource/MyIcon32.gif</code><li><code>resource/MyIconOpen32.gif</code></ul>
210
    */
211
    public void setIconBase(String base) {
212
        setIconBaseAndExtension(base, DEFAULT_ICON_EXTENSION);
213
    }
214
215
    /** Change the icon.
216
    * One need only specify the base resource name and extension;
217
    * the real name of the icon is obtained by the applying icon message
218
    * formats.
219
    *
220
    * <p>For example, for the base <code>resource/MyIcon</code> and extension
221
    * <code>.png</code>, the following images may be used according to the icon
222
    * state and {@link java.beans.BeanInfo#getIcon presentation type}:
223
    *
224
    * <ul>
225
    * <li><code>resource/MyIcon.png</code>
226
    * <li><code>resource/MyIconOpen.png</code>
227
    * <li><code>resource/MyIcon32.png</code>
228
    * <li><code>resource/MyIconOpen32.png</code></ul>
207
    *
229
    *
208
    * <P>
230
    * <P>
209
    * This method may be used to dynamically switch between different sets
231
    * This method may be used to dynamically switch between different sets
Lines 211-227 Link Here
211
    * an icon property change event is fired.
233
    * an icon property change event is fired.
212
    *
234
    *
213
    * @param base base resouce name (no initial slash)
235
    * @param base base resouce name (no initial slash)
214
    */
236
    * @param extension file extension of the resource, with the separating dot,
215
    public void setIconBase(String base) {
237
    *  for example <code>.png</code>
216
        if ((base != null) && base.equals(iconBase)) {
238
    * @since OpenIDE 6.5
239
    */
240
    public final void setIconBaseAndExtension(String base, String extension) {
241
        if ((base != null) && base.equals(iconBase) &&
242
            (extension != null) && extension.equals(iconExtension)) {
217
            return;
243
            return;
218
        }
244
        }
219
245
220
        this.iconBase = base;
246
        this.iconBase = base;
247
        this.iconExtension = extension;
221
        fireIconChange();
248
        fireIconChange();
222
        fireOpenedIconChange();
249
        fireOpenedIconChange();
223
    }
250
    }
224
251
252
    
253
225
    /** Find an icon for this node. Uses an {@link #setIconBase icon set}.
254
    /** Find an icon for this node. Uses an {@link #setIconBase icon set}.
226
    *
255
    *
227
    * @param type constants from {@link java.beans.BeanInfo}
256
    * @param type constants from {@link java.beans.BeanInfo}
Lines 251-257 Link Here
251
    * @param ib base where to scan in the array
280
    * @param ib base where to scan in the array
252
    */
281
    */
253
    private Image findIcon(int type, int ib) {
282
    private Image findIcon(int type, int ib) {
254
        String res = iconBase + icons[type + ib];
283
        String res = iconBase + icons[type + ib] + iconExtension;
255
        Image im = Utilities.loadImage(res, true);
284
        Image im = Utilities.loadImage(res, true);
256
285
257
        if (im != null) {
286
        if (im != null) {
Lines 259-265 Link Here
259
        }
288
        }
260
289
261
        // try the first icon
290
        // try the first icon
262
        res = iconBase + icons[java.beans.BeanInfo.ICON_COLOR_16x16 + ib];
291
        res = iconBase + icons[java.beans.BeanInfo.ICON_COLOR_16x16 + ib] + iconExtension;
263
292
264
        im = Utilities.loadImage(res, true);
293
        im = Utilities.loadImage(res, true);
265
294

Return to bug 53461