You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 11 Members of 9199 |
| Forum: Seam Users |
12. Mar 2010, 11:37 America/New_York | Link |
hi,
i am working on Seam component events
i am getting the output with the help of annotations.
Now i want to add the component Programatically and want to add as obsesrver for existing events. i.e registering component as observer dynamaically. without using annotations.
Any ideas?????????
Thanks in advance.
Regards Devika.N
I am not sure if this will work. But you can try this:
My blog
Thanks for the reply.
pls can u send me some sample code.
Regards Devika.N
I just did.
You just need to fill out whatever you want.
This is taken from Component.java (source of seam) There you see how observers are registered using reflection
if ( method.isAnnotationPresent(Observer.class) ) { //can't use Init.instance() here because of unit tests Init init = (Init) applicationContext.get(Seam.getComponentName(Init.class)); Observer observer = method.getAnnotation(Observer.class); for ( String eventType : observer.value() ) { if ( eventType.length()==0 ) eventType = method.getName(); //TODO: new defaulting rule to map @Observer onFooEvent() -> event type "fooEvent" init.addObserverMethod( eventType, method, this, observer.create() ); } }My blog