com.atlassian.confluence.util.actions
Class ContentTypesDisplayMapper

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

public class ContentTypesDisplayMapper
extends java.lang.Object

Map Confluence content types to display information such as a CSS type or an Icon URL.


Field Summary
static java.lang.String CSS_CLASS_PREFIX
           
static java.lang.String DEFAULT_ATTACHMENT_CLASS_NAME
           
static java.lang.String DEFAULT_CLASS_NAME
           
 
Constructor Summary
ContentTypesDisplayMapper()
           
 
Method Summary
 java.lang.String getClassName(SearchResult result)
          Get the CSS class name for the supplied SearchResult.
 java.lang.String getClassName(SearchResult result)
          Get the CSS class name for the supplied SearchResult.
static java.lang.String getIconForAttachment(java.lang.String contentType, java.lang.String fileName)
          Decide the icon for an attachment based firstly on it's contentType.
 java.lang.String getIconUrlForUsername(java.lang.String username)
           
 void setUserAccessor(UserAccessor userAccessor)
           
 
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 java.lang.String CSS_CLASS_PREFIX
See Also:
Constant Field Values

DEFAULT_CLASS_NAME

public static final java.lang.String DEFAULT_CLASS_NAME
See Also:
Constant Field Values

DEFAULT_ATTACHMENT_CLASS_NAME

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

ContentTypesDisplayMapper

public ContentTypesDisplayMapper()
Method Detail

getClassName

public java.lang.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 java.lang.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.

setUserAccessor

public void setUserAccessor(UserAccessor userAccessor)

getIconForAttachment

public static java.lang.String getIconForAttachment(java.lang.String contentType,
                                                    java.lang.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 java.lang.String getIconUrlForUsername(java.lang.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-2010 Atlassian. All Rights Reserved.