Community
Participate
Working Groups
It would be nice if @EventTopic would work with methods. Sometimes I just want to use an event as an trigger. For example I want to send an event if the undo is complete (no more command in the command stack). Right now I have to do something like: eventBroker.post(TOPIC_UNDO_COMPLETE, new PlaceHolderObject()); I would prefer to just call eventBroker.post(TOPIC_UNDO_COMPLETE);
it's valid to use eventBroker.post(TOPIC,null); As long as your method has @Optional @EventTopic it should get called. PW
Yes it gets called, but I still have to declare the method like this: @Inject @Optional public void test(@UIEventTopic("test") String notNeeded) { System.out.println(notNeeded); } I think it would be cleaner if we can just write: @Inject @UIEventTopic("test") public void test() { System.out.println("received"); } And just looking at the 'eventBroker.post(TOPIC,null)' call gives me no indication if the message should send null or should send nothing.
(In reply to Roger Gilliar from comment #2) > Yes it gets called, > > but I still have to declare the method like this: > > @Inject > @Optional > public void test(@UIEventTopic("test") String notNeeded) { > System.out.println(notNeeded); > } That's because we're using an object supplier to allow a DIed object to receive events. > > I think it would be cleaner if we can just write: > > @Inject > @UIEventTopic("test") > public void test() { > System.out.println("received"); > } What you want is a way to trigger a method call against a DI object. I'll leave this open as an enhancement, but I don't know how appropriate it is for the DI system to support this. > > And just looking at the 'eventBroker.post(TOPIC,null)' call gives me no > indication if the message should send null or should send nothing. That's because IEventBroker knows it's firing events, it knows nothing about the @EventTopic add-on that tries to funnel events through the DI system. Arguably the @EventTopic/@UIEventTopic should be the place to specify the pre/post conditions for success. PW