Author: gseitz
Date: Fri Nov 30 14:21:44 2007
New Revision: 599985
URL: http://svn.apache.org/viewvc?rev=599985&view=rev
Log:
WICKET-1173
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java?rev=599985&r1=599984&r2=599985&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java
(original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/Page.java Fri
Nov 30 14:21:44 2007
@@ -33,6 +33,7 @@
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.resolver.IComponentResolver;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.RequestParameters;
import org.apache.wicket.session.ISessionStore;
@@ -1075,16 +1076,22 @@
while (iterator2.hasNext())
{
Component sibling =
(Component)iterator2.next();
- if (!sibling.isVisible() &&
sibling instanceof MarkupContainer &&
-
((MarkupContainer)sibling).isTransparentResolver())
+ if (!sibling.isVisible())
{
- // we found a
transparent container that isn't visible
- // then ignore this
component and only do a debug statement here.
- log.warn("Component " +
component +
- " wasn't
rendered but most likely it has a transparent parent: " +
- sibling);
- iterator.remove();
- break;
+ boolean
isTransparentMarkupContainer = sibling instanceof MarkupContainer &&
+
((MarkupContainer)sibling).isTransparentResolver();
+ boolean
isComponentResolver = sibling instanceof IComponentResolver;
+ if
(isTransparentMarkupContainer || isComponentResolver)
+ {
+ // we found a
transparent container that isn't visible
+ // then ignore
this component and only do a debug statement here.
+
log.warn("Component " +
+
component +
+ "
wasn't rendered but most likely it has a transparent parent: " +
+
sibling);
+
iterator.remove();
+ break;
+ }
}
}
}
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java?rev=599985&r1=599984&r2=599985&view=diff
==============================================================================
---
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java
(original)
+++
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/border/Border.java
Fri Nov 30 14:21:44 2007
@@ -89,8 +89,8 @@
* @author Juergen Donnerstag
*/
public abstract class Border extends WebMarkupContainerWithAssociatedMarkup
- implements
- IComponentResolver
+ implements
+ IComponentResolver
{
/**
*
@@ -123,6 +123,7 @@
/** only required during render phase. The <span wicket:id="myBorder">
tag */
private transient ComponentTag openTag;
+ private int beginOfBodyIndex;
/**
* @see org.apache.wicket.Component#Component(String)
@@ -203,7 +204,7 @@
* org.apache.wicket.markup.MarkupStream,
org.apache.wicket.markup.ComponentTag)
*/
public boolean resolve(final MarkupContainer container, final
MarkupStream markupStream,
- final ComponentTag tag)
+ final ComponentTag tag)
{
// In case of nested Borders, the outer border is no longer
able to find
// its body container easily. Thus we need to help resolve it.
@@ -253,8 +254,7 @@
if (tag.isOpen() == false)
{
throw new WicketRuntimeException(
- "The border tag must be an open tag.
Open-close is not allowed: " +
- tag.toString());
+ "The border tag must be an open tag. Open-close
is not allowed: " + tag.toString());
}
super.onComponentTag(tag);
@@ -265,22 +265,24 @@
* org.apache.wicket.markup.ComponentTag)
*/
protected final void onComponentTagBody(final MarkupStream markupStream,
- final ComponentTag openTag)
+ final ComponentTag openTag)
{
// Remember the data for easy access by the Body component
this.openTag = openTag;
originalMarkupStream = getMarkupStream();
+ // Remember the current position (start of border-body) of the
markupstream
+ beginOfBodyIndex = originalMarkupStream.getCurrentIndex();
+
// body.isVisible(false) needs a little extra work. We must
skip the
// markup between <span wicket:id="myBorder"> and </span>
if (body.isVisible() == false)
{
originalMarkupStream.skipToMatchingCloseTag(openTag);
}
-
// Render the associated markup
renderAssociatedMarkup("border",
- "Markup for a border component must begin a tag
like '<wicket:border>'");
+ "Markup for a border component must begin a tag like
'<wicket:border>'");
}
/**
@@ -333,7 +335,7 @@
* org.apache.wicket.markup.ComponentTag)
*/
protected void onComponentTagBody(final MarkupStream
markupStream,
- final ComponentTag openTag)
+ final ComponentTag openTag)
{
if (wasOpenCloseTag == false)
{
@@ -342,6 +344,15 @@
markupStream.skipRawMarkup();
}
+ // this check always results in false for normal
requests.
+ // in case of ajax requests, the markupstream is not
reset after the first render, thus
+ // the current index of the markup stream points to the
element after the body.
+ // as a result, no elements are detected and always
omitted.
+ if (beginOfBodyIndex !=
originalMarkupStream.getCurrentIndex())
+ {
+
originalMarkupStream.setCurrentIndex(beginOfBodyIndex);
+ }
+
super.onComponentTagBody(originalMarkupStream,
Border.this.openTag);
}
@@ -350,7 +361,7 @@
* org.apache.wicket.markup.MarkupStream,
org.apache.wicket.markup.ComponentTag)
*/
public boolean resolve(final MarkupContainer container, final
MarkupStream markupStream,
- final ComponentTag tag)
+ final ComponentTag tag)
{
// Usually you add child components to Border instead
of Body. Hence
// we need to help Body to properly resolve the
children.