? windows/src/org/openide/windows/DisplayInterceptor.java Index: openide-spec-vers.properties =================================================================== RCS file: /cvs/openide/openide-spec-vers.properties,v retrieving revision 1.174 diff -u -r1.174 openide-spec-vers.properties --- openide-spec-vers.properties 6 May 2005 08:09:45 -0000 1.174 +++ openide-spec-vers.properties 3 Jun 2005 14:04:01 -0000 @@ -4,4 +4,4 @@ # Must always be numeric (numbers separated by '.', e.g. 4.11). # See http://openide.netbeans.org/versioning-policy.html for more. -openide.specification.version=6.4 +openide.specification.version=6.5 Index: nodes/apichanges.xml =================================================================== RCS file: /cvs/openide/nodes/apichanges.xml,v retrieving revision 1.2 diff -u -r1.2 apichanges.xml --- nodes/apichanges.xml 20 May 2005 10:27:56 -0000 1.2 +++ nodes/apichanges.xml 3 Jun 2005 14:04:04 -0000 @@ -19,6 +19,26 @@ + AbstractNode allows using different icon extensions + + + + + + Adding possibility for AbstractNode to use PNG files + as icons. Adding new final method + setIconBaseAndExtension(String base,String extension) + which complements original method for manipulating icon base, + setIconBase(String). The default extension is + ".gif" as it used to be. + The original method setIconBase(String) delegates + to the new one, using the default extension. + + + + + + FilterNode allows controlling delegation of getValue/setValue calls Index: nodes/src/org/openide/nodes/AbstractNode.java =================================================================== RCS file: /cvs/openide/nodes/src/org/openide/nodes/AbstractNode.java,v retrieving revision 1.1 diff -u -r1.1 AbstractNode.java --- nodes/src/org/openide/nodes/AbstractNode.java 21 Apr 2005 20:13:16 -0000 1.1 +++ nodes/src/org/openide/nodes/AbstractNode.java 3 Jun 2005 14:04:05 -0000 @@ -50,28 +50,28 @@ private static final String[] icons = { // color 16x16 - ".gif", // NOI18N + "", // NOI18N // color 32x32 - "32.gif", // NOI18N + "32", // NOI18N // mono 16x16 - ".gif", // NOI18N + "", // NOI18N // mono 32x32 - "32.gif", // NOI18N + "32", // NOI18N // opened color 16x16 - "Open.gif", // NOI18N + "Open", // NOI18N // opened color 32x32 - "Open32.gif", // NOI18N + "Open32", // NOI18N // opened mono 16x16 - "Open.gif", // NOI18N + "Open", // NOI18N // opened mono 32x32 - "Open32.gif" // NOI18N + "Open32" // NOI18N }; /** To index normal icon from previous array use @@ -90,7 +90,9 @@ /** default icon base for all nodes */ private static final String DEFAULT_ICON_BASE = "org/openide/resources/defaultNode"; // NOI18N - private static final String DEFAULT_ICON = DEFAULT_ICON_BASE + ".gif"; // NOI18N + private static final String DEFAULT_ICON_EXTENSION = ".gif"; // NOI18N + private static final String DEFAULT_ICON = DEFAULT_ICON_BASE + DEFAULT_ICON_EXTENSION; // NOI18N + private static final WeakHashMap overridesGetDefaultAction = new WeakHashMap(27); /** Message format to use for creation of the display name. @@ -111,6 +113,9 @@ /** Resource base for icons (without suffix denoting right icon) */ private String iconBase = DEFAULT_ICON_BASE; + /** Resource extension for icons */ + private String iconExtension = DEFAULT_ICON_EXTENSION; + /** array of cookies for this node */ private Object lookup; @@ -198,12 +203,29 @@ * the real name of the icon is obtained by the applying icon message * formats. * - *

For example, for the base resource/MyIcon, the - * following images may be used according to the icon state and - * {@link java.beans.BeanInfo#getIcon presentation type}: + * The method just delegates to {$link #setIconBaseAndExtension(java.lang.String,%20java.lang.String)} + * using ".gif" as extension. * - *

  • resource/MyIcon.gif
  • resource/MyIconOpen.gif - *
  • resource/MyIcon32.gif
  • resource/MyIconOpen32.gif
+ * @param base base resouce name (no initial slash) + */ + public void setIconBase(String base) { + setIconBaseAndExtension(base, DEFAULT_ICON_EXTENSION); + } + + /** Change the icon. + * One need only specify the base resource name and extension; + * the real name of the icon is obtained by the applying icon message + * formats. + * + *

For example, for the base resource/MyIcon and extension + * .png, the following images may be used according to the icon + * state and {@link java.beans.BeanInfo#getIcon presentation type}: + * + *

    + *
  • resource/MyIcon.png + *
  • resource/MyIconOpen.png + *
  • resource/MyIcon32.png + *
  • resource/MyIconOpen32.png
* *

* This method may be used to dynamically switch between different sets @@ -211,17 +233,24 @@ * an icon property change event is fired. * * @param base base resouce name (no initial slash) - */ - public void setIconBase(String base) { - if ((base != null) && base.equals(iconBase)) { + * @param extension file extension of the resource, with the separating dot, + * for example .png + * @since OpenIDE 6.5 + */ + public final void setIconBaseAndExtension(String base, String extension) { + if ((base != null) && base.equals(iconBase) && + (extension != null) && extension.equals(iconExtension)) { return; } this.iconBase = base; + this.iconExtension = extension; fireIconChange(); fireOpenedIconChange(); } + + /** Find an icon for this node. Uses an {@link #setIconBase icon set}. * * @param type constants from {@link java.beans.BeanInfo} @@ -251,7 +280,7 @@ * @param ib base where to scan in the array */ private Image findIcon(int type, int ib) { - String res = iconBase + icons[type + ib]; + String res = iconBase + icons[type + ib] + iconExtension; Image im = Utilities.loadImage(res, true); if (im != null) { @@ -259,7 +288,7 @@ } // try the first icon - res = iconBase + icons[java.beans.BeanInfo.ICON_COLOR_16x16 + ib]; + res = iconBase + icons[java.beans.BeanInfo.ICON_COLOR_16x16 + ib] + iconExtension; im = Utilities.loadImage(res, true);