Annotation Type OnEvent


  • @Target(METHOD)
    @Retention(RUNTIME)
    @Documented
    @UseWith({COMPONENT,MIXIN,PAGE})
    public @interface OnEvent
    Marks a method as a handler for a client side event. The handler method will be invoked when a component triggers an event. Filters on the type of event and on the originating component ensure that only the appropriate methods are invoked. Client events include a context of one or more values. These context values are included in the action URI. The values are optionally supplied to the handler method as parameters. Automatic conversion from string to the type of the actual parameter occur. Handlers may return a value. Returning a non-null value will abort the handling of the event, and will usually control the response sent to the client web browser. The details are somewhat specific to the type of event and the component involved. If a handler is not found within the originating component (or no handler aborts the event handling), then handlers within the containing component will be searched. This continues up the page hierarchy. In some cases, having no handlers (or no aborting handlers) is considered acceptible; in others, it is an error. Again, this is defined by the type of originating component, and the type of event. If you fail to provide filters on either component or event type, then your method will be invoked for all component events, possibly including events that bubble up from embedded sub-components.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String component
      The local id of the component from which the event originates.
      java.lang.String value
      The event type to match.
    • Element Detail

      • value

        java.lang.String value
        The event type to match. The handler will only be invoked if the client event type matches the value. The default value is "action". Matching is case-insensitive.
        See Also:
        EventConstants
        Default:
        "action"
      • component

        java.lang.String component
        The local id of the component from which the event originates. If not specified, then the default is to match any component. If an event from a component is not handled in the component's container, it is re-triggered inside the component's grand-container and will appear to originate from the container. Thus events that escape a component will appear to originate in the component's container, and so forth. Matching by component id is case insensitive.
        Default:
        ""