You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/05/18 15:52:38 UTC

svn commit: r407551 - in /cocoon: branches/BRANCH_2_1_X/status.xml trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/event/impl/JavaClassWidgetListenerBuilder.java

Author: cziegeler
Date: Thu May 18 06:52:37 2006
New Revision: 407551

URL: http://svn.apache.org/viewvc?rev=407551&view=rev
Log:
CForms: Java event listeners can now implement Configurable, LogEnabled, and Contextualizable.


Modified:
    cocoon/branches/BRANCH_2_1_X/status.xml
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/event/impl/JavaClassWidgetListenerBuilder.java

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=407551&r1=407550&r2=407551&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Thu May 18 06:52:37 2006
@@ -182,6 +182,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.10" date="TBD">
+    <action dev="CZ" type="add">
+      CForms: Java event listeners can now implement Configurable, LogEnabled, and Contextualizable.
+    </action>
     <action dev="BRD" type="fix">
       CForms: added a Repeater.moveRow2(from, to) method, which in contrast to the
       Repeater.moveRow method inserts the row at the exact to-index specified.
@@ -438,7 +441,7 @@
       CForms: call dispose() on every DatatypeBuilder if needed
     </action>
     <action dev="JBQ" type="add" due-to="Philippe Gassmann" due-to-email="phil@anyware-tech.com">
-      CForms: Java event listeners can now implement Serviceable to get a ServiceManager
+      CForms: Java event listeners can now implement Serviceable to get a ServiceManager and Initializable.
     </action>
     <action dev="JBQ" type="fix" due-to="Philippe Gassmann" due-to-email="phil@anyware-tech.com">
       CForms: when building the query string in AJAX mode, do not include &lt;input type="button"&gt;

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/event/impl/JavaClassWidgetListenerBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/event/impl/JavaClassWidgetListenerBuilder.java?rev=407551&r1=407550&r2=407551&view=diff
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/event/impl/JavaClassWidgetListenerBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/event/impl/JavaClassWidgetListenerBuilder.java Thu May 18 06:52:37 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,6 +20,11 @@
 import org.apache.cocoon.forms.event.WidgetListenerBuilder;
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.util.ClassUtils;
+import org.apache.avalon.framework.configuration.ConfigurationUtil;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
@@ -36,20 +41,37 @@
  *
  * @version $Id$
  */
-public class JavaClassWidgetListenerBuilder implements WidgetListenerBuilder, ThreadSafe, Serviceable {
-	ServiceManager manager;
-
+public class JavaClassWidgetListenerBuilder
+    extends AbstractLogEnabled
+    implements WidgetListenerBuilder, ThreadSafe, Contextualizable, Serviceable {
+
+    protected ServiceManager manager;
+
+    protected Context context;
+
+	/**
+	 * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+	 */
+	public void contextualize(Context context) throws ContextException {
+        this.context = context;
+    }
+
+    /**
+	 * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
+	 */
 	public void service(ServiceManager manager) throws ServiceException {
 		this.manager = manager;
 	}
 
+	/**
+	 * @see org.apache.cocoon.forms.event.WidgetListenerBuilder#buildListener(org.w3c.dom.Element, java.lang.Class)
+	 */
 	public WidgetListener buildListener(Element element, Class listenerClass) throws Exception {
-
         String name = DomHelper.getAttribute(element, "class");
 
         Object listener = ClassUtils.newInstance(name);
         if (listenerClass.isAssignableFrom(listener.getClass())) {
-            LifecycleHelper.setupComponent(listener, null, null, manager, null);
+            LifecycleHelper.setupComponent(listener, this.getLogger(), this.context, manager, ConfigurationUtil.toConfiguration(element));
             return (WidgetListener)listener;
         } else {
             throw new Exception("Class " + listener.getClass() + " is not a " + listenerClass);