You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2007/03/28 09:19:31 UTC
svn commit: r523205 - in
/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src: main/java/wicket/
main/java/wicket/markup/ main/java/wicket/markup/html/internal/
main/java/wicket/markup/parser/filter/ main/java/wicket/markup/resolver/
test/java/wick...
Author: ivaynberg
Date: Wed Mar 28 00:19:30 2007
New Revision: 523205
URL: http://svn.apache.org/viewvc?view=rev&rev=523205
Log:
wicket:enclosure backport
Added:
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/internal/Enclosure.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/parser/filter/EnclosureHandler.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/resolver/EnclosureResolver.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.html
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosureTest.java
Modified:
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Application.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/ComponentTag.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/MarkupParserFactory.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/WicketTag.java
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Application.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Application.java?view=diff&rev=523205&r1=523204&r2=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Application.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/Application.java Wed Mar 28 00:19:30 2007
@@ -35,6 +35,7 @@
import wicket.markup.MarkupCache;
import wicket.markup.html.image.resource.DefaultButtonImageResourceFactory;
import wicket.markup.resolver.AutoComponentResolver;
+import wicket.markup.resolver.EnclosureResolver;
import wicket.markup.resolver.FragmentResolver;
import wicket.markup.resolver.HtmlHeaderResolver;
import wicket.markup.resolver.MarkupInheritanceResolver;
@@ -875,7 +876,8 @@
pageSettings.addComponentResolver(new WicketLinkResolver());
pageSettings.addComponentResolver(new WicketMessageResolver());
pageSettings.addComponentResolver(new FragmentResolver());
-
+ pageSettings.addComponentResolver(new EnclosureResolver());
+
// Install button image resource factory
getResourceSettings().addResourceFactory("buttonFactory",
new DefaultButtonImageResourceFactory());
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/ComponentTag.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/ComponentTag.java?view=diff&rev=523205&r1=523204&r2=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/ComponentTag.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/ComponentTag.java Wed Mar 28 00:19:30 2007
@@ -74,7 +74,7 @@
/** True, if attributes have been modified or added */
private boolean modified = false;
-
+
/**
* In case of inherited markup, the base and the extended markups are merged
* and the information about the tags origin is lost. In some cases like
@@ -88,6 +88,7 @@
*/
private boolean hasNoCloseTag = false;
+
/** added behaviors */
private Collection behaviors;
@@ -157,7 +158,7 @@
List empty = EMPTY_LIST;
return empty.iterator();
}
-
+
Collection locked = Collections.unmodifiableCollection(behaviors);
return locked.iterator();
}
@@ -550,7 +551,7 @@
return buf;
}
-
+
/**
* @see wicket.markup.MarkupElement#toCharSequence()
*/
@@ -596,7 +597,7 @@
}
response.write(getName());
-
+
String namespacePrefix = null;
if (stripWicketAttributes == true)
{
@@ -670,6 +671,7 @@
this.modified = modified;
}
+
/**
*
* @return True, if the component tag has been marked modified
@@ -712,7 +714,7 @@
/**
* True if the HTML tag (e.g. br) has no close tag
*
- * @param hasNoCloseTag
+ * @param hasNoCloseTag
*/
public void setHasNoCloseTag(boolean hasNoCloseTag)
{
@@ -741,4 +743,5 @@
{
this.markupClass = wicketHeaderClass;
}
+
}
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/MarkupParserFactory.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/MarkupParserFactory.java?view=diff&rev=523205&r1=523204&r2=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/MarkupParserFactory.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/MarkupParserFactory.java Wed Mar 28 00:19:30 2007
@@ -19,6 +19,7 @@
import wicket.Application;
import wicket.markup.parser.IMarkupFilter;
import wicket.markup.parser.XmlPullParser;
+import wicket.markup.parser.filter.EnclosureHandler;
import wicket.markup.parser.filter.PrependContextPathHandler;
/**
@@ -29,6 +30,10 @@
public class MarkupParserFactory implements IMarkupParserFactory
{
private IMarkupFilter[] filters;
+
+ // FIXME right now we add the two default filters in 3 places, refactor so
+ // it is done in a single place
+
/**
* Construct.
*
@@ -37,7 +42,8 @@
*/
public MarkupParserFactory(final Application application)
{
- this.filters = new IMarkupFilter[] { new PrependContextPathHandler(application) };
+ this.filters = new IMarkupFilter[] { new PrependContextPathHandler(application),
+ new EnclosureHandler() };
}
/**
@@ -50,9 +56,10 @@
*/
public MarkupParserFactory(final Application application, IMarkupFilter[] filters)
{
- this.filters = new IMarkupFilter[filters.length+1];
+ this.filters = new IMarkupFilter[filters.length + 2];
System.arraycopy(filters, 0, this.filters, 0, filters.length);
- this.filters[filters.length] = new PrependContextPathHandler(application);
+ this.filters[filters.length - 1] = new PrependContextPathHandler(application);
+ this.filters[filters.length] = new EnclosureHandler();
}
/**
@@ -65,7 +72,8 @@
*/
public MarkupParserFactory(final Application application, IMarkupFilter filter)
{
- this.filters = new IMarkupFilter[] { filter, new PrependContextPathHandler(application) };
+ this.filters = new IMarkupFilter[] { filter, new PrependContextPathHandler(application),
+ new EnclosureHandler() };
}
/**
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/WicketTag.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/WicketTag.java?view=diff&rev=523205&r1=523204&r2=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/WicketTag.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/WicketTag.java Wed Mar 28 00:19:30 2007
@@ -143,6 +143,14 @@
}
/**
+ * @return true if <wicket:enclsoure>
+ */
+ public final boolean isEnclosureTag()
+ {
+ return "enclosure".equalsIgnoreCase(getName());
+ }
+
+ /**
* @return True if <wicket:panel>, <wicket:border>, <wicket:ex
*/
public final boolean isMajorWicketComponentTag()
Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/internal/Enclosure.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/internal/Enclosure.java?view=auto&rev=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/internal/Enclosure.java (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/internal/Enclosure.java Wed Mar 28 00:19:30 2007
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.markup.html.internal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import wicket.Component;
+import wicket.MarkupContainer;
+import wicket.WicketRuntimeException;
+import wicket.markup.ComponentTag;
+import wicket.markup.MarkupException;
+import wicket.markup.MarkupStream;
+import wicket.markup.html.WebMarkupContainer;
+
+
+/**
+ * An Enclosure are automatically created by Wicket. Do not create it yourself.
+ * An Enclosure container is created if <wicket:enclosure> is found in the
+ * markup. It is meant to solve the following situation. Instead of
+ *
+ * <pre>
+ * <table wicket:id="label-container" class="notify"><tr><td><span wicket:id="label">[[notification]]</span></td></tr></table>
+ *
+ * WebMarkupContainer container=new WebMarkupContainer("label-container")
+ * {
+ * public boolean isVisible()
+ * {
+ * return hasNotification();
+ * }
+ * };
+ * add(container);
+ * container.add(new Label("label", notificationModel));
+ * </pre>
+ *
+ * with Enclosure you are able to do the following:
+ *
+ * <pre>
+ * <wicket:enclosure>
+ * <table class="notify"><tr><td><span wicket:id="label">[[notification]]</span></td></tr></table>
+ * </wicket:enclosure>
+ *
+ * add(new Label("label", notificationModel))
+ * {
+ * public boolean isVisible()
+ * {
+ * return hasNotification();
+ * }
+ * }
+ * </pre>
+ *
+ * @see EnclosureResolver
+ * @see EnclosureHandler
+ *
+ * @author Juergen Donnerstag
+ */
+public class Enclosure extends WebMarkupContainer
+{
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log = LogFactory.getLog(Enclosure.class);
+
+ /** The child component to delegate the isVisible() call to */
+ private Component childComponent;
+
+ /** Id of the child component that will control visibility of the enclosure */
+ private final CharSequence childId;
+
+ /**
+ * Construct.
+ *
+ * @param parent
+ * @param id
+ * @param childId
+ */
+ public Enclosure(final String id, final CharSequence childId)
+ {
+ super(id);
+ this.childId = childId;
+ }
+
+ /**
+ *
+ * @see wicket.MarkupContainer#isTransparentResolver()
+ */
+ public boolean isTransparentResolver()
+ {
+ return true;
+ }
+
+ /**
+ *
+ * @param childId
+ * @return Child Component
+ */
+ private Component getChildComponent(final CharSequence childId)
+ {
+ MarkupContainer parent = getParent();
+ while ((parent != null) && parent.isTransparentResolver())
+ {
+ parent = parent.getParent();
+ }
+
+ if (parent == null)
+ {
+ throw new WicketRuntimeException(
+ "Unable to find parent component which is not a transparent resolver");
+ }
+
+ if (childId == null)
+ {
+ throw new MarkupException(
+ "You most likely forgot to register the EnclosureHandler with the MarkupParserFactory");
+ }
+
+ final Component child = parent.get(childId.toString());
+ if (child == null)
+ {
+ throw new MarkupException("Didn't find child component of <wicket:enclosure> with id='"
+ + childId + "'. Component: " + this.toString());
+ }
+
+ return child;
+ }
+
+ /**
+ *
+ * @see wicket.MarkupContainer#onComponentTagBody(wicket.markup.MarkupStream,
+ * wicket.markup.ComponentTag)
+ */
+ protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
+ {
+ if (childComponent == null)
+ {
+ childComponent = getChildComponent(childId);
+ }
+
+ if (childComponent == this)
+ {
+ throw new WicketRuntimeException(
+ "Programming error: childComponent == enclose component; endless loop");
+ }
+ else if (childComponent != null)
+ {
+ // Delegate to child component
+ setVisible(childComponent.isVisible());
+ }
+
+ if (isVisible() == true)
+ {
+ super.onComponentTagBody(markupStream, openTag);
+ }
+ else
+ {
+ markupStream.skipUntil(openTag.getName());
+ }
+ }
+}
Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/parser/filter/EnclosureHandler.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/parser/filter/EnclosureHandler.java?view=auto&rev=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/parser/filter/EnclosureHandler.java (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/parser/filter/EnclosureHandler.java Wed Mar 28 00:19:30 2007
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.markup.parser.filter;
+
+import java.text.ParseException;
+import java.util.Stack;
+
+import wicket.markup.ComponentTag;
+import wicket.markup.MarkupElement;
+import wicket.markup.WicketTag;
+import wicket.markup.html.internal.Enclosure;
+import wicket.markup.parser.AbstractMarkupFilter;
+
+/**
+ * This is a markup inline filter. It identifies <wicket:enclosure> tags.
+ * If the 'child' attribute is empty it determines the wicket:id of the child
+ * component automatically by analysing the wicket component (in this case on
+ * one wicket component is allowed) in between the open and close tags. If the
+ * enclosure tag has a 'child' attribute like
+ * <code><wicket:enclosure child="xxx"></code> than more than just one
+ * wicket component inside the enclosure tags are allowed and the child
+ * component which determines the visibility of the enclosure is identified by
+ * the 'child' attribute value which must be equal to the relative child id
+ * path.
+ *
+ * @see EnclosureResolver
+ * @see Enclosure
+ *
+ * @author Juergen Donnerstag
+ */
+public final class EnclosureHandler extends AbstractMarkupFilter
+{
+ /** The child attribute */
+ public static final String CHILD_ATTRIBUTE = "child";
+
+ static
+ {
+ // register "wicket:enclosure"
+ WicketTagIdentifier.registerWellKnownTagName("enclosure");
+ }
+
+ /** Stack of <wicket:enclosure> tags */
+ private Stack/* <ComponentTag> */stack;
+
+ /** The id of the first wicket tag inside the enclosure */
+ private String childId;
+
+ /**
+ * Construct.
+ */
+ public EnclosureHandler()
+ {
+ }
+
+ /**
+ * @see wicket.markup.parser.IMarkupFilter#nextTag()
+ */
+ public final MarkupElement nextTag() throws ParseException
+ {
+ // Get the next tag from the next MarkupFilter in the chain.
+ // If null, no more tags are available
+ final ComponentTag tag = nextComponentTag();
+ if (tag == null)
+ {
+ return tag;
+ }
+
+ final boolean isWicketTag = tag instanceof WicketTag;
+ final boolean isEnclosureTag = isWicketTag && ((WicketTag)tag).isEnclosureTag();
+
+ // If wicket:enclosure
+ if (isEnclosureTag)
+ {
+ // If open tag, than put the tag onto the stack
+ if (tag.isOpen())
+ {
+ if (this.stack == null)
+ {
+ this.stack = new Stack/* <ComponentTag> */();
+ }
+ this.stack.push(tag);
+ }
+ // If close tag, than remove the tag from the stack and update
+ // the child attribute of the open tag if required
+ else if (tag.isClose())
+ {
+ if (this.stack == null)
+ {
+ throw new ParseException("Missing open tag for Enclosure: " + tag.toString(),
+ tag.getPos());
+ }
+
+ // Remove the open tag from the stack
+ ComponentTag lastEnclosure = (ComponentTag)this.stack.pop();
+
+ // If the child attribute has not been given by the user,
+ // than ...
+ if (this.childId != null)
+ {
+ lastEnclosure.put(CHILD_ATTRIBUTE, this.childId);
+ lastEnclosure.setModified(true);
+ this.childId = null;
+ }
+
+ if (this.stack.size() == 0)
+ {
+ this.stack = null;
+ }
+ }
+ else
+ {
+ throw new ParseException("Open-close tag not allowed for Enclosure: "
+ + tag.toString(), tag.getPos());
+ }
+ }
+ // Are we inside a wicket:enclosure tag?
+ else if ((tag.getId() != null) && (isWicketTag == false) && (stack != null))
+ {
+ ComponentTag lastEnclosure = (ComponentTag)this.stack.lastElement();
+
+ // If the enclosure tag has NO child attribute, than ...
+ if (lastEnclosure.getString(CHILD_ATTRIBUTE) == null)
+ {
+ // We encountered more than one child component inside
+ // the enclosure and are not able to automatically
+ // determine the child component to delegate the
+ // isVisible() to => Exception
+ if (this.childId != null)
+ {
+ throw new ParseException(
+ "Use <wicket:enclosure child='xxx'> to name the child component", tag
+ .getPos());
+ }
+ // Remember the child id. The open tag will be updated
+ // once the close tag is found. See above.
+ this.childId = tag.getId();
+ }
+ }
+
+ return tag;
+ }
+}
Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/resolver/EnclosureResolver.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/resolver/EnclosureResolver.java?view=auto&rev=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/resolver/EnclosureResolver.java (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/resolver/EnclosureResolver.java Wed Mar 28 00:19:30 2007
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.markup.resolver;
+
+import wicket.MarkupContainer;
+import wicket.markup.ComponentTag;
+import wicket.markup.MarkupStream;
+import wicket.markup.WicketTag;
+import wicket.markup.html.internal.Enclosure;
+import wicket.markup.parser.filter.EnclosureHandler;
+
+/**
+ * This is a tag resolver which automatically adds a Enclosure container for
+ * each <wicket:enclosure> tag. As this is no default resolver, it must be
+ * added manually:
+ *
+ * @see EnclosureHandler
+ * @see Enclosure
+ *
+ * @author Juergen Donnerstag
+ */
+public class EnclosureResolver implements IComponentResolver
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ *
+ * @see wicket.markup.resolver.IComponentResolver#resolve(wicket.MarkupContainer,
+ * wicket.markup.MarkupStream, wicket.markup.ComponentTag)
+ */
+ public boolean resolve(final MarkupContainer container, final MarkupStream markupStream,
+ final ComponentTag tag)
+ {
+ if ((tag instanceof WicketTag) && ((WicketTag)tag).isEnclosureTag())
+ {
+ String id = "enclosure-" + container.getPage().getAutoIndex();
+ final Enclosure enclosure = new Enclosure(id, tag
+ .getString(EnclosureHandler.CHILD_ATTRIBUTE));
+ container.autoAdd(enclosure);
+
+ // Yes, we handled the tag
+ return true;
+ }
+
+ // We were not able to handle the tag
+ return false;
+ }
+}
\ No newline at end of file
Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html?view=auto&rev=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePageExpectedResult_1.html Wed Mar 28 00:19:30 2007
@@ -0,0 +1,30 @@
+<html xmlns:wicket>
+<body>
+ <wicket:enclosure child="label1">
+ <table><tr><span wicket:id="label1">Test Label 1</span></tr></table>
+ </wicket:enclosure>
+
+ <wicket:enclosure child="label2">
+ <table><tr><span wicket:id="label2">Test Label 2</span></tr></table>
+ </wicket:enclosure>
+
+ <wicket:enclosure child="label3"></wicket:enclosure>
+
+ <wicket:enclosure child="label6">
+ <table><tr><span wicket:id="label4">Test Label 2</span></tr></table>
+ <table><tr><span wicket:id="label5">Test Label 2</span></tr></table>
+ <table><tr><span wicket:id="label6">Test Label 2</span></tr></table>
+ <table><tr><span wicket:id="label7">Test Label 2</span></tr></table>
+ </wicket:enclosure>
+
+ <wicket:enclosure child="container:label8">
+ <span wicket:id="container">
+ <span wicket:id="label8">Test Label 2</span>
+ </span>
+ </wicket:enclosure>
+
+ <wicket:enclosure child="label9">
+ <span wicket:id="label9">Test Label 2</span><p>
+ </wicket:enclosure>
+</body>
+</html>
Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.html?view=auto&rev=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.html (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.html Wed Mar 28 00:19:30 2007
@@ -0,0 +1,32 @@
+<html xmlns:wicket>
+<body>
+ <wicket:enclosure>
+ <table><tr><span wicket:id="label1">Test</span></tr></table>
+ </wicket:enclosure>
+
+ <wicket:enclosure child="label2">
+ <table><tr><span wicket:id="label2">Test</span></tr></table>
+ </wicket:enclosure>
+
+ <wicket:enclosure>
+ <table><tr><span wicket:id="label3">Test</span></tr></table>
+ </wicket:enclosure>
+
+ <wicket:enclosure child="label6">
+ <table><tr><span wicket:id="label4">Test</span></tr></table>
+ <table><tr><span wicket:id="label5">Test</span></tr></table>
+ <table><tr><span wicket:id="label6">Test</span></tr></table>
+ <table><tr><span wicket:id="label7">Test</span></tr></table>
+ </wicket:enclosure>
+
+ <wicket:enclosure child="container:label8">
+ <span wicket:id="container">
+ <span wicket:id="label8">Test</span>
+ </span>
+ </wicket:enclosure>
+
+ <wicket:enclosure>
+ <span wicket:id="label9">Test</span><p>
+ </wicket:enclosure>
+</body>
+</html>
Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.java?view=auto&rev=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.java (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosurePage_1.java Wed Mar 28 00:19:30 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.markup.html.internal;
+
+import wicket.markup.html.WebMarkupContainer;
+import wicket.markup.html.WebPage;
+import wicket.markup.html.basic.Label;
+
+
+/**
+ * Mock page for testing.
+ *
+ * @author Juergen Donnerstag
+ */
+public class EnclosurePage_1 extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Construct.
+ */
+ public EnclosurePage_1()
+ {
+ add(new Label("label1", "Test Label 1"));
+ add(new Label("label2", "Test Label 2"));
+ add(new Label("label3", "Test Label 3").setVisible(false));
+ add(new Label("label4", "Test Label 2"));
+ add(new Label("label5", "Test Label 2"));
+ add(new Label("label6", "Test Label 2"));
+ add(new Label("label7", "Test Label 2"));
+ WebMarkupContainer container = new WebMarkupContainer("container");
+ add(container);
+ container.add(new Label("label8", "Test Label 2"));
+ add(new Label("label9", "Test Label 2"));
+ }
+}
Added: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosureTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosureTest.java?view=auto&rev=523205
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosureTest.java (added)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/markup/html/internal/EnclosureTest.java Wed Mar 28 00:19:30 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package wicket.markup.html.internal;
+
+import wicket.WicketTestCase;
+import wicket.protocol.http.WebApplication;
+import wicket.resource.DummyApplication;
+import wicket.util.tester.WicketTester;
+
+/**
+ *
+ * @author Juergen Donnerstag
+ */
+public class EnclosureTest extends WicketTestCase
+{
+ /**
+ * Construct.
+ *
+ * @param name
+ */
+ public EnclosureTest(final String name)
+ {
+ super(name);
+ }
+
+ /**
+ *
+ * @see wicket.WicketTestCase#setUp()
+ */
+
+ protected void setUp() throws Exception
+ {
+ WebApplication app = new DummyApplication();
+ tester = new WicketTester(app);
+ }
+
+ /**
+ * @throws Exception
+ */
+ public void testRenderHomePage() throws Exception
+ {
+ executeTest(EnclosurePage_1.class, "EnclosurePageExpectedResult_1.html");
+ }
+}