com.atlassian.confluence.util.actions
Class ContentTypesDisplayMapper

java.lang.Object
  extended by com.atlassian.confluence.util.actions.ContentTypesDisplayMapper

public class ContentTypesDisplayMapper
extends Object

Map Confluence content types to display information such as a CSS type or an Icon URL. When possible, use ContentUiSupport instead. This returns CSS classes of the form "content-type-page" etc. which are not sprite based, where ContentUiSupport would return icon-page, which are sprite based and are the preferred CSS styling of icons in Confluence.


Field Summary
static String CSS_CLASS_PREFIX
           
static String DEFAULT_ATTACHMENT_CLASS_NAME
           
static String DEFAULT_CLASS_NAME
           
 
Constructor Summary
ContentTypesDisplayMapper()
          Deprecated. since 4.2 - get the mapper from the spring context because it needs wiring
ContentTypesDisplayMapper(UserAccessor userAccessor, ContentUiSupport contentUiSupport)
           
 
Method Summary
 String getClassName(SearchResult result)
          Get the CSS class name for the supplied SearchResult.
 String getClassName(SearchResult result)
          Get the CSS class name for the supplied SearchResult.
static String getIconForAttachment(String contentType, String fileName)
          Decide the icon for an attachment based firstly on it's contentType.
 String getIconUrlForUsername(String username)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSS_CLASS_PREFIX

public static final String CSS_CLASS_PREFIX
See Also:
Constant Field Values

DEFAULT_CLASS_NAME

public static final String DEFAULT_CLASS_NAME
See Also:
Constant Field Values

DEFAULT_ATTACHMENT_CLASS_NAME

public static final String DEFAULT_ATTACHMENT_CLASS_NAME
See Also:
Constant Field Values
Constructor Detail

ContentTypesDisplayMapper

@Deprecated
public ContentTypesDisplayMapper()
Deprecated. since 4.2 - get the mapper from the spring context because it needs wiring


ContentTypesDisplayMapper

public ContentTypesDisplayMapper(UserAccessor userAccessor,
                                 ContentUiSupport contentUiSupport)
Method Detail

getClassName

public String getClassName(SearchResult result)
Get the CSS class name for the supplied SearchResult. If the class cannot be determined from the result then the default class will be returned.

Parameters:
result - the SearchResult that a CSS class is required for.
Returns:
the CSS class name for the given SearchResult.

getClassName

public String getClassName(SearchResult result)
Get the CSS class name for the supplied SearchResult. If the class cannot be determined from the result then the default class will be returned.

Parameters:
result - the SearchResult that a CSS class is required for.
Returns:
the CSS class name for the given SearchResult.

getIconForAttachment

public static String getIconForAttachment(String contentType,
                                          String fileName)
Decide the icon for an attachment based firstly on it's contentType. If it has no content type then the extension of it's filename will be used.

Parameters:
contentType -
fileName -
Returns:
the icon to be used for the attachment or the default icon if there is no specific one

getIconUrlForUsername

public String getIconUrlForUsername(String username)
Parameters:
username - the username to find an icon for.
Returns:
the URL for the icon for this username. If the user has no avatar then the URL of a default will be returned.


Copyright © 2003-2012 Atlassian. All Rights Reserved.