com.ibm.workplace.wcm.api
Interface LinkComponent

All Superinterfaces:
ContentComponent, TargetableContentComponent, WCMApiObject

public interface LinkComponent
extends TargetableContentComponent

Represents a Link component.

A LinkComponent is a ContentComponent and cannot be stored as a separate entity in the repository.

A LinkComponent represents a HTML anchor tag. It can contain a reference to a Site, SiteArea, Content,Image, File resources, or another LinkComponent, it can also refer to an external URL. This class provides methods to retrieve the URL that the reference represents and defines the properties of the HTML anchor tag generated by this component.

note: since v6.0.0, a LinkComponent is referred to as an "Link Element" in the Authoring UI..

See Also:
LibraryComponent

Field Summary
static int TEXT_LIBRARYIMAGE
          The hyperlink displays text as the defined library image.
static int TEXT_PLAINTEXT
          The hyperlink displays text as plain text.
static int TYPE_DOCUMENTMANAGER
          Deprecated. Document Manager is deprecated since 7.0
static int TYPE_EXISTINGLINK
          TYPE_EXISTINGLINK references an existing link component.
static int TYPE_EXTERNALURL
          TYPE_EXTERNALURL references an external URL.
static int TYPE_MANAGEDCONTENT
          TYPE_MANAGEDCONTENT references content, file or image resources.
 
Method Summary
 java.lang.String getAdditionalAttribute()
          Gets the additional attribute for the HTML anchor tag.
 DocumentId getDocumentReference()
          Retrieves the Document Reference of this Component.
 DocumentType<? extends LinkComponent> getDocumentType()
          Returns the DocumentType of the ContentComponent.
 java.lang.String getLinkDescription()
          Retrieves the description attribute of the anchor tag.
 DocumentId getLinkImage()
          Retrieves the link image DocumentId.
 java.lang.String getLinkTarget()
          Retrieves the target window name.
 java.lang.String getLinkText()
          Gets the hyperlink display text
 int getLinkTextType()
          Retrieves the link text type.
 int getLinkType()
          Retrieves the link type.
 java.lang.String getQueryString()
          Returns the QueryString.
 java.lang.String getReferenceDisplayName()
          Retrives the reference display name as shown in the Authoring UI.
 java.lang.String getURL()
          Retrieves the URL of the link that this component references.
 boolean isClearable()
          Checks if the link can be cleared.
 boolean isUseReferenceDescription()
          Checks if we use the referenced Document Description as the anchor tag title attribute.
 boolean isUseReferenceLinkTextEnabled()
          Checks if we use the referenced document title as the default hyperlink display text.
 void setAdditionalAttribute(java.lang.String attribute)
          Sets an additional attribute for the HTML anchor tag.
 void setAllowClear(boolean isAllowed)
          Enables/Disables whether link may be cleared.
 void setDocumentManagerReference(java.lang.String library, java.lang.String documentPath)
          Deprecated. Document Manager is deprecated since 7.0
 void setDocumentReference(DocumentId id)
          Sets the Document Reference of this Component to the document provided.
 void setExternalReference(java.lang.String url)
          Sets the External URL Reference of this Component to the URL provided.
 void setLinkDescription(java.lang.String description)
          Sets the description attribute of the anchor tag.
 void setLinkImage(DocumentId id)
          Sets the image of the DocumentId as the link image.
 void setLinkTarget(java.lang.String targetName)
          Sets the target window name.
 void setLinkText(java.lang.String linkText)
          Sets the hyperlink display text.
 void setQueryString(java.lang.String queryString)
          Sets the query string append to a URL.
 void setUseReferenceDescription(boolean isDefault)
          Enables/Disables the usage of the referenced document description as the anchor tag title attribute.
 void setUseReferenceLinkText(boolean isDefault)
          Enables/Disables the usage of the referenced document title as the hyperlink display text.
 
Methods inherited from interface com.ibm.workplace.wcm.api.ContentComponent
getContainer, getName, getTitleTextProviderKey, getTitleTextProviderName, setTitleTextProviderKey, setTitleTextProviderName
 

Field Detail

TYPE_MANAGEDCONTENT

static final int TYPE_MANAGEDCONTENT
TYPE_MANAGEDCONTENT references content, file or image resources.

See Also:
Constant Field Values

TYPE_EXTERNALURL

static final int TYPE_EXTERNALURL
TYPE_EXTERNALURL references an external URL.

See Also:
Constant Field Values

TYPE_EXISTINGLINK

static final int TYPE_EXISTINGLINK
TYPE_EXISTINGLINK references an existing link component.

See Also:
Constant Field Values

TYPE_DOCUMENTMANAGER

static final int TYPE_DOCUMENTMANAGER
Deprecated. Document Manager is deprecated since 7.0
TYPE_DOCUMENTMANAGER references a document in the Document Manager.

See Also:
Constant Field Values

TEXT_PLAINTEXT

static final int TEXT_PLAINTEXT
The hyperlink displays text as plain text. This can also be HTML.

See Also:
Constant Field Values

TEXT_LIBRARYIMAGE

static final int TEXT_LIBRARYIMAGE
The hyperlink displays text as the defined library image.

See Also:
Constant Field Values
Method Detail

getDocumentType

DocumentType<? extends LinkComponent> getDocumentType()
Description copied from interface: ContentComponent
Returns the DocumentType of the ContentComponent.

Specified by:
getDocumentType in interface ContentComponent
Specified by:
getDocumentType in interface TargetableContentComponent
Returns:
the type
See Also:
ContentComponent.getDocumentType()

getDocumentReference

DocumentId getDocumentReference()
Retrieves the Document Reference of this Component.

This Document can be any of the following WCM managed items:
Site, SiteArea, Content, Image, Resource or another LinkComponent.

Returns:
the DocumentId of the Reference

setDocumentReference

void setDocumentReference(DocumentId id)
                          throws java.lang.IllegalArgumentException
Sets the Document Reference of this Component to the document provided.

This document can be any of the following WCM managed items:
Site, SiteArea, Content, Image, Resource or another LinkCmpnt.

When this method gets called, it sets the LinkType to its corresponding type, if id is a DocumentId of Site, SiteArea and Content, it sets LinkType to LinkComponent.TYPE_MANAGEDCONTENT, if id is a DocumentId of LinkComponent, it sets the link type to LinkComponent.TYPE_EXISTINGLINK.

Subsequent calls overwrite the changes made by previous calls.

Parameters:
id - the DocumentId of the Reference
Throws:
java.lang.IllegalArgumentException - if the DocumentId is not an acceptable type
See Also:
getLinkType()

setExternalReference

void setExternalReference(java.lang.String url)
Sets the External URL Reference of this Component to the URL provided.

When this method gets called, the LinkType is set to LinkComponent.TYPE_EXTERNALURL.

Parameters:
url - the external URL as a String
See Also:
getLinkType()

setDocumentManagerReference

void setDocumentManagerReference(java.lang.String library,
                                 java.lang.String documentPath)
                                 throws java.lang.IllegalArgumentException
Deprecated. Document Manager is deprecated since 7.0

Sets the Document Reference of this Component to a document within the DocumentManager.

When this method gets called, it sets the LinkType to LinkComponent.TYPE_DOCUMENTMANAGER

Parameters:
library - The JCR path of the library that the document is contained in, /contentRoot/icm:libraries[x] where x is a number
documentPath - the path to the document within the library, e.g. /Example folder/example.doc
Throws:
java.lang.IllegalArgumentException - if the document manager reference could not be set, for examples because the document was not found
See Also:
getLinkType()

setUseReferenceLinkText

void setUseReferenceLinkText(boolean isDefault)
Enables/Disables the usage of the referenced document title as the hyperlink display text.

Parameters:
isDefault - boolean if true, the reference title is used as the default hyperlink display text.

isUseReferenceLinkTextEnabled

boolean isUseReferenceLinkTextEnabled()
Checks if we use the referenced document title as the default hyperlink display text.

Returns:
boolean if true, the reference title is used as default hyperlink display text.

setUseReferenceDescription

void setUseReferenceDescription(boolean isDefault)
Enables/Disables the usage of the referenced document description as the anchor tag title attribute.

Parameters:
isDefault - specifies whether to use the reference description as default description.

isUseReferenceDescription

boolean isUseReferenceDescription()
Checks if we use the referenced Document Description as the anchor tag title attribute.

Returns:
boolean if true, use Reference Title as default description.

setAdditionalAttribute

void setAdditionalAttribute(java.lang.String attribute)
Sets an additional attribute for the HTML anchor tag. Additional attributes are attributes other than "title", "target" and "href".

Parameters:
attribute - the additional attribute as String

getAdditionalAttribute

java.lang.String getAdditionalAttribute()
Gets the additional attribute for the HTML anchor tag. Additional attributes are attributes other than "title", "target" and "href".

Returns:
attribute the additional attribute as String

setLinkDescription

void setLinkDescription(java.lang.String description)
Sets the description attribute of the anchor tag.

Note that this setting will be overwritten if you have called setUseDefaultDescription(true)

Parameters:
description - as String

getLinkDescription

java.lang.String getLinkDescription()
Retrieves the description attribute of the anchor tag.

Returns:
the Link Description as a String.

setLinkText

void setLinkText(java.lang.String linkText)
Sets the hyperlink display text.

The plain text will only be rendered if the Link text type is LinkComponent.TEXT_PLAINTEXT. When calling LibrarayLinkComponent.setLinkText(), the Link Component text type will be set to LinkComponent.TEXT_PLAINTEXT.

Parameters:
linkText - hyperlink display text to set

getLinkText

java.lang.String getLinkText()
Gets the hyperlink display text

Returns:
the hyperlink display kext as String

getLinkTextType

int getLinkTextType()
Retrieves the link text type.

Returns:
the type of the link text as an int.

Possible values are: LinkComponent.TEXT_PLAINTEXT LinkComponent.TEXT_LIBRARYIMAGE


getLinkType

int getLinkType()
Retrieves the link type.

Returns:
the type of the link as a int

Possible link type values are: LinkComponent.TYPE_MANAGEDCONTENT LinkComponent.TYPE_EXTERNALURL LinkComponent.TYPE_EXISTINGLINK


getURL

java.lang.String getURL()
Retrieves the URL of the link that this component references.

Returns:
url as a String

setLinkTarget

void setLinkTarget(java.lang.String targetName)
Sets the target window name. Used for anchor tag target attribute.

Parameters:
targetName - the Name of the target window

getLinkTarget

java.lang.String getLinkTarget()
Retrieves the target window name. Used for anchor tag target attribute.

Returns:
the name of the target window in String

setAllowClear

void setAllowClear(boolean isAllowed)
Enables/Disables whether link may be cleared. Applies only to TYPE_MANAGEDCONTENT when the referenced item is deleted. States whether this link can be cleared (true) or just replaced (false).

Parameters:
isAllowed - true: allow link to be cleared otherwise do not allow link to be cleared.

setLinkImage

void setLinkImage(DocumentId id)
Sets the image of the DocumentId as the link image.

The plain text will only be rendered if the link text type is LinkComponent.TEXT_LIBRARYIMAGE. When calling LibrarayLinkComponent.setLinkTextImage(), the Link Component text type will be set to LinkComponent.TEXT_LIBRARYIMAGE.

Parameters:
id - the DocumentId of the image

getLinkImage

DocumentId getLinkImage()
Retrieves the link image DocumentId.

Use LinkComponent.getLinkText() to get the hyperlink text when LinkComponent.getLinkTextType() returns LinkComponent.TEXT_PLAINTEXT

Returns:
DocumentId of the image, return null if there is no image set.

getReferenceDisplayName

java.lang.String getReferenceDisplayName()
Retrives the reference display name as shown in the Authoring UI.

Can be content title, resource file name or the link component name, if it is an external URL, it returns "--".

Returns:
the display name as String

isClearable

boolean isClearable()
Checks if the link can be cleared. Default is false. Applies only to TYPE_MANAGEDCONTENT when the referenced item is deleted. States whether this link can be cleared (true) or just replaced(false).

Returns:
true: link can be cleared otherwise link cannot be cleared.

setQueryString

void setQueryString(java.lang.String queryString)
Sets the query string append to a URL.

Parameters:
queryString - as String

getQueryString

java.lang.String getQueryString()
Returns the QueryString.

Returns:
QueryString as String