Interface ApiContentUiSupport<T extends Container>
-
- All Known Implementing Classes:
AttachmentApiContentUiSupport
,DefaultApiContentUiSupport
,SimpleApiContentUiSupport
public interface ApiContentUiSupport<T extends Container>
Provides metadata about of type com.atlassian.confluence.api.model.content.Container that might be useful in the web tier: the location of icons, relevant CSS classes, links and so on. Some of the methods also work interchangeably on search results, as they are often used interchangeably in the UI. There is similar interface named ContentUiSupport for type ConfluenceEntityObject which is core EntityObject But it is not good practice to use core EntityObject in front end code or api response. So this interface has been added for the frontender who uses api model com.atlassian.confluence.api.model.content.Content or of type com.atlassian.confluence.api.model.content.Container- Since:
- 8.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getContentCssClass(String contentType, String contentPluginKey)
Get the CSS class that can be applied to add an icon to some inline element describing the given content.String
getContentCssClass(T content)
Get the CSS class that can be applied to some inline element describing the given contentString
getContentTypeI18NKey(SearchResult result)
Get the I18N key for the content that is being referred to by this search resultString
getContentTypeI18NKey(T content)
Get the I18N key for the name of the given content.String
getIconCssClass(SearchResult result)
Get the CSS class that can be applied to add an icon to some inline element describing the given result.String
getIconCssClass(T content)
Get the CSS class that can be applied to add an icon to some inline element describing the given content.String
getIconFilePath(T content, int size)
Get the URL path to the icon for the gtiven piece of content, without prepending context or web static hashes.String
getIconPath(T content, int size)
Get the URL path to the icon for the given piece of content.String
getLegacyIconPath(String contentType, int size)
Get the URL path to the icon for the given type of content.
-
-
-
Method Detail
-
getIconFilePath
String getIconFilePath(T content, int size)
Get the URL path to the icon for the gtiven piece of content, without prepending context or web static hashes. This method is usedful in conjunction with theDataSourceFactory
, which does not handle context and web static hashes in the url.- Parameters:
content
- the content to find an icon forsize
- the size. Currently, only 16 is supported, and thus this parameter is ignored.- Returns:
- a URL for the icon.
-
getIconPath
String getIconPath(T content, int size)
Get the URL path to the icon for the given piece of content. Paths are relative to the site root, and will already have the context path prepended to them.All icons are square. If no icon is available at the requested size, the implementation should use the following priority to determine what to return:
- The smallest icon with width larger than the requested size
- If no icon is larger than the requested size, return the largest icon available
In general you can only assume a 16x16 icon will be available, but this may change in the future.
- Parameters:
content
- the content to find an icon forsize
- the intended width/height at which the icon will be displayed in pixels- Returns:
- the path to the icon that best suits the requested size
-
getLegacyIconPath
String getLegacyIconPath(String contentType, int size)
Get the URL path to the icon for the given type of content. Paths are relative to the site root, and will already have the context path prepended to them. This method will always return the generic icon for the given content: if you want to inspect the content and return different icons based on its state, use#getIconPath(T, int)
Icon size selection follows the same rule as its sister method.
- Parameters:
contentType
- the type of content to find an icon for as would be returned fromContentEntityObject.getType()
size
- the intended width/height at which the icon will be displayed in pixels- Returns:
- the path to the icon that best suits the requested size
-
getIconCssClass
String getIconCssClass(T content)
Get the CSS class that can be applied to add an icon to some inline element describing the given content.- Parameters:
content
- the content to find an icon for- Returns:
- the CSS class to add that icon to the element
-
getContentCssClass
String getContentCssClass(T content)
Get the CSS class that can be applied to some inline element describing the given content- Parameters:
content
- the content to find the css for- Returns:
- the CSS class for this content
-
getContentCssClass
String getContentCssClass(String contentType, String contentPluginKey)
Get the CSS class that can be applied to add an icon to some inline element describing the given content. The existence of both IconCssClass (used in the velocity macros) and ContentCssClass (used by the ContentTypesDisplayMapper) is redundant and confusing, and should be reconciled somehow.- Parameters:
contentType
- the content to find an icon forcontentPluginKey
- the plugin key for the content it it is a ContentType plugin- Returns:
- the CSS class to add that icon to the element
-
getIconCssClass
String getIconCssClass(SearchResult result)
Get the CSS class that can be applied to add an icon to some inline element describing the given result.- Parameters:
result
- the search result to find an icon for- Returns:
- the CSS class to add that icon to the element
-
getContentTypeI18NKey
String getContentTypeI18NKey(T content)
Get the I18N key for the name of the given content.- Parameters:
content
- the content to get the name of- Returns:
- the I18N key that can be used to name that content
-
getContentTypeI18NKey
String getContentTypeI18NKey(SearchResult result)
Get the I18N key for the content that is being referred to by this search result- Parameters:
result
- the search result being displayed- Returns:
- the I18N key that can be used to name that content
-
-