org.apache.tapestry5.internal.structure
Interface ComponentPageElement

All Superinterfaces:
BodyPageElement, ComponentResourcesCommon, InternalComponentResourcesCommon, Locatable, RenderCommand
All Known Implementing Classes:
ComponentPageElementImpl

public interface ComponentPageElement
extends ComponentResourcesCommon, InternalComponentResourcesCommon, RenderCommand, BodyPageElement

Defines an element of a page that is a component elements that are, in fact, components (rather than just static markup).


Method Summary
 void addBlock(String blockId, Block block)
          Used during the contruction of a page to add a non-anonymous Block to the component.
 void addMixin(String mixinId, Instantiator instantiator, String... order)
          Adds a mixin.
 void addToTemplate(RenderCommand element)
          Used during the construction of a page.
 void bindMixinParameter(String mixinId, String parameterName, Binding binding)
           
 boolean dispatchEvent(ComponentEvent event)
          Asks each mixin and component to Component.dispatchComponentEvent(ComponentEvent), returning true if any handler was found.
 void enqueueBeforeRenderBody(RenderQueue queue)
          Invoked when the component should render its body.
 Component getComponent()
          Returns the core component associated with this page element (as opposed to any mixins attached to the component).
 InternalComponentResources getComponentResources()
          Returns the resources associated with the core component.
 ComponentPageElement getContainerElement()
          Containing component (or null for the root component of a page).
 Page getContainingPage()
          Returns the page which contains this component.
 ComponentPageElement getEmbeddedElement(String id)
          Retrieves a component page element by its id.
 org.slf4j.Logger getEventLogger()
          Returns a logger used to for logging event dispatch and event method invocation.
 ComponentResources getMixinResources(String mixinId)
          Returns the ComponentResources for a mixin attached to this component element.
 ComponentPageElement newChild(String id, String nestedId, String completeId, String elementName, Instantiator instantiator, Location location)
          Creates a new child component of the invoked component.
 
Methods inherited from interface org.apache.tapestry5.ComponentResourcesCommon
createActionLink, createEventLink, createFormEventLink, createPageLink, createPageLink, findBlock, getBlock, getBody, getCompleteId, getElementName, getId, getLocale, getLogger, getNestedId, getPageName, getResourceSelector, hasBody, isRendering, triggerContextEvent, triggerEvent
 
Methods inherited from interface org.apache.tapestry5.ioc.Locatable
getLocation
 
Methods inherited from interface org.apache.tapestry5.internal.InternalComponentResourcesCommon
bindParameter, getBinding, getInformalParameterBindings, getMixinByClassName, isLoaded
 
Methods inherited from interface org.apache.tapestry5.runtime.RenderCommand
render
 
Methods inherited from interface org.apache.tapestry5.internal.structure.BodyPageElement
addToBody
 

Method Detail

getComponent

Component getComponent()
Returns the core component associated with this page element (as opposed to any mixins attached to the component).


getComponentResources

InternalComponentResources getComponentResources()
Returns the resources associated with the core component.


getContainingPage

Page getContainingPage()
Returns the page which contains this component.


getContainerElement

ComponentPageElement getContainerElement()
Containing component (or null for the root component of a page).


addToTemplate

void addToTemplate(RenderCommand element)
Used during the construction of a page. Adds a page element as part of the template for this page element. A page element will eventually render by sequentially rendering these elements. A page elements template is really just the outermost portions of the component's template ... where a template contains elements that are all components, those components will receive portions of the template as their body.


addBlock

void addBlock(String blockId,
              Block block)
Used during the contruction of a page to add a non-anonymous Block to the component.

See Also:
ComponentResourcesCommon.getBlock(String)

addMixin

void addMixin(String mixinId,
              Instantiator instantiator,
              String... order)
Adds a mixin.

Parameters:
mixinId - a unique id for the mixin, the last term of the mixin's class name
instantiator - used to instantiate an instance of the mixin
order - Ordering strings used to determine the order of mixin execution.

bindMixinParameter

void bindMixinParameter(String mixinId,
                        String parameterName,
                        Binding binding)
Parameters:
mixinId - id of previously added mixin
parameterName - simple (unqualified) name of parameter
binding - binding for parameter
Since:
5.1.0.0

getEmbeddedElement

ComponentPageElement getEmbeddedElement(String id)
Retrieves a component page element by its id. The search is caseless.

Parameters:
id - used to locate the element
Returns:
the page element
Throws:
IllegalArgumentException - if no component exists with the given id

getMixinResources

ComponentResources getMixinResources(String mixinId)
Returns the ComponentResources for a mixin attached to this component element. Mixin ids are the simple names of the mixin class.

Parameters:
mixinId - the mixin id (case insensitive)
Returns:
the resources for the component
Throws:
IllegalArgumentException - if no mixin with the given id exists

enqueueBeforeRenderBody

void enqueueBeforeRenderBody(RenderQueue queue)
Invoked when the component should render its body.


dispatchEvent

boolean dispatchEvent(ComponentEvent event)
Asks each mixin and component to Component.dispatchComponentEvent(ComponentEvent), returning true if any handler was found.

Parameters:
event - to be handled
Returns:
true if a handler was found

newChild

ComponentPageElement newChild(String id,
                              String nestedId,
                              String completeId,
                              String elementName,
                              Instantiator instantiator,
                              Location location)
Creates a new child component of the invoked component. The new element will be added as an embedded element of its container.

Parameters:
id - simple id of the new component
nestedId -
completeId -
elementName - name of the component's element in its container's template
instantiator - used to create a component instance, and access the component's model
location - location of the element within its container's template @return the new component

getEventLogger

org.slf4j.Logger getEventLogger()
Returns a logger used to for logging event dispatch and event method invocation.



Copyright © 2003-2012 The Apache Software Foundation.