This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Component Events

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: cleaning up old wiki formatting

Component events are Tapestry's way of conveying a user's interactions with the web page, such as clicking links and submitting forms, to designated methods in your page and component classes. When a component event is triggered, Tapestry calls the event handler method you've provided, if any, in the containing component's class.

Div
stylefloat:right; max-width: 30%; margin: 1em
titleRelated Articles
classaui-label
Content by Label
showLabelsfalse
showSpacefalse
titleRelated Articles
cqllabel = "request-processing" and space = currentSpace()

...

When an event handler method throws an exception (checked or runtime), Tapestry gives the component and its containing page a chance to handle the exception, before continuing on to report the exception. Wiki Markup

{float:right|background=#eee|padding=0 1em}
    *JumpStart Demo:*
    [Handling A Bad Context|http://jumpstart.doublenegative.com.au/jumpstart/examples/infrastructure/handlingabadcontext/1]
{float}

Div
stylefloat: right; max-width: 30%; margin: 1em
Panel
borderColor#eee
titleBGColor#eee
titleJumpStart Demo

Handling A Bad Context

 

Tapestry triggers a new event, of type "exception", passing the thrown exception as the context. In fact, the exception is wrapped inside a ComponentEventException, from which you may extract the event type and context.

...

If there is no exception event handler, or the exception event handler returns null (or is void), then the exception will be passed to the RequestExceptionHandler service, which (in the default configuration) will render the exception page.

Triggering Events

Wiki Markup
{float:right|background=#eee|padding=0 1em}
    *JumpStart Demo:*
    [AJAX Components CRUD|http://jumpstart.doublenegative.com.au/jumpstart/together/ajaxcomponentscrud/persons]
{float}
Div
stylemax-width: 30%; float: right; margin: 1em
Panel
borderColor#eee
titleBGColor#eee
titleJumpStart Demo

AJAX Components CRUD

 

If you want your own component to trigger events, just call the triggerEvent method of ComponentResources from within your component class.

...

The third parameter to triggerEvent is a ComponentEventCallback, which you'll only need to implement if you want to get the return value of the handler method. The return value of triggerEvent() says if the event was handled or not.

 

Scrollbar