com.atlassian.renderer
Class Icon

java.lang.Object
  extended by com.atlassian.renderer.Icon

public class Icon
extends Object

Encapsulates an icon the renderer has to draw, for example a link decoration or emoticon.


Field Summary
 String cssClass
           
 int height
           
static int ICON_LEFT
          The icon is drawn to the left of the content it is decorating (i.e.
static int ICON_RIGHT
          The icon is drawn to the right of the content it is decorating (i.e.
static String IMAGE_TEMPLATE
          Template for converting an image to an HTML img tag
static Icon NULL_ICON
          The NULL_ICON is a convenient icon that has no size and draws nothing.
 String path
           
 int position
           
 int width
           
 
Method Summary
 String getPath()
           
static Icon makeEmoticon(String path, int height, int width)
          Factory method for a new emoticon
static Icon makeRenderIcon(String path, int position, int width, int height)
          Factory method for a new rendericon
 String toHtml(String imageRoot)
          Return the icon as HTML, relative to the given image root.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IMAGE_TEMPLATE

public static final String IMAGE_TEMPLATE
Template for converting an image to an HTML img tag

See Also:
Constant Field Values

ICON_LEFT

public static final int ICON_LEFT
The icon is drawn to the left of the content it is decorating (i.e. [icon]link)

See Also:
Constant Field Values

ICON_RIGHT

public static final int ICON_RIGHT
The icon is drawn to the right of the content it is decorating (i.e. link[icon])

See Also:
Constant Field Values

NULL_ICON

public static final Icon NULL_ICON
The NULL_ICON is a convenient icon that has no size and draws nothing. Useful at any family function.


path

public final String path

position

public final int position

width

public final int width

height

public final int height

cssClass

public final String cssClass
Method Detail

makeRenderIcon

public static Icon makeRenderIcon(String path,
                                  int position,
                                  int width,
                                  int height)
Factory method for a new rendericon

Parameters:
path - the path (relative to the renderer's image root) to the icon's image file
position - one of ICON_LEFT or ICON_RIGHT
width - the width of the image in pixels
height - the height of the image in pixels
Returns:
the appropriate Icon object

makeEmoticon

public static Icon makeEmoticon(String path,
                                int height,
                                int width)
Factory method for a new emoticon

Parameters:
path - the path (relative to the renderer's image root) to the icon's image file
height - the height of the image in pixels
width - the width of the image in pixels
Returns:
the appropriate Icon object

toHtml

public String toHtml(String imageRoot)
Return the icon as HTML, relative to the given image root. Some icons may be more than just a image tag - for example, rendericons are rendered as superscript.

Parameters:
imageRoot - the URL path to the root of the image directory
Returns:
the HTML markup for displaying this icon as an image

getPath

public String getPath()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.