I wrote a pretty simple transform worker and when I changed its name
all my events quit working.

After a bit of debugging I tried adding after:* to the configuration
and they work again

configuration.add("NVLWorker", new NVLWorker(nvlService),"after:*");

If I change to

configuration.add("NVLWorker", new NVLWorker(nvlService),"before:*");

They stop.

The worker does mess with events but I'm not sure what I'm doing that
would stop all events


public class NVLWorker implements ComponentClassTransformWorker2 {
        
        private NVLService nvlService;
        private final String id = NVLWorker.class.getName();


        public NVLWorker(NVLService nvlService) {
                this.nvlService = nvlService;
        }

        public void transform(PlasticClass plasticClass, TransformationSupport 
support,
                        MutableComponentModel model) {
                
                List<PlasticField> fields = 
plasticClass.getFieldsWithAnnotation(NVL.class);
                for ( PlasticField field : fields ) {
                        if ( nvlService.isImplemented(field.getTypeName()))  {
                                
support.addEventHandler(EventConstants.PREPARE,0,"Init if null",
                                                
createPrepareHandler(field.getTypeName(), field.getHandle()));
                        }
                }
                
        }


        private ComponentEventHandler createPrepareHandler(final String
typeName, final FieldHandle handle) {
                return new ComponentEventHandler() {                    
                        public void handleEvent(Component component, 
ComponentEvent event) {
                                if ( handle.get(component) == null ) {
                                        handle.set(component, 
nvlService.newInstance(typeName));
                                }
                        }
                };
        }

}


The page contains

@PageActivationContext
        @Property
        @NVL
        private IPerson person;
        
        void onActivate() {
                if ( person == null ) {
                        logger.info("person is null");
                }
        }
        
        void onSuccess() {
                logger.info("age {}" , person.getAge());
        }

with after:* both onActivate and onSuccess are called. With before:*
neither is called. I'm OK with added after:* but I don't really
understand why that fixes it. Any help would be appreciated. FYI I'm
running 5.3-beta-13


Thanks
Barry

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to