incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r486304 - /incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
Date Tue, 12 Dec 2006 20:50:13 GMT
Author: awiner
Date: Tue Dec 12 12:50:12 2006
New Revision: 486304

URL: http://svn.apache.org/viewvc?view=rev&rev=486304
Log:
Add a warning to showDetail to catch incorrect delivery of DisclosureEvents

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java?view=diff&rev=486304&r1=486303&r2=486304
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXShowDetailTemplate.java
Tue Dec 12 12:50:12 2006
@@ -23,6 +23,8 @@
 
 import org.apache.myfaces.trinidad.event.DisclosureEvent;
 
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+
 /**
  * Base class for ShowDetail component.
  * @version $Name:  $ ($Revision$) $Date$
@@ -73,7 +75,21 @@
     {
       // Expand or collapse this showDetail
       boolean isDisclosed = ((DisclosureEvent) event).isExpanded();
-      setDisclosed(isDisclosed);
+      // If the component is already in that disclosure state, we 
+      // have a renderer bug.  Either it delivered an unnecessary event,
+      // or even worse it set disclosed on its own instead of waiting 
+      // for the disclosure event to do that, which will lead to lifecycle
+      // problems.  So in either case, warn the developer.
+      if (isDisclosed == isDisclosed())
+      {
+        _LOG.warning("Event {0} was delivered to a showDetail "+
+                     "already in that disclosure state.", event);
+      }
+      else
+      {
+        setDisclosed(isDisclosed);
+      }
+
       //pu: Implicitly record a Change for 'disclosed' attribute
       addAttributeChange("disclosed",
                          isDisclosed ? Boolean.TRUE : Boolean.FALSE);
@@ -108,4 +124,5 @@
     super.queueEvent(e);
   }
 
+  static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(UIXShowDetail.class);
 }



Mime
View raw message