On 10/20/2010 10:21 AM, Vincent Massol wrote:
Hi,
In order to implement support for icons/symbols in the rendering (see ), we need to add
an API to return an icon URL based on the icon name.
public interface SkinAccessBridge
{
...
/**
* @param iconName the standard name of an icon (it's not the name of the file
on the filesystem, it's a generic
* name, for example "success" for a success icon
* @return the URL to the icon resource
* @since 2.6M1
*/
String getIconURL(String iconName);
}
+1 from me.
I don't think this is enough. We currently have only one implementation
for this component, which uses only the current skin (as taken from the
XWiki Context). This means that it won't support multiple icon sets.
I'd rather introduce another component for IconTheme, which use the
existing SkinAccessBridge#getSkinFile(full path to the icon). There will
be several implementations for the IconTheme, the one active by default
being based on silk/gif. We'll have to find a way to select the desired
IconTheme to use (could be customized for each wiki in a farm, for each
skin, for each user?).
Each IconTheme would have a basePath ("resources/icons/silk/"), and by
default each icon is mapped to the same filename, plus an extension. A
custom mapping from icon names to filenames could be provided in a
configuration file (standard .properties). If this is loaded as a
ResourceBundle, there's no need to even code the default, since
ResourceBundle.get("key") returns the unchanged key for undefined values.
WDYT?
--
Sergiu Dumitriu
http://purl.org/net/sergiu/