com.ibm.workplace.wcm.api
Interface LinkComponent

All Superinterfaces:
ContentComponent

public interface LinkComponent
extends ContentComponent

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 ContentComponent is referred to as an "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_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.
 com.ibm.workplace.wcm.api.DocumentId getDocumentReference()
          Retrieves the Document Reference of this Component.
 java.lang.String getLinkDescription()
          Retrieves the description attribute of the anchor tag.
 com.ibm.workplace.wcm.api.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 setDocumentReference(com.ibm.workplace.wcm.api.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(com.ibm.workplace.wcm.api.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
 

Field Detail

TYPE_MANAGEDCONTENT

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

See Also:
Constant Field Values

TYPE_EXTERNALURL

public static final int TYPE_EXTERNALURL
TYPE_EXTERNALURL references an external URL.

See Also:
Constant Field Values

TYPE_EXISTINGLINK

public static final int TYPE_EXISTINGLINK
TYPE_EXISTINGLINK references an existing link component.

See Also:
Constant Field Values

TEXT_PLAINTEXT

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

See Also:
Constant Field Values

TEXT_LIBRARYIMAGE

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

See Also:
Constant Field Values
Method Detail

getDocumentReference

public com.ibm.workplace.wcm.api.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

public void setDocumentReference(com.ibm.workplace.wcm.api.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:
LinkComponent.getLinkType()

setExternalReference

public 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:
LinkComponent.getLinkType()

setUseReferenceLinkText

public 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

public 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

public 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

public 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

public 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

public 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

public 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

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

Returns:
the Link Description as a String.

setLinkText

public 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

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

Returns:
the hyperlink display kext as String

getLinkTextType

public 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

public 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

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

Returns:
url as a String

setLinkTarget

public 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

public 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

public 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

public void setLinkImage(com.ibm.workplace.wcm.api.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

public com.ibm.workplace.wcm.api.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

public 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

public 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

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

Parameters:
queryString - as String

getQueryString

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

Returns:
QueryString as String