Package org.xwiki.icon
Class IconManagerScriptService
- java.lang.Object
-
- org.xwiki.icon.IconManagerScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("icon") @Singleton public class IconManagerScriptService extends Object implements org.xwiki.script.service.ScriptService
Script services to render an icon from the current icon set.- Since:
- 6.2M1
- Version:
- $Id: 42f770d5125cc901a27e07abc4da727dee8d7034 $
-
-
Constructor Summary
Constructors Constructor Description IconManagerScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCurrentIconSetName()
Get the name of the current icon set.List<String>
getIconNames()
Get the list of the names of all available icons in the current icon set.List<String>
getIconNames(String iconSetName)
Get the list of the names of all available icons in the specified icon set.List<String>
getIconSetNames()
Get the name of all the icon sets present in the current wiki.IconException
getLastError()
Get the error generated while performing the previously called action.Map<String,Object>
getMetaData(String iconName)
Generate metadata of an icon.Map<String,Object>
getMetaData(String iconName, String iconSetName)
Generate metadata of an icon.Map<String,Object>
getMetaData(String iconName, String iconSetName, boolean fallback)
Generate metadata of an icon.String
render(String iconName)
Display an icon with wiki code from the currentIconSet
.String
render(String iconName, String iconSetName)
Display an icon with wiki code from the specifiedIconSet
.String
render(String iconName, String iconSetName, boolean fallback)
Display an icon with wiki code from the specifiedIconSet
.String
renderHTML(String iconName)
Display an icon with HTML code from the currentIconSet
.String
renderHTML(String iconName, String iconSetName)
Display an icon with HTML code from the specifiedIconSet
.String
renderHTML(String iconName, String iconSetName, boolean fallback)
Display an icon from the specifiedIconSet
.void
use()
Pull the necessary resources to use the default icon set.void
use(String iconSetName)
Pull the necessary resources to use the specified icon set.
-
-
-
Method Detail
-
render
public String render(String iconName)
Display an icon with wiki code from the currentIconSet
.- Parameters:
iconName
- name of the icon to display- Returns:
- the wiki code that displays the icon
-
render
public String render(String iconName, String iconSetName)
Display an icon with wiki code from the specifiedIconSet
.- Parameters:
iconName
- name of the icon to displayiconSetName
- name of the icon set- Returns:
- the wiki code that displays the icon
- Since:
- 6.3RC1
-
render
public String render(String iconName, String iconSetName, boolean fallback)
Display an icon with wiki code from the specifiedIconSet
.- Parameters:
iconName
- name of the icon to displayiconSetName
- name of the icon setfallback
- enable the fallback to the default icon theme if the icon does not exist- Returns:
- the wiki code that displays the icon
- Since:
- 6.3RC1
-
renderHTML
public String renderHTML(String iconName)
Display an icon with HTML code from the currentIconSet
.- Parameters:
iconName
- name of the icon to display- Returns:
- the HTML code that displays the icon
-
renderHTML
public String renderHTML(String iconName, String iconSetName)
Display an icon with HTML code from the specifiedIconSet
.- Parameters:
iconName
- name of the icon to displayiconSetName
- name of the icon set- Returns:
- the HTML code that displays the icon
- Since:
- 6.3RC1
-
renderHTML
public String renderHTML(String iconName, String iconSetName, boolean fallback)
Display an icon from the specifiedIconSet
.- Parameters:
iconName
- name of the icon to displayiconSetName
- name of the icon setfallback
- enable the fallback to the default icon theme if the icon does not exist- Returns:
- the HTML code that displays the icon
- Since:
- 6.3RC1
-
use
public void use()
Pull the necessary resources to use the default icon set.- Since:
- 10.6RC1
-
use
public void use(String iconSetName)
Pull the necessary resources to use the specified icon set.- Parameters:
iconSetName
- name of the icon set- Since:
- 10.6RC1
-
getIconSetNames
public List<String> getIconSetNames()
Get the name of all the icon sets present in the current wiki.- Returns:
- the list of the name of the icon sets present in the current wiki.
- Since:
- 6.4M1
-
getIconNames
public List<String> getIconNames()
Get the list of the names of all available icons in the current icon set.- Returns:
- the icon names
- Since:
- 6.4M1
-
getIconNames
public List<String> getIconNames(String iconSetName)
Get the list of the names of all available icons in the specified icon set.- Parameters:
iconSetName
- name of the icon set- Returns:
- the icon names
- Since:
- 6.4M1
-
getCurrentIconSetName
public String getCurrentIconSetName()
Get the name of the current icon set.- Returns:
- the name of the current icon set
- Since:
- 6.4M2
-
getMetaData
public Map<String,Object> getMetaData(String iconName) throws IconException
Generate metadata of an icon.It can contain useful information such as:
- The icon set name
- The icon set type name
- The icon url if defined
- The icon css class if defined
- Parameters:
iconName
- name of the icon- Returns:
- a metadata map
- Throws:
IconException
- if problems occur- Since:
- 10.6RC1
-
getMetaData
public Map<String,Object> getMetaData(String iconName, String iconSetName) throws IconException
Generate metadata of an icon.It can contain useful information such as:
- The icon set name
- The icon set type name
- The icon url if defined
- The icon css class if defined
- Parameters:
iconName
- name of the iconiconSetName
- name of the icon set to use- Returns:
- a metadata map
- Throws:
IconException
- if problems occur- Since:
- 10.6RC1
-
getMetaData
public Map<String,Object> getMetaData(String iconName, String iconSetName, boolean fallback) throws IconException
Generate metadata of an icon.It can contain useful information such as:
- The icon set name
- The icon set type name
- The icon url if defined
- The icon css class if defined
- Parameters:
iconName
- name of the iconiconSetName
- name of the icon set to usefallback
- enable the fallback to the default icon set if the icon does not exist- Returns:
- a metadata map
- Throws:
IconException
- if problems occur- Since:
- 10.6RC1
-
getLastError
public IconException getLastError()
Get the error generated while performing the previously called action.- Returns:
- an eventual exception or
null
if no exception was thrown - Since:
- 6.3RC1
-
-