Class AbstractLink
-
- org.apache.tapestry5.corelib.base.AbstractLink
-
- All Implemented Interfaces:
ClientElement
- Direct Known Subclasses:
AbstractComponentEventLink
,PageLink
@SupportsInformalParameters public abstract class AbstractLink extends implements ClientElement
Provides base utilities for classes that generate clickable links.
-
-
Field Summary
Fields Modifier and Type Field Description protected ComponentResources
resources
-
Constructor Summary
Constructors Constructor Description AbstractLink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addParameters(Link link)
Adds any user-defined parameters as query parameters.getClientId()
Returns the unique client id for this element.Link
getLink()
Returns the most recently renderedLink
for this component.boolean
isDisabled()
Returns true if the component is disabled (as per its disabled parameter).protected void
writeLink(MarkupWriter writer, Link link, ... namesAndValues)
Writes an <a> element with the provided link as the href attribute.
-
-
-
Field Detail
-
resources
@Inject protected ComponentResources resources
-
-
Constructor Detail
-
AbstractLink
public AbstractLink()
-
-
Method Detail
-
writeLink
protected final void writeLink(MarkupWriter writer, Link link, ... namesAndValues)
Writes an <a> element with the provided link as the href attribute. A call toMarkupWriter.end()
is not provided. Automatically appends an anchor if the component's anchor parameter is non-null. Informal parameters are rendered as well.- Parameters:
writer
- to write markup tolink
- the link that will form the hrefnamesAndValues
- additional attributes to write
-
addParameters
protected final void addParameters(Link link)
Adds any user-defined parameters as query parameters.- Parameters:
link
- aLink
.
-
getLink
public Link getLink()
Returns the most recently renderedLink
for this component. Subclasses calculate their link value as they render, and the value is valid until the end of the request, or the next time the same component renders itself (if inside a loop).- Returns:
- the most recent link, or null
-
getClientId
public final getClientId()
Returns the unique client id for this element. This is valid only after the component has rendered (its start tag). A client id is generated the first time this method is invoked, after the link renders its start tag.- Specified by:
getClientId
in interfaceClientElement
- Returns:
- a unique id for the element. This value will be unique for any given rendering of a page. This value is intended for use as the id attribute of the client-side element, and will be used with any DHTML/Ajax related JavaScript.
-
isDisabled
public boolean isDisabled()
Returns true if the component is disabled (as per its disabled parameter). Disabled link components should not render a tag, but should still render their body.- Returns:
true
orfalse
.
-
-