Revision: 1463
http://stripes.svn.sourceforge.net/stripes/?rev=1463&view=rev
Author: bengunter
Date: 2012-02-07 14:58:36 +0000 (Tue, 07 Feb 2012)
Log Message:
-----------
If a renderer exists in a previous context for a component with the same name,
then use the existing renderer instead of creating a new one.
Modified Paths:
--------------
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java
Modified:
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java
===================================================================
---
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java
2012-02-06 19:58:34 UTC (rev 1462)
+++
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutComponentTag.java
2012-02-07 14:58:36 UTC (rev 1463)
@@ -207,7 +207,18 @@
}
log.debug("Register component ", getName(), " with ",
context.getRenderPage());
- context.getComponents().put(getName(), new
LayoutComponentRenderer(getName()));
+
+ // Look for an existing renderer for a component with the
same name
+ LayoutComponentRenderer renderer = null;
+ for (LayoutContext c = context; c != null && renderer ==
null; c = c.getPrevious()) {
+ renderer = c.getComponents().get(getName());
+ }
+
+ // If not found then create a new one
+ if (renderer == null)
+ renderer = new LayoutComponentRenderer(getName());
+
+ context.getComponents().put(getName(), renderer);
}
else if (isChildOfDefinition()) {
// Use a layout component renderer to do the heavy lifting
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
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-d2d
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development