public interface ComponentResourcesCommon extends Locatable
ComponentResources
interface and
ComponentPageElement
interface (on the internal side).Modifier and Type | Method and Description |
---|---|
Link |
createEventLink(String eventType,
Object... context)
Creates a component event request link as a callback for this component.
|
Link |
createFormEventLink(String eventType,
Object... context)
Creates a component event request link as a callback for this component.
|
Block |
findBlock(String blockId)
As with
getBlock(String) , but returns null if the block is not found. |
Block |
getBlock(String blockId)
Returns a block from the component's template, referenced by its id.
|
Block |
getBody()
Returns the body of this component as a (possibly empty) block.
|
String |
getCompleteId()
Returns a string consisting of the logical name of the containing page, and the
nested id
of this component, separated by a colon. |
String |
getElementName(String defaultElementName)
Returns the name of element that represents the component in its template, or the provided default element name
if the element was a component type (in the Tapestry namespace).
|
String |
getId()
Returns the simple (or local) id of the component.
|
Locale |
getLocale()
Returns the locale for the page containing this component.
|
org.slf4j.Logger |
getLogger()
Returns the log instance associated with the component (which is based on the component or mixin's class name).
|
String |
getNestedId()
Return a string consisting the concatenated ids of all containing components, separated by periods.
|
String |
getPageName()
Returns the logical name of the page containing this component.
|
ComponentResourceSelector |
getResourceSelector()
Returns the selector used when constructing the component and its containing page.
|
boolean |
hasBody()
Returns true if the element has a body and false otherwise.
|
boolean |
isRendering()
Returns true if the component is currently rendering, false otherwise.
|
boolean |
triggerContextEvent(String eventType,
EventContext context,
ComponentEventCallback callback)
Triggers a component event.
|
boolean |
triggerEvent(String eventType,
Object[] contextValues,
ComponentEventCallback callback)
A convenience method for invoking
triggerContextEvent(String, EventContext , ComponentEventCallback) . |
getLocation
String getId()
String getNestedId()
String getCompleteId()
nested id
of this component, separated by a colon. I.e., "MyPage:foo.bar.baz". For a page, returns just the page's name.
This value is often used to obtain an equivalent component instance in a later request.ComponentSource.getComponent(String)
boolean triggerEvent(String eventType, Object[] contextValues, ComponentEventCallback callback)
triggerContextEvent(String, EventContext , ComponentEventCallback)
. Wraps
the context values into an EventContext
.eventType
- event type (as determined from the request, or otherwise by design)contextValues
- Values that may be provided to the event handler method as method parameters, or null if no
context values are availablecallback
- the handler to be informed of the result, or null if the event is a notification that does
not support return values from event handler methods (the value true is allowed even if the
handler is null).ComponentEventException
- if an event handler method throws a checked or unchecked exceptionOnEventWorker
,
OnEvent
boolean triggerContextEvent(String eventType, EventContext context, ComponentEventCallback callback)
eventType
- event type (as determined from the request, or otherwise by design)context
- the context (as extracted from the request, or provided by the triggering component); these
values may be provided to event handler methods via their parameters (may not be null)callback
- the handler to be informed of the result, or null if the event is a notification that does not
support return values from event handler methods (the value true is allowed even if the handler
is null).ComponentEventException
- if an event handler method throws a checked or unchecked exceptionOnEventWorker
,
OnEvent
boolean isRendering()
org.slf4j.Logger getLogger()
ComponentModel.getLogger()
Locale getLocale()
getResourceSelector()
ComponentResourceSelector getResourceSelector()
String getElementName(String defaultElementName)
defaultElementName
- element name to return if the element name is not known (may be null)Block getBlock(String blockId)
blockId
- the id of the block (case insensitive)BlockNotFoundException
- if no block with the given id existsfindBlock(String)
Block findBlock(String blockId)
getBlock(String)
, but returns null if the block is not found.blockId
- the id of the block (case insensitive)String getPageName()
boolean hasBody()
Block getBody()
Link createEventLink(String eventType, Object... context)
eventType
- the type of event to be triggered. Event types should be Java identifiers (contain only
letters, numbers and the underscore).context
- additional objects to be encoded into the path portion of the link; each is converted to a
string and URI encodedLink createFormEventLink(String eventType, Object... context)
eventType
- the type of event to be triggered. Event types should be Java identifiers (contain only
letters, numbers and the underscore).context
- additional objects to be encoded into the path portion of the link; each is converted to a
string and URI encoded5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.