1 16 package org.apache.cocoon.woody.event; 17 18 import org.apache.cocoon.woody.event.impl.JavaClassWidgetListenerBuilder; 19 import org.apache.cocoon.woody.event.impl.JavaScriptWidgetListenerBuilder; 20 import org.apache.cocoon.woody.util.DomHelper; 21 import org.w3c.dom.Element ; 22 23 30 public class WidgetListenerBuilderUtil { 31 32 public static WidgetListener getWidgetListener(Element element, Class listenerClass) throws Exception { 33 if (element.getLocalName().equals("java")) { 34 return JavaClassWidgetListenerBuilder.INSTANCE.buildListener(element, listenerClass); 35 } else if (element.getLocalName().equals("javascript")) { 36 return JavaScriptWidgetListenerBuilder.INSTANCE.buildListener(element, listenerClass); 37 } else { 38 throw new IllegalArgumentException ("Unknown listener element " + element.getTagName() + 39 " at " + DomHelper.getLocation(element)); 40 } 41 } 42 } 43 | Popular Tags |