Reputation: 4000
As far as I understand, Zone is a component and I can handle it's events.
So I types the following code:
@InjectComponent
private Zone zoneSample;
@OnEvent(component = "zoneSample")
private void zoneEvent() {
System.out.println(String.format("Zone client id: %s", zoneSample.getClientId()));
}
No exception is thrown so the Zone ID is set correctly. But the event isn't fired ! Shouldn't this event handling method match all events for the zone ?
I expected it to be fired basically before, while and after rendering the zone because I need to see if I can obtain the generated zone's client-id to use it to show this zone later on using the AjaxResponseRenderer class.
Upvotes: 1
Views: 101
Reputation: 139
Zone fires no events. There's a handy mixin that can help you in this scenario, the RenderNotification mixin.
It provides two events: beginRender and afterRender, I think that's all you need. After you apply the mixin to the zone, the code to handle the events would look something like this:
void onBeginRenderFromZoneSample(MarkupWriter writer)
{
...
}
void onAfterRenderFromZoneSample(MarkupWriter writer)
{
...
}
Upvotes: 4