com.primix.tapestry.link
Class AbstractServiceLink

java.lang.Object
  |
  +--com.primix.tapestry.AbstractComponent
        |
        +--com.primix.tapestry.link.AbstractServiceLink
All Implemented Interfaces:
IComponent, IRender, IServiceLink
Direct Known Subclasses:
Action, Direct, Page, Service

public abstract class AbstractServiceLink
extends AbstractComponent
implements IServiceLink

Abstract super-class for components that generate some form of <a> hyperlink using an IEngineService. Supplies support for the following parameters:

Subclasses usually need only implement getServiceName(IRequestCycle) and getContext(IRequestCycle).

Version:
$Id: AbstractServiceLink.java,v 1.11 2001/08/24 21:38:48 hship Exp $
Author:
Howard Ship

Fields inherited from class com.primix.tapestry.AbstractComponent
id, page, specification, wrapped, wrappedCount
 
Fields inherited from interface com.primix.tapestry.components.IServiceLink
ATTRIBUTE_NAME
 
Constructor Summary
AbstractServiceLink()
           
 
Method Summary
 void addEventHandler(ServiceLinkEventType eventType, java.lang.String functionName)
          Adds an event handler (typically, from a wrapped component such as a Rollover).
protected  java.lang.String buildURL(IRequestCycle cycle, java.lang.String[] context)
           
 IBinding getAnchorBinding()
           
protected  java.lang.String[] getContext(IRequestCycle cycle)
          Invoked by render(IResponseWriter, IRequestCycle) if the component is enabled.
 IBinding getDisabledBinding()
           
 IBinding getPortBinding()
           
 IBinding getSchemeBinding()
           
protected abstract  java.lang.String getServiceName(IRequestCycle cycle)
          Returns the service used to build URLs.
 boolean isDisabled()
          Returns true if the link is disabled, false otherwise.
 void render(IResponseWriter writer, IRequestCycle cycle)
          Renders the link.
 void setAnchorBinding(IBinding value)
           
 void setDisabledBinding(IBinding value)
           
 void setPortBinding(IBinding value)
           
 void setSchemeBinding(IBinding value)
           
protected  void setup(IRequestCycle cycle)
          Invoked from render(IResponseWriter, IRequestCycle), this is responsible for setting the enabled property.
 
Methods inherited from class com.primix.tapestry.AbstractComponent
addAsset, addComponent, addWrapped, cleanupAfterRender, cleanupComponent, finishLoad, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getPage, getSpecification, prepareForRender, renderWrapped, reset, setBinding, setContainer, setId, setPage, setSpecification, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.primix.tapestry.IComponent
addAsset, addComponent, addWrapped, finishLoad, getAsset, getAssets, getBinding, getBindingNames, getBindings, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getPage, getSpecification, renderWrapped, setBinding, setContainer, setId, setPage, setSpecification
 

Constructor Detail

AbstractServiceLink

public AbstractServiceLink()
Method Detail

getContext

protected java.lang.String[] getContext(IRequestCycle cycle)
                                 throws RequestCycleException
Invoked by render(IResponseWriter, IRequestCycle) if the component is enabled. The default implementation returns null; other implementations can provide appropriate parameters as needed.

buildURL

protected java.lang.String buildURL(IRequestCycle cycle,
                                    java.lang.String[] context)
                             throws RequestCycleException

getAnchorBinding

public IBinding getAnchorBinding()

getDisabledBinding

public IBinding getDisabledBinding()

getSchemeBinding

public IBinding getSchemeBinding()

setSchemeBinding

public void setSchemeBinding(IBinding value)

getPortBinding

public IBinding getPortBinding()

setPortBinding

public void setPortBinding(IBinding value)

getServiceName

protected abstract java.lang.String getServiceName(IRequestCycle cycle)
Returns the service used to build URLs.
See Also:
buildURL(IRequestCycle, String[])

isDisabled

public boolean isDisabled()
Returns true if the link is disabled, false otherwise. If not otherwise specified, the link will be enabled (and this method will return false).
Specified by:
isDisabled in interface IServiceLink
Throws:
RenderOnlyPropertyException - if the component is not currently rendering.

setAnchorBinding

public void setAnchorBinding(IBinding value)

setDisabledBinding

public void setDisabledBinding(IBinding value)

setup

protected void setup(IRequestCycle cycle)
Invoked from render(IResponseWriter, IRequestCycle), this is responsible for setting the enabled property.

addEventHandler

public void addEventHandler(ServiceLinkEventType eventType,
                            java.lang.String functionName)
Adds an event handler (typically, from a wrapped component such as a Rollover).
Specified by:
addEventHandler in interface IServiceLink

render

public void render(IResponseWriter writer,
                   IRequestCycle cycle)
            throws RequestCycleException
Renders the link. This is somewhat complicated, because a nested response writer is used to render the contents of the link, before the link itself actually renders.

This is to support components such as Rollover, which must specify some attributes of the service link as they render in order to create some client-side JavaScript that works. Thus the service link renders its wrapped components into a temporary buffer, then renders its own HTML.

Specified by:
render in interface IRender