You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2011/04/08 08:08:06 UTC

svn commit: r1090127 [2/2] - in /wicket/trunk/wicket-core/src: main/java/org/apache/wicket/ main/java/org/apache/wicket/ajax/ main/java/org/apache/wicket/markup/ main/java/org/apache/wicket/markup/html/internal/ main/java/org/apache/wicket/markup/parse...

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureTest.java?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureTest.java (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureTest.java Fri Apr  8 06:08:05 2011
@@ -0,0 +1,75 @@
+/*
+ * 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 org.apache.wicket.markup.html.internal;
+
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.util.tester.WicketTester;
+
+
+/**
+ * Simple test using the WicketTester
+ * 
+ * @author Joonas Hamalainen
+ */
+public class InlineEnclosureTest extends WicketTestCase
+{
+	/**
+	 * @throws Exception
+	 */
+	public void testInlineEnclosurePage_1() throws Exception
+	{
+		executeTest(InlineEnclosurePage_1.class, "InlineEnclosurePageExpectedResult_1.html");
+	}
+
+	/**
+	 * @throws Exception
+	 */
+	public void testInlineEnclosurePage_2() throws Exception
+	{
+		executeTest(InlineEnclosurePage_2.class, "InlineEnclosurePageExpectedResult_2.html");
+	}
+
+	/**
+	 * @throws Exception
+	 */
+	public void testInlineEnclosurePanelPage() throws Exception
+	{
+		executeTest(InlineEnclosurePanelPage.class, "InlineEnclosurePanelPageExpectedResult.html");
+	}
+
+	@Override
+	protected void setUp() throws Exception
+	{
+		WebApplication app = new WebApplication()
+		{
+			@Override
+			public Class<? extends Page> getHomePage()
+			{
+				return InlineEnclosurePage_1.class;
+			}
+
+			@Override
+			protected void init()
+			{
+				getMarkupSettings().setStripWicketTags(true);
+			}
+		};
+		tester = new WicketTester(app);
+	}
+}
\ No newline at end of file

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.html?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.html (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.html Fri Apr  8 06:08:05 2011
@@ -0,0 +1,15 @@
+<html xmlns:wicket>
+<body>
+
+<a href="#" wicket:id="toggleLink">Toggle visibility</a>
+
+<div wicket:enclosure="label1">
+ 	Container 1:
+ 	The visibility of this text is also toggled.
+	<div wicket:id="label1">Test</div>
+</div>
+
+	<div wicket:id="label2">Test2</div>
+
+</body>
+</html>

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.java?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.java (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/InlineEnclosureWithAdditionalAjaxTargetPage.java Fri Apr  8 06:08:05 2011
@@ -0,0 +1,89 @@
+/*
+ * 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 org.apache.wicket.markup.html.internal;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+
+
+/**
+ * Minimal page for testing.
+ * 
+ * @author Joonas Hamalainen
+ * 
+ */
+public class InlineEnclosureWithAdditionalAjaxTargetPage extends WebPage
+{
+	private final Label label1 = new Label("label1", "Test Label 1");
+	private final Label label2 = new Label("label2", "Test Label 2");
+	private final AjaxLink<Void> toggleLink;
+
+	/**
+	 * Construct.
+	 */
+	@SuppressWarnings("serial")
+	public InlineEnclosureWithAdditionalAjaxTargetPage()
+	{
+
+		toggleLink = new AjaxLink<Void>("toggleLink")
+		{
+			@Override
+			public void onClick(AjaxRequestTarget target)
+			{
+				label1.setVisible(!label1.isVisible());
+				target.addComponent(label1);
+				label2.setVisible(!label2.isVisible());
+				target.addComponent(label2);
+			}
+
+		};
+		add(toggleLink);
+		label1.setOutputMarkupId(true);
+		label2.setOutputMarkupId(true);
+		label2.setOutputMarkupPlaceholderTag(true);
+		add(label1);
+		add(label2);
+	}
+
+	/**
+	 * @return label1
+	 */
+	public Label getLabel1()
+	{
+		return label1;
+	}
+
+	/**
+	 * @return label2
+	 */
+	public Label getLabel2()
+	{
+		return label2;
+	}
+
+	/**
+	 * @return toggle link
+	 */
+	public AjaxLink<Void> getLink()
+	{
+		return toggleLink;
+	}
+
+
+}

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.html?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.html (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.html Fri Apr  8 06:08:05 2011
@@ -0,0 +1,10 @@
+<wicket:panel>
+	This is a simple test panel. This contains a label and an inline enclosure
+	with a label inside it.
+	<span wicket:id="label1">[some label]</span>
+	
+	<div wicket:enclosure="label2">
+		<span wicket:id="label2">[another label]</span>
+	</div>
+	
+</wicket:panel>
\ No newline at end of file

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.java?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.java (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/SimplePanel2.java Fri Apr  8 06:08:05 2011
@@ -0,0 +1,46 @@
+/*
+ * 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 org.apache.wicket.markup.html.internal;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
+
+/**
+ * Just a simple panel for testing purposes.
+ * 
+ * @author Joonas Hamalainen
+ */
+public class SimplePanel2 extends Panel
+{
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * simple constructor.
+	 * 
+	 * @param id
+	 */
+	public SimplePanel2(String id)
+	{
+		super(id);
+		add(new Label("label1", new Model<String>("Inside InlineEnclosure and Panel: hello world")));
+		add(new Label("label2", new Model<String>(
+			"Inside InlineEnclosure, Panel and another InlineEnclosure: hello again.")));
+	}
+
+}

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TogglePageTests.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TogglePageTests.java?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TogglePageTests.java (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TogglePageTests.java Fri Apr  8 06:08:05 2011
@@ -0,0 +1,226 @@
+/*
+ * 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 org.apache.wicket.markup.html.internal;
+
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.markup.html.basic.Label;
+
+
+/**
+ * Simple test using the WicketTester
+ */
+public class TogglePageTests extends WicketTestCase
+{
+
+
+	/**
+	 * 
+	 */
+	public void testNoAjaxPage()
+	{
+		{
+			// On
+			FullReloadPage noAjaxPage = (FullReloadPage)tester.startPage(FullReloadPage.class);
+			assertVisible(noAjaxPage.getToggleable());
+			tester.clickLink(noAjaxPage.getLink().getPageRelativePath());
+		}
+		{
+			// Off
+			FullReloadPage noAjaxPage = (FullReloadPage)tester.getLastRenderedPage();
+			assertInvisible(noAjaxPage.getToggleable());
+			tester.clickLink(noAjaxPage.getLink().getPageRelativePath());
+		}
+		{
+			// On
+			FullReloadPage noAjaxPage = (FullReloadPage)tester.getLastRenderedPage();
+			assertVisible(noAjaxPage.getToggleable());
+			tester.clickLink(noAjaxPage.getLink().getPageRelativePath());
+		}
+		{
+			// Off
+			FullReloadPage noAjaxPage = (FullReloadPage)tester.getLastRenderedPage();
+			assertInvisible(noAjaxPage.getToggleable());
+		}
+	}
+
+	/**
+	 * 
+	 */
+	public void testTraditionalAjaxEnclosurePage()
+	{
+		{
+			// On
+			TraditionalEnclosureAjaxPage ajaxPage = (TraditionalEnclosureAjaxPage)tester.startPage(TraditionalEnclosureAjaxPage.class);
+			assertVisible(ajaxPage.getToggleable());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// Off
+			TraditionalEnclosureAjaxPage ajaxPage = (TraditionalEnclosureAjaxPage)tester.getLastRenderedPage();
+			tester.assertComponentOnAjaxResponse(ajaxPage.getTraditionalAjaxVisibilityToggleRequiresPlaceholder());
+			assertInvisible(ajaxPage.getToggleable());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// On
+			TraditionalEnclosureAjaxPage ajaxPage = (TraditionalEnclosureAjaxPage)tester.getLastRenderedPage();
+			tester.assertComponentOnAjaxResponse(ajaxPage.getTraditionalAjaxVisibilityToggleRequiresPlaceholder());
+			assertVisible(ajaxPage.getToggleable());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// Off
+			TraditionalEnclosureAjaxPage ajaxPage = (TraditionalEnclosureAjaxPage)tester.getLastRenderedPage();
+			tester.assertComponentOnAjaxResponse(ajaxPage.getTraditionalAjaxVisibilityToggleRequiresPlaceholder());
+			assertInvisible(ajaxPage.getToggleable());
+		}
+	}
+
+	/**
+	 * 
+	 */
+	public void testInlineEnclosureWithAdditionalAjaxTarget()
+	{
+		{
+			// On
+			InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage = (InlineEnclosureWithAdditionalAjaxTargetPage)tester.startPage(InlineEnclosureWithAdditionalAjaxTargetPage.class);
+			assertVisible(ajaxPage.getLabel1());
+			assertVisible(ajaxPage.getLabel2());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// Off
+			InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage = (InlineEnclosureWithAdditionalAjaxTargetPage)tester.getLastRenderedPage();
+			tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
+			assertInVisible(ajaxPage.getLabel1());
+			assertInVisible(ajaxPage.getLabel2());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// On
+			InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage = (InlineEnclosureWithAdditionalAjaxTargetPage)tester.getLastRenderedPage();
+			tester.assertComponentOnAjaxResponse(ajaxPage.getLabel1());
+			tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
+			assertVisible(ajaxPage.getLabel1());
+			assertVisible(ajaxPage.getLabel2());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// Off
+			InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage = (InlineEnclosureWithAdditionalAjaxTargetPage)tester.getLastRenderedPage();
+			tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
+			assertInVisible(ajaxPage.getLabel1());
+			assertInVisible(ajaxPage.getLabel2());
+		}
+	}
+
+	/**
+	 * 
+	 */
+	public void testInlineEnclosureAjaxPage()
+	{
+		String inlineEnclosureIdPrefix = "InlineEnclosure-";
+
+		String inlineEnclosureHiddenPattern = "<tr id=\"" + inlineEnclosureIdPrefix +
+			"1\" style=\"display:none\"></tr>";
+
+		String inlineEnclosureVisiblePattern = "<tr bgcolor=\"red\" id=\"" +
+			inlineEnclosureIdPrefix + "1\">";
+
+		{
+			// On
+			InlineEnclosureAjaxPage ajaxPage = (InlineEnclosureAjaxPage)tester.startPage(InlineEnclosureAjaxPage.class);
+			assertVisible(ajaxPage.getToggleable());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// Off
+			InlineEnclosureAjaxPage ajaxPage = (InlineEnclosureAjaxPage)tester.getLastRenderedPage();
+			tester.assertContains(inlineEnclosureHiddenPattern);
+			assertInvisible(ajaxPage.getToggleable());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// On
+			InlineEnclosureAjaxPage ajaxPage = (InlineEnclosureAjaxPage)tester.getLastRenderedPage();
+			tester.assertContains(inlineEnclosureVisiblePattern);
+			assertVisible(ajaxPage.getToggleable());
+			tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
+		}
+		{
+			// Off
+			InlineEnclosureAjaxPage ajaxPage = (InlineEnclosureAjaxPage)tester.getLastRenderedPage();
+			tester.assertContains(inlineEnclosureHiddenPattern);
+			assertInvisible(ajaxPage.getToggleable());
+		}
+	}
+
+	private final String toggledText = "This button (and red border) should appear and disappear by pressing toggle";
+
+
+	/**
+	 * @param toggleable
+	 */
+	protected void assertInvisible(Component toggleable)
+	{
+		tester.assertInvisible(toggleable.getPageRelativePath());
+		assertDoesNotContain(toggledText);
+		assertDoesNotContain("Also this");
+	}
+
+	/**
+	 * @param toggleable
+	 */
+	protected void assertVisible(Component toggleable)
+	{
+		tester.assertVisible(toggleable.getPageRelativePath());
+		tester.assertContains(Pattern.quote(toggledText));
+		tester.assertContains(Pattern.quote("Also this"));
+	}
+
+
+	/**
+	 * @param label
+	 */
+	protected void assertVisible(Label label)
+	{
+		tester.assertVisible(label.getPageRelativePath());
+		tester.assertContains(Pattern.quote(label.getInnermostModel().getObject().toString()));
+	}
+
+	/**
+	 * @param label
+	 */
+	protected void assertInVisible(Label label)
+	{
+		tester.assertInvisible(label.getPageRelativePath());
+	}
+
+	/**
+	 * @param string
+	 */
+	private void assertDoesNotContain(String string)
+	{
+		assertFalse("Should not contain: " + string,
+			tester.getLastResponseAsString().contains(string));
+	}
+
+
+}
\ No newline at end of file

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.html?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.html (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.html Fri Apr  8 06:08:05 2011
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<table border="1" cellpadding="1" cellspacing="1">
+<tr><th>Header row</th></tr>
+<tr><td><a wicket:id="link">Toggle</a></td></tr>
+<wicket:enclosure child="toggleable-placeholder:toggleable">
+<tr wicket:id="toggleable-placeholder" bgcolor="red"><td><input wicket:id="toggleable" type="button" 
+	value="This button (and red border) should appear and disappear by pressing toggle"  
+style="border: 1px solid black; background: lightblue;"/>
+			(Also this)</td></tr>
+</wicket:enclosure>
+</table>
+<br clear="all"/>
+<br clear="all"/>
+With ajax toggle is also possible, but it requires extra work: when component is invisible, we need to manually create a dummy placeholder.  
+
+</body>
+</html>
\ No newline at end of file

Added: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.java?rev=1090127&view=auto
==============================================================================
--- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.java (added)
+++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/TraditionalEnclosureAjaxPage.java Fri Apr  8 06:08:05 2011
@@ -0,0 +1,102 @@
+/*
+ * 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 org.apache.wicket.markup.html.internal;
+
+import junit.framework.Assert;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.WebPage;
+
+
+/**
+ */
+public class TraditionalEnclosureAjaxPage extends WebPage
+{
+	/** */
+	private static final long serialVersionUID = 1L;
+	private final WebMarkupContainer traditionalAjaxVisibilityToggleRequiresPlaceholder;
+	private final String toggleableChildId;
+	private final WebMarkupContainer toggleable;
+	private final AjaxLink<Void> link;
+
+	/** 
+	 * 
+	 */
+	@SuppressWarnings("serial")
+	public TraditionalEnclosureAjaxPage()
+	{
+		add((traditionalAjaxVisibilityToggleRequiresPlaceholder = new WebMarkupContainer(
+			"toggleable-placeholder")
+		{
+			@Override
+			public boolean isVisible()
+			{
+				return get(toggleableChildId).isVisible();
+			}
+		}).setOutputMarkupPlaceholderTag(true));
+		Assert.assertEquals("Ajax requires tag to remain in DOM even if not visible", true,
+			traditionalAjaxVisibilityToggleRequiresPlaceholder.getOutputMarkupPlaceholderTag());
+		{
+			traditionalAjaxVisibilityToggleRequiresPlaceholder.add((toggleable = new WebMarkupContainer(
+				toggleableChildId = "toggleable")).setOutputMarkupPlaceholderTag(true));
+			add(link = new AjaxLink<Void>("link")
+			{
+				@Override
+				public void onClick(AjaxRequestTarget target)
+				{
+					toggleable.setVisible(!toggleable.isVisible());
+					ajaxRepaintOnlyToggleableComponentsContainer(target);
+				}
+			});
+		}
+	}
+
+	/**
+	 * @param target
+	 */
+	private void ajaxRepaintOnlyToggleableComponentsContainer(AjaxRequestTarget target)
+	{
+		target.addComponent(traditionalAjaxVisibilityToggleRequiresPlaceholder); // This is what we
+// repaint and toggleable is inside it
+	}
+
+	/**
+	 * @return toggleable webmarkupcontainer
+	 */
+	public WebMarkupContainer getToggleable()
+	{
+		return toggleable;
+	}
+
+	/**
+	 * @return toggle link
+	 */
+	public AjaxLink<Void> getLink()
+	{
+		return link;
+	}
+
+	/**
+	 * @return the traditional placeholder
+	 */
+	public WebMarkupContainer getTraditionalAjaxVisibilityToggleRequiresPlaceholder()
+	{
+		return traditionalAjaxVisibilityToggleRequiresPlaceholder;
+	}
+}
\ No newline at end of file