Revision: 1286
http://stripes.svn.sourceforge.net/stripes/?rev=1286&view=rev
Author: bengunter
Date: 2010-09-29 02:47:13 +0000 (Wed, 29 Sep 2010)
Log Message:
-----------
STS-391: LayoutContext.getOuterContext(..) should not have been implemented as
a static method. I removed it and added instance methods getFirst() and
getLast() to get the first or last context in the list.
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/LayoutTag.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
2010-09-28 20:03:24 UTC (rev 1285)
+++
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutContext.java
2010-09-29 02:47:13 UTC (rev 1286)
@@ -70,14 +70,6 @@
return (LayoutContext)
pageContext.getRequest().getAttribute(REQ_ATTR_NAME);
}
- /** Locate and return the outermost layout context, starting with the
given one. */
- public static LayoutContext getOuterContext(LayoutContext context) {
- LayoutContext outer = context;
- while (outer.getPrevious() != null)
- outer = outer.getPrevious();
- return outer;
- }
-
/**
* Remove the current layout context from the stack of layout contexts.
*
@@ -121,6 +113,22 @@
/** Get the next layout context from the stack. */
public LayoutContext getNext() { return next; }
+ /** Get the first context in the list. */
+ public LayoutContext getFirst() {
+ for (LayoutContext c = this;; c = c.getPrevious()) {
+ if (c.getPrevious() == null)
+ return c;
+ }
+ }
+
+ /** Get the last context in the list. */
+ public LayoutContext getLast() {
+ for (LayoutContext c = this;; c = c.getNext()) {
+ if (c.getNext() == null)
+ return c;
+ }
+ }
+
/** Get the render tag that created this context. */
public LayoutRenderTag getRenderTag() { return renderTag; }
Modified:
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutTag.java
===================================================================
---
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutTag.java
2010-09-28 20:03:24 UTC (rev 1285)
+++
branches/1.5.x/stripes/src/net/sourceforge/stripes/tag/layout/LayoutTag.java
2010-09-29 02:47:13 UTC (rev 1286)
@@ -90,8 +90,7 @@
* defined components override any that might have been defined previously
by the same name.
*/
public void exportComponentRenderers() {
- LayoutContext outer =
LayoutContext.getOuterContext(LayoutContext.lookup(pageContext));
- for (LayoutContext c = outer; c != null; c = c.getNext()) {
+ for (LayoutContext c = LayoutContext.lookup(pageContext).getFirst(); c
!= null; c = c.getNext()) {
for (Entry<String, LayoutComponentRenderer> entry :
c.getComponents().entrySet()) {
entry.getValue().pushPageContext(pageContext);
pageContext.setAttribute(entry.getKey(), entry.getValue());
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development