com.atlassian.renderer.links
Class Link

java.lang.Object
  extended by com.atlassian.renderer.links.Link
Direct Known Subclasses:
BaseLink, UnpermittedLink, UnresolvedLink

public abstract class Link
extends Object

A link that can be rendered in a page. Ideally, links should be immutable.


Field Summary
protected  boolean aliasSpecified
          Whether an alias is included in the originalLinkText.
protected  String iconName
           
protected  String linkBody
          The contents that are being marked up by the link.
protected  boolean relativeUrl
           
protected  String title
           
protected  List titleArgs
           
protected  String titleKey
           
protected  String url
           
protected  String wikiDestination
          The destination portion of the originalLinkText.
protected  String wikiTitle
          The optional title portion of the originalLinkText.
 
Constructor Summary
Link(String originalLinkText)
          Construct a link from some text (as passed into LinkResolver#createLink)
 
Method Summary
 boolean equals(Object o)
           
 String getIconName()
          A name that the renderer can use to look up an appropriate icon.
 String getLinkAttributes()
          This is a method that will allow a link to set any additional attributes that are related to the specific link type.
 String getLinkBody()
          Get the contents that are being marked up by the link
 String getOriginalLinkText()
          Get the original text used to build this link
 String getTitle()
          Get the link title text
 List getTitleArgs()
          Retrieves the arguments to use in the internationalised message identified by getTitleKey()
 String getTitleKey()
          Retrieve the i18n key for the title if defined.
 String getUnpermittedLinkBody()
          Get the link body as it would be displayed if the link wasn't permitted to be viewed
 String getUrl()
          Get the destination URL for this link.
 String getWikiDestination()
          Gets the destination portion of the originalLinkText.
 String getWikiTitle()
          Gets the optional title portion of the originalLinkText.
 int hashCode()
           
 boolean isAliasSpecified()
          Returns true if the link markup specifies an alias.
 boolean isRelativeUrl()
          Is the URL relativeUrl to the application's context path?
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

url

protected String url

title

protected String title

linkBody

protected String linkBody
The contents that are being marked up by the link. ie. the text between the opening and closing "a" tags.


relativeUrl

protected boolean relativeUrl

iconName

protected String iconName

titleKey

protected String titleKey

titleArgs

protected List titleArgs

wikiDestination

protected String wikiDestination
The destination portion of the originalLinkText.


wikiTitle

protected String wikiTitle
The optional title portion of the originalLinkText.


aliasSpecified

protected boolean aliasSpecified
Whether an alias is included in the originalLinkText.

Constructor Detail

Link

public Link(String originalLinkText)
Construct a link from some text (as passed into LinkResolver#createLink)

Parameters:
originalLinkText - the original text of the link
Method Detail

getOriginalLinkText

public String getOriginalLinkText()
Get the original text used to build this link


getUrl

public String getUrl()
Get the destination URL for this link. It should be html escaped so it can be embedded directly into html without any XSS attacks.


getTitle

public String getTitle()
Get the link title text


getLinkBody

public String getLinkBody()
Get the contents that are being marked up by the link


getUnpermittedLinkBody

public String getUnpermittedLinkBody()
Get the link body as it would be displayed if the link wasn't permitted to be viewed


isRelativeUrl

public boolean isRelativeUrl()
Is the URL relativeUrl to the application's context path?

Returns:
true if the URL is relativeUrl to the context path.

getLinkAttributes

public String getLinkAttributes()
This is a method that will allow a link to set any additional attributes that are related to the specific link type. i.e. - if a link wants to set a css style, then this would be the place.

Returns:
a string containing the param that will be included within the anchor tag.

getIconName

public String getIconName()
A name that the renderer can use to look up an appropriate icon.

Returns:
the name of an icon to look up for this link, null if there is no possibility of an appropriate icon

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getTitleKey

public String getTitleKey()
Retrieve the i18n key for the title if defined.

Returns:
a key or null if undefined, in which case check "getTitle"

getTitleArgs

public List getTitleArgs()
Retrieves the arguments to use in the internationalised message identified by getTitleKey()

Returns:
a list of arguments; null or an empty list if there are none.

getWikiDestination

public String getWikiDestination()
Gets the destination portion of the originalLinkText.


getWikiTitle

public String getWikiTitle()
Gets the optional title portion of the originalLinkText. Returns null if no title was present in the original link text.


isAliasSpecified

public boolean isAliasSpecified()
Returns true if the link markup specifies an alias.



Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.