org.apache.tapestry.link
Class AbstractLinkComponent
java.lang.Object
|
+--org.apache.tapestry.spec.BaseLocatable
|
+--org.apache.tapestry.AbstractComponent
|
+--org.apache.tapestry.link.AbstractLinkComponent
- All Implemented Interfaces:
- IComponent, ILinkComponent, ILocatable, ILocationHolder, IRender
- Direct Known Subclasses:
- ActionLink, DirectLink, ExternalLink, GenericLink, PageLink, ServiceLink
- public abstract class AbstractLinkComponent
- extends AbstractComponent
- implements ILinkComponent
Base class for
implementations of ILinkComponent
. Includes a disabled attribute
(that should be bound to a disabled parameter),
an anchor attribute, and a
renderer attribute (that should be bound to a renderer parameter). A default,
shared instance of DefaultLinkRenderer
is
used when no specific renderer is provided.
- Version:
- $Id: AbstractLinkComponent.java,v 1.9 2003/08/06 14:28:49 hlship Exp $
- Author:
- Howard Lewis Ship
Method Summary |
void |
addEventHandler(LinkEventType eventType,
String functionName)
Adds an event handler (typically, from a wrapped component such
as a Rollover ). |
protected void |
cleanupAfterRender(IRequestCycle cycle)
Invoked by AbstractComponent.render(IMarkupWriter, IRequestCycle)
after the component renders, to clear any parameters back to
null (or 0, or false, or whatever the correct default is). |
protected void |
finishLoad()
Sets the renderer parameter property to its default value
DefaultLinkRenderer.SHARED_INSTANCE . |
abstract String |
getAnchor()
Returns the anchor defined for this link, or null for no anchor. |
ILink |
getLink(IRequestCycle cycle)
Invoked by the ILinkRenderer (if
the link is not disabled) to provide a
org.apache.tapestry.EngineServiceLink that the renderer can convert
into a URL. |
protected ILink |
getLink(IRequestCycle cycle,
String serviceName,
Object[] serviceParameters)
Utility method for subclasses; Gets the named service from the engine
and invokes org.apache.tapestry.IEngineService#buildGesture(IRequestCycle, IComponent, Object[])
on it. |
abstract ILinkRenderer |
getRenderer()
|
abstract boolean |
isDisabled()
Returns whether this service link component is enabled or disabled. |
void |
renderAdditionalAttributes(IMarkupWriter writer,
IRequestCycle cycle)
Invoked (by the ILinkRenderer )
to make the link render any additional attributes. |
protected void |
renderComponent(IMarkupWriter writer,
IRequestCycle cycle)
Renders the link by delegating to an instance
of ILinkRenderer . |
abstract void |
setRenderer(ILinkRenderer renderer)
|
protected String |
writeEventHandler(IMarkupWriter writer,
Body body,
String name,
String attributeName,
Object value)
|
protected void |
writeEventHandlers(IMarkupWriter writer,
IRequestCycle cycle)
|
Methods inherited from class org.apache.tapestry.AbstractComponent |
addAsset, addBody, addComponent, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, format, format, format, format, formatString, formatString, formatString, formatString, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification, toString |
Methods inherited from interface org.apache.tapestry.IComponent |
addAsset, addBody, addComponent, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, renderBody, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification |
Methods inherited from interface org.apache.tapestry.IRender |
render |
AbstractLinkComponent
public AbstractLinkComponent()
isDisabled
public abstract boolean isDisabled()
- Description copied from interface:
ILinkComponent
- Returns whether this service link component is enabled or disabled.
- Specified by:
isDisabled
in interface ILinkComponent
addEventHandler
public void addEventHandler(LinkEventType eventType,
String functionName)
- Adds an event handler (typically, from a wrapped component such
as a
Rollover
).
- Specified by:
addEventHandler
in interface ILinkComponent
renderComponent
protected void renderComponent(IMarkupWriter writer,
IRequestCycle cycle)
- Renders the link by delegating to an instance
of
ILinkRenderer
.
- Overrides:
renderComponent
in class AbstractComponent
cleanupAfterRender
protected void cleanupAfterRender(IRequestCycle cycle)
- Description copied from class:
AbstractComponent
- Invoked by
AbstractComponent.render(IMarkupWriter, IRequestCycle)
after the component renders, to clear any parameters back to
null (or 0, or false, or whatever the correct default is).
Primarily, this is used to ensure
that the component doesn't hold onto any objects that could
otherwise be garbage collected.
Subclasses may override this implementation, but must
also invoke it.
- Overrides:
cleanupAfterRender
in class AbstractComponent
writeEventHandlers
protected void writeEventHandlers(IMarkupWriter writer,
IRequestCycle cycle)
writeEventHandler
protected String writeEventHandler(IMarkupWriter writer,
Body body,
String name,
String attributeName,
Object value)
getRenderer
public abstract ILinkRenderer getRenderer()
- Since:
- 3.0
setRenderer
public abstract void setRenderer(ILinkRenderer renderer)
renderAdditionalAttributes
public void renderAdditionalAttributes(IMarkupWriter writer,
IRequestCycle cycle)
- Description copied from interface:
ILinkComponent
- Invoked (by the
ILinkRenderer
)
to make the link render any additional attributes. These
are informal parameters, plus any attributes related to events.
This is only invoked for non-disabled links.
- Specified by:
renderAdditionalAttributes
in interface ILinkComponent
getLink
protected ILink getLink(IRequestCycle cycle,
String serviceName,
Object[] serviceParameters)
- Utility method for subclasses; Gets the named service from the engine
and invokes
org.apache.tapestry.IEngineService#buildGesture(IRequestCycle, IComponent, Object[])
on it.
- Since:
- 3.0
getAnchor
public abstract String getAnchor()
- Description copied from interface:
ILinkComponent
- Returns the anchor defined for this link, or null for no anchor.
- Specified by:
getAnchor
in interface ILinkComponent
getLink
public ILink getLink(IRequestCycle cycle)
- Description copied from interface:
ILinkComponent
- Invoked by the
ILinkRenderer
(if
the link is not disabled) to provide a
org.apache.tapestry.EngineServiceLink
that the renderer can convert
into a URL.
- Specified by:
getLink
in interface ILinkComponent
finishLoad
protected void finishLoad()
- Sets the renderer parameter property to its default value
DefaultLinkRenderer.SHARED_INSTANCE
.
- Overrides:
finishLoad
in class AbstractComponent
- Since:
- 3.0