This content has been marked as final.
Show 4 replies
-
1. Re: Lazy Observers?
pmuir May 29, 2008 7:44 PM (in response to stephen)So you want more control over the routing of events? How about using an intermediary that observes your macro event and calls finer grained ones as needed?
-
2. Re: Lazy Observers?
stephen May 29, 2008 9:01 PM (in response to stephen)Thanks a lot for your answer, Pete.
So you want more control over the routing of events?Right. More or less a way to have
create = false
for event observers.
How about using an intermediary ...Ah, ok, that's a workaround (though somewhat clumsy). It would look like this for my scenario:
@Name("selectionEventMediator") @Scope(ScopeType.PAGE) public class SelectionEventMediator { @In(create = false, required = false) private ProductChartNavigation productChartNavigation; @In(create = false, required = false) private RegionNavigation regionNavigation; ... a couple more ... @Observer(Selection.CHANGED_EVENT_NAME) public void handleSelectionChanged() { if (productChartNavigation != null) { productChartNavigation.handleSelectionChanged(); } if (regionNavigation != null) { regionNavigation.handleSelectionChanged(); } } }
That said: Will it work if ProductChartNavigation et.al. are defined using @AutoCreate?
Or will they be created in that case even thoughrequired = false
for the @In declarations? -
3. Re: Lazy Observers?
christian.bauer May 29, 2008 10:40 PM (in response to stephen)
Stephen Friedrich wrote on May 29, 2008 21:01:
Right. More or less a way to havecreate = false
for event observers.@Observer(value="foo", create=false)
-
4. Re: Lazy Observers?
stephen May 29, 2008 11:06 PM (in response to stephen)Stupid me.
Will read the fine manual one more time.
Thanks for the answer.