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 java.lang.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  java.lang.String iconName
           
protected  java.lang.String linkBody
          The contents that are being marked up by the link.
protected  boolean relativeUrl
           
protected  java.lang.String title
           
protected  java.util.List titleArgs
           
protected  java.lang.String titleKey
           
protected  java.lang.String url
           
protected  java.lang.String wikiDestination
          The destination portion of the originalLinkText.
protected  java.lang.String wikiTitle
          The optional title portion of the originalLinkText.
 
Constructor Summary
Link(java.lang.String originalLinkText)
          Construct a link from some text (as passed into LinkResolver#createLink)
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getIconName()
          A name that the renderer can use to look up an appropriate icon.
 java.lang.String getLinkAttributes()
          This is a method that will allow a link to set any additional attributes that are related to the specific link type.
 java.lang.String getLinkBody()
          Get the contents that are being marked up by the link
 java.lang.String getOriginalLinkText()
          Get the original text used to build this link
 java.lang.String getTitle()
          Get the link title text
 java.util.List getTitleArgs()
          Retrieves the arguments to use in the internationalised message identified by getTitleKey()
 java.lang.String getTitleKey()
          Retrieve the i18n key for the title if defined.
 java.lang.String getUnpermittedLinkBody()
          Get the link body as it would be displayed if the link wasn't permitted to be viewed
 java.lang.String getUrl()
          Get the destination URL for this link.
 java.lang.String getWikiDestination()
          Gets the destination portion of the originalLinkText.
 java.lang.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 java.lang.String url

title

protected java.lang.String title

linkBody

protected java.lang.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 java.lang.String iconName

titleKey

protected java.lang.String titleKey

titleArgs

protected java.util.List titleArgs

wikiDestination

protected java.lang.String wikiDestination
The destination portion of the originalLinkText.


wikiTitle

protected java.lang.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(java.lang.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 java.lang.String getOriginalLinkText()
Get the original text used to build this link


getUrl

public java.lang.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 java.lang.String getTitle()
Get the link title text


getLinkBody

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


getUnpermittedLinkBody

public java.lang.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 java.lang.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 java.lang.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(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getTitleKey

public java.lang.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 java.util.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 java.lang.String getWikiDestination()
Gets the destination portion of the originalLinkText.


getWikiTitle

public java.lang.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 © 2008 Atlassian Pty Ltd. All Rights Reserved.