public abstract class

AbstractPageLink

extends AbstractContentEntityLink
java.lang.Object
   ↳ com.atlassian.renderer.links.Link
     ↳ com.atlassian.renderer.links.BaseLink
       ↳ com.atlassian.confluence.links.linktypes.AbstractContentEntityLink
         ↳ com.atlassian.confluence.links.linktypes.AbstractPageLink
Known Direct Subclasses

Summary

Fields
protected String anchor
protected AbstractPage destinationPage
protected String spaceKey
[Expand]
Inherited Fields
From class com.atlassian.confluence.links.linktypes.AbstractContentEntityLink
From class com.atlassian.renderer.links.Link
Public Constructors
AbstractPageLink(GenericLinkParser parser, PageContext context)
Public Methods
static String generateAnchor(PageContext context, String anchor)
Used predominantly to generate an anchor in the format: #<title>-<anchor>

For ease of documentation, I will use "page" to refer to content that can contain an anchor or anchor link.

String getAnchor(PageContext pageContext)
ContentEntityObject getDestinationContent()
String getLinkBody()
String getPageTitle()
String getSpaceKey()
OutgoingLink toOutgoingLink(ContentEntityObject sourceContent)
Protected Methods
abstract boolean isOnSamePage(PageContext pageContext)
void setUrlAndTitle(PageContext pageContext)
[Expand]
Inherited Methods
From class com.atlassian.confluence.links.linktypes.AbstractContentEntityLink
From class com.atlassian.renderer.links.BaseLink
From class com.atlassian.renderer.links.Link
From class java.lang.Object

Fields

protected String anchor

protected AbstractPage destinationPage

protected String spaceKey

Public Constructors

public AbstractPageLink (GenericLinkParser parser, PageContext context)

Public Methods

public static String generateAnchor (PageContext context, String anchor)

Used predominantly to generate an anchor in the format: #<title>-<anchor>

For ease of documentation, I will use "page" to refer to content that can contain an anchor or anchor link.

The title component of the anchor is normally the title of the page.

However, when we render an anchor or an anchor link for a page that is included by another (via the include page macro) the title component is the title of the including page. This allows anchors links that have been declared on the including page to point to anchors declared on the included page.

For example, say page "A" contains an include page macro that includes page "B". And say if the body of page B has an anchor declared on it <a name="foo">. Page A can link to this anchor using [#foo].

If we are rendering an anchor that is several levels deep (that is, on a page, that is being included by page, that is being included by a page), the title component is assigned the title of the outer-most content's title. This is largely because getOriginalContext() returns a reference to the top most context (PageContext does not maintain a stack of contexts).

Parameters
context the context
anchor the anchor name
Returns
  • the anchor (does not include the leading '#' symbol)

public String getAnchor (PageContext pageContext)

public ContentEntityObject getDestinationContent ()

public String getLinkBody ()

public String getPageTitle ()

public String getSpaceKey ()

public OutgoingLink toOutgoingLink (ContentEntityObject sourceContent)

Protected Methods

protected abstract boolean isOnSamePage (PageContext pageContext)

protected void setUrlAndTitle (PageContext pageContext)