There is one IconRenderer for each Category. The IconRenderer is responsible for monitoring the Category and generating icons for any Items that listeners have expressed interest in.
For more information on IconRenderers in general, see the IconRenderer documentation API documentation.
com.sgi.rhexamp.category.rhexampRhinoExampleCategory.iconRenderer = com.sgi.rhexamp.category.IconRendererIf this resource is not specified, then the HostContext creates a ResourceBasedIconRenderer object for the Category.
A: RHINO_EXAMPLE_CATEGORY=com.sgi.rhexamp.category.rhexampRhinoExampleCategory B: ${RHINO_EXAMPLE_CATEGORY}.icon = /com/sgi/sysadm/ui/images/sysadm.gif
In conjunction with the "iconBasedOn" resource, there should be "icon" resources, defined as <name>.icon.<Attribute's value>, where <Attribute's value> is one of the values that the Attribute specified by "iconBasedOn" can have. (See the ICON documentation for more information). If no "icon" resource is found that matched the value of the Attribute specified by "iconBasedOn", then the default icon (as described above) will be used.
For example, in the RhinoExample category, the icon is based on the type, so the following entries are made in the resource file:
A: RHINO_EXAMPLE_CATEGORY=com.sgi.rhexamp.category.rhexampRhinoExampleCategory B: C: ${RHINO_EXAMPLE_CATEGORY}.iconBasedOn = type D: ${RHINO_EXAMPLE_CATEGORY}.icon = com.sgi.rhexamp.ftr.Unknown E: ${RHINO_EXAMPLE_CATEGORY}.icon.Clock = com.sgi.rhexamp.ftr.Clock F: ${RHINO_EXAMPLE_CATEGORY}.icon.Printer = com.sgi.rhexamp.ftr.Printer G: ${RHINO_EXAMPLE_CATEGORY}.icon.NetscapeExecutable = com.sgi.rhexamp.ftr.NetscapeExecutableWith the resource defined as shown, then the icon displayed will be based on the "type" Attribute of the Item. For example, if the "type" is "Clock", then the FtrIcon com.sgi.rhexamp.ftr.Clock will be used. If the "type" Attribute is not one of "Clock", "Printer" or "NetscapeExecutable", then the com.sgi.rhexamp.ftr.Unknown will be displayed.
Another way to show different icons for each Item in the Category is to use the "iconModifiers" resource, defined as <name>.iconModifiers (see the ICON_MODIFIERS documentation for more information). This resource defines an array of Attributes of the Item that will be passed to the set method of FtrIcon. The FtrIcon can then use the Attributes to choose how to display the icon. The Attributes defined by the "iconModifiers" resource will be passed to the FtrIcon that is created. The Attributes will be passed to the FtrIcon both in the case where a default icon is used and in the case where a specific icon is used. These Attributes will be ignored if the icon is not an FtrIcon.
For example, if the FtrIcons for the RhinoExampleCategory could draw themselves differently based on the "mode" Attribute of the Item, then add the following to the resource file:
A: ${RHINO_EXAMPLE_CATEGORY}.iconModifiers0 = modeIn this case, the Item's "mode" Attribute will be passed to whatever FtrIcon is used (which - as described above - depends on the "type" Attribute).