You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mc...@apache.org on 2008/08/29 18:52:50 UTC

svn commit: r690330 - /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessChoiceBarRenderer.java

Author: mcooper
Date: Fri Aug 29 09:52:50 2008
New Revision: 690330

URL: http://svn.apache.org/viewvc?rev=690330&view=rev
Log:
Fixed case where the ProcessChoiceBarRenderer would render invalid HTML if it had nothing to render.
It was creating starting elements but not closing them out.
Now, it only creates the elements if needed (if there are items to render in the processChoiceBar) so the page will use valid HTML and subsequent components on the page will be able to display properly.

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessChoiceBarRenderer.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessChoiceBarRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessChoiceBarRenderer.java?rev=690330&r1=690329&r2=690330&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessChoiceBarRenderer.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/ProcessChoiceBarRenderer.java Fri Aug 29 09:52:50 2008
@@ -136,18 +136,23 @@
       boolean isNewPath = setNewPath(context, node, component);
       if (isNewPath)
       {
+        // The postrender will only close out the DOM is newPath is non-null so we should only
+        // prerender if newPath is also non-null.
         Object newPath = component.getRowKey();
-        context.setLocalProperty(_NEW_PATH_KEY, newPath);
-        component.setRowKey(oldPath);
+        if (newPath != null)
+        {
+          context.setLocalProperty(_NEW_PATH_KEY, newPath);
+          component.setRowKey(oldPath);
 
-        // add core.js
-        XhtmlLafUtils.addLib(context, "_commandChoice()");
-        renderPreChoice(context, node);
-        CommandNavigationItemRenderer.setNavigationItemRendererType(context,
-                                   CommandNavigationItemRenderer.OPTION_TYPE);
+          // add core.js
+          XhtmlLafUtils.addLib(context, "_commandChoice()");
+          renderPreChoice(context, node);
+          CommandNavigationItemRenderer.setNavigationItemRendererType(context,
+                                     CommandNavigationItemRenderer.OPTION_TYPE);
 
-        // start drop-down rendering...
-        super.prerender(context, node);
+          // start drop-down rendering...
+          super.prerender(context, node);
+        }
       }
     }
   }