Revision: 1461
          http://stripes.svn.sourceforge.net/stripes/?rev=1461&view=rev
Author:   bengunter
Date:     2012-02-06 19:55:38 +0000 (Mon, 06 Feb 2012)
Log Message:
-----------
STS-817: Fixed yet another incompatibility in the layout tags.

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutContext.java
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutContext.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutContext.java
    2012-02-06 15:49:04 UTC (rev 1460)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutContext.java
    2012-02-06 19:55:38 UTC (rev 1461)
@@ -176,6 +176,9 @@
     /** Get the next layout context from the stack. */
     public LayoutContext getNext() { return next; }
 
+    /** Set the next layout context in the stack. */
+    public void setNext(LayoutContext next) { this.next = next; }
+
     /** Get the first context in the list. */
     public LayoutContext getFirst() {
         for (LayoutContext c = this;; c = c.getPrevious()) {

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java
  2012-02-06 15:49:04 UTC (rev 1460)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutRenderTag.java
  2012-02-06 19:55:38 UTC (rev 1461)
@@ -38,7 +38,7 @@
     private static final Log log = Log.getInstance(LayoutRenderTag.class);
 
     private String name;
-    private LayoutContext context;
+    private LayoutContext context, forkedContext;
     private boolean contextIsNew, silent;
     private BodyContent bodyContent;
 
@@ -53,11 +53,28 @@
         if (context == null) {
             LayoutContext context = LayoutContext.lookup(pageContext);
 
-            boolean create = context == null
-                    || context.getNext() == null
-                    && (!context.isComponentRenderPhase() || 
context.isComponentRenderPhase()
-                            && isChildOfCurrentComponent());
+            boolean create = context == null;
+            if (!create) {
+                boolean rendering = context.isComponentRenderPhase();
+                LayoutContext next = context.getNext();
 
+                if (next == null) {
+                    create = !rendering || rendering && 
isChildOfCurrentComponent();
+                }
+                else {
+                    create = rendering
+                            && isChildOfCurrentComponent()
+                            && 
!(context.getRenderPage().equals(next.getRenderPage()) && context
+                                    
.getComponent().equals(next.getComponent()));
+
+                    if (create) {
+                        log.debug("Encountered a fork in the rendering path");
+                        forkedContext = next;
+                        context.setNext(null);
+                    }
+                }
+            }
+
             if (create)
                 context = LayoutContext.push(this);
 
@@ -201,6 +218,11 @@
             throw new JspException(e);
         }
         finally {
+            if (this.forkedContext != null) {
+                this.context.setNext(this.forkedContext);
+                this.forkedContext = null;
+            }
+
             this.context = null;
             this.contextIsNew = false;
             this.silent = false;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to