Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_9.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_9.java?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_9.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_9.java Sat Oct 3 10:13:18 2009 @@ -0,0 +1,44 @@ +/* + * 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.baseBorder; + +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.border.BaseBorder; +import org.apache.wicket.markup.html.panel.Fragment; + + +/** + * Mock page for testing. + */ +public class BoxBorderTestPage_9 extends WebPage +{ + private static final long serialVersionUID = 1L; + + /** + * Construct. + * + * + */ + public BoxBorderTestPage_9() + { + BaseBorder myBorder = new BorderComponent1("myBorder"); + add(myBorder); + + Fragment panel1 = new Fragment("fragmentsWillBeRenderedHere", "fragmentSource", this); + myBorder.addToBorder(panel1); + } +}
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_1.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_1.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_1.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_1.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,28 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<html> +<body> +<span wicket:id="border1"><wicket:border> +<!-- with open-close tag --> +davor <wicket:body>middle-1</wicket:body> danach +</wicket:border></span><!-- test --> +<span wicket:id="border2"><wicket:border> +<!-- with separate open and close tag. Body is treated as pre-view region and + will be removed from output +--> +davor <wicket:body>middle-2</wicket:body> danach +</wicket:border></span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_10.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_10.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_10.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_10.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,28 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<html> +<body> +<span wicket:id="border1"><wicket:border> +<!-- with open-close tag --> +davor <wicket:body>middle-1</wicket:body> danach +</wicket:border></span> +<span wicket:id="border2"><wicket:border> +<!-- with separate open and close tag. Body is treated as pre-view region and + will be removed from output +--> +davor <wicket:body>middle-2</wicket:body> danach +</wicket:border></span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_11.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_11.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_11.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_11.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,27 @@ +<!-- + ==================================================================== + Licensed 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. +--> +<html> +<body> + <span wicket:id="border"><wicket:border> + <h3 class="collapse" wicket:id="title" onclick="var win = this.ownerDocument.defaultView || this.ownerDocument.parentWindow; if (win == window) { window.location.href='?wicket:interface=:0:border:title::ILinkListener::'; } ;return false"> + <span class="label" wicket:id="titleLabel">model</span> + <a class="foldicon"> </a> + </h3> + <wicket:body> + <div wicket:id="label">my test</div> + </wicket:body> +</wicket:border></span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_2.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_2.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_2.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_2.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,23 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<body> + <span wicket:id="box"><wicket:border> + <table width = "0%" border = "0" cellspacing = "0" cellpadding = "1" bgcolor = "black"> + <tr> + <td width = "100%" valign = "top"> + <table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" bgcolor = "white"> + <tr> + <td width = "100%"> + <wicket:body> + this is inside box: <input wicket:id="text" type="text" value="" name="box:box_body:text"/><br/> + <img wicket:id="img" src="resources/org.apache.wicket.markup.html.baseBorder.BoxBaseBorder/test.png"/> + </wicket:body> + </td> + </tr> + </table> + </td> + </tr> + </table> + </wicket:border></span> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_3.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_3.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_3.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_3.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,12 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<body> + <span wicket:id="border"><wicket:border> + <form wicket:id="myForm" id="myForm1" method="post" action="?wicket:interface=:0:border:myForm::IFormSubmitListener::"><div style="display:none"><input type="hidden" name="myForm1_hf_0" id="myForm1_hf_0" /></div> + <wicket:body> + <input type="text" wicket:id="name" value="" name="border_body:name"/> + </wicket:body> + </form> +</wicket:border></span> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_5.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_5.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_5.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_5.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,27 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<body> + <span wicket:id="border"><wicket:border> + <!-- A border within a bordered page --> + <span wicket:id="boxBorder"><wicket:border> + <table width = "0%" border = "0" cellspacing = "0" cellpadding = "1" bgcolor = "black"> + <tr> + <td width = "100%" valign = "top"> + <table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" bgcolor = "white"> + <tr> + <td width = "100%"> + <wicket:body> + <wicket:body> + Text + </wicket:body> + </wicket:body> + </td> + </tr> + </table> + </td> + </tr> + </table> + </wicket:border></span> + </wicket:border></span> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_6.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_6.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_6.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_6.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,38 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<body> + <span wicket:id="border1"><wicket:border> + <table width = "0%" border = "0" cellspacing = "0" cellpadding = "1" bgcolor = "black"> + <tr> + <td width = "100%" valign = "top"> + <table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" bgcolor = "white"> + <tr> + <td width = "100%"> + <wicket:body> + <span wicket:id="border2"><wicket:border> + <table width = "0%" border = "0" cellspacing = "0" cellpadding = "1" bgcolor = "black"> + <tr> + <td width = "100%" valign = "top"> + <table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" bgcolor = "white"> + <tr> + <td width = "100%"> + <wicket:body> + Text + </wicket:body> + </td> + </tr> + </table> + </td> + </tr> + </table> + </wicket:border></span> + </wicket:body> + </td> + </tr> + </table> + </td> + </tr> + </table> + </wicket:border></span> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_7.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_7.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_7.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_7.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,11 @@ + +<html> +<body> +<span> +davor middle-1 danach +</span> +<span> +davor middle-2 danach +</span> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_8.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_8.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_8.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_8.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,14 @@ +<html> +<body> +<span wicket:id="border1"><wicket:border> +<!-- with open-close tag --> +davor <wicket:body> + + middle-1 + <span wicket:id="panel1">This is the content of fragment 1</span> + <span wicket:id="panel2">fragment 2222222</span> +</wicket:body> danach +</wicket:border></span> + +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_9.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_9.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_9.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/BoxBorderTestPage_ExpectedResult_9.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,18 @@ +<html> +<body> +<div wicket:id="myBorder"><wicket:border> +<!-- with open-close tag --> +davor <wicket:body> + <table> + + ... + <tr wicket:id="fragmentsWillBeRenderedHere"> + <tr> + <td>Hello world</td> + </tr> + </tr> + </table> +</wicket:body> danach +</wicket:border></div> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/ComponentBorderTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/ComponentBorderTest.java?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/ComponentBorderTest.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/ComponentBorderTest.java Sat Oct 3 10:13:18 2009 @@ -0,0 +1,91 @@ +/* + * 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.baseBorder; + +import org.apache.wicket.Page; +import org.apache.wicket.WicketTestCase; +import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.border.BaseBorder; + +/** + * @author jcompagner + */ +public class ComponentBorderTest extends WicketTestCase +{ + /** + * Create the test. + * + * @param name + * The test name + */ + public ComponentBorderTest(String name) + { + super(name); + } + + /** + * Tests component use check does not fail when border starts out hidden + * + * @throws Exception + */ + public void testComponentUseCheck() throws Exception + { + /* + * Suppose: + * + * <div wicket:id="border"><div wicket:id="label"></div> suppose border->label and border's + * body is hidden. + * + * The label is added to border not to its hidden body so as far as wicket is concerned + * label is visible in hierarchy, but when rendering label wont be rendered because in the + * markup it is inside the border's hidden body. Thus component use check will fail even + * though it shouldnt - make sure it doesnt. + */ + tester.getApplication().getDebugSettings().setComponentUseCheck(true); + + HideableBorderPage page = new HideableBorderPage(); + // start with border body hidden + page.getBorder().setHidden(true); + + tester.startPage(page); + tester.assertRenderedPage(HideableBorderPage.class); + } + + /** + * + * @throws Exception + */ + public void testHideableBorder() throws Exception + { + executeTest(HideableBorderPage.class, "HideableBorderPage_ExpectedResult.html"); + + Page page = tester.getLastRenderedPage(); + BaseBorder border = (BaseBorder)page.get("hideable"); + assertNotNull(border); + AjaxLink link = (AjaxLink)border.get("hideLink"); + assertNotNull(link); + WebMarkupContainer wrapper = (WebMarkupContainer)border.get("wrapper"); + assertNotNull(wrapper); + tester.clickLink("hideable:hideLink"); + String ajaxResponse = tester.getServletResponse().getDocument(); + tester.assertComponentOnAjaxResponse(wrapper); + tester.clickLink("hideable:hideLink"); + ajaxResponse = tester.getServletResponse().getDocument(); + tester.assertComponentOnAjaxResponse(wrapper); + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,5 @@ +<wicket:border> + <form wicket:id="myForm"> + <wicket:body/> + </form> +</wicket:border> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.java?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/FormBorder.java Sat Oct 3 10:13:18 2009 @@ -0,0 +1,60 @@ +/* + * 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.baseBorder; + +import org.apache.wicket.Component; +import org.apache.wicket.MarkupContainer; +import org.apache.wicket.markup.html.border.BaseBorder; +import org.apache.wicket.markup.html.form.Form; + + +/** + * Test the component: PageView + * + * @author Juergen Donnerstag + */ +public class FormBorder extends BaseBorder +{ + private static final long serialVersionUID = 1L; + + private final Form form; + + /** + * + * @param id + */ + public FormBorder(final String id) + { + super(id); + + form = new Form<Void>("myForm"); + add(form); + + form.add(getBodyContainer()); + } + + /** + * + * @param child + * @return MarkupContainer + */ + public MarkupContainer addToForm(final Component child) + { + form.add(child); + return this; + } +} \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,10 @@ +<html xmlns:wicket> +<body> +<wicket:border> + <a wicket:id="hideLink">Hide contents</a> + <div wicket:id="wrapper"> + <wicket:body></wicket:body> + </div> +</wicket:border> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.java?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorder.java Sat Oct 3 10:13:18 2009 @@ -0,0 +1,84 @@ +/* + * 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.baseBorder; + +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.border.BaseBorder; + +/** + * + */ +public class HideableBorder extends BaseBorder +{ + private static final long serialVersionUID = 1L; + + private boolean hidden = false; + + /** + * Construct. + * + * @param name + */ + public HideableBorder(String name) + { + super(name); + final WebMarkupContainer containerWrapper = new WebMarkupContainer("wrapper") + { + private static final long serialVersionUID = 1L; + + @Override + public boolean isVisible() + { + return !hidden; + } + }; + add(containerWrapper); + containerWrapper.add(getBodyContainer()); + add(new AjaxLink("hideLink") + { + private static final long serialVersionUID = 1L; + + @Override + public void onClick(AjaxRequestTarget target) + { + hidden = !hidden; + target.addComponent(containerWrapper); + } + }); + containerWrapper.setOutputMarkupPlaceholderTag(true); + } + + /** + * @return true if body of this border is hidden + */ + public boolean isHidden() + { + return hidden; + } + + /** + * @param hidden + */ + public void setHidden(boolean hidden) + { + this.hidden = hidden; + } + + +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,7 @@ +<html xmlns:wicket> +<body> + <div wicket:id="hideable"> + Contents <span wicket:id="content"></span> + </div> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.java?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage.java Sat Oct 3 10:13:18 2009 @@ -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.baseBorder; + +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; + +/** + * + */ +public class HideableBorderPage extends WebPage +{ + private static final long serialVersionUID = 1L; + + private final HideableBorder border; + + /** + * Construct. + */ + public HideableBorderPage() + { + border = new HideableBorder("hideable"); + add(border); + border.addToBorder(new Label("content", "label")); + } + + /** @return hideable border */ + public HideableBorder getBorder() + { + return border; + } +} Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage_ExpectedResult.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage_ExpectedResult.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage_ExpectedResult.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/HideableBorderPage_ExpectedResult.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,19 @@ +<html xmlns:wicket> +<head><script type="text/javascript" src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script> +<script type="text/javascript" src="resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js"></script> +<script type="text/javascript" src="resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script> +<script type="text/javascript" id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/ +wicketAjaxDebugEnable=true; +/*-->]]>*/</script> + +</head><body> + <div wicket:id="hideable"><wicket:border> + <a href="#" wicket:id="hideLink" onclick="var wcall=wicketAjaxGet('?wicket:interface=:0:hideable:hideLink::IBehaviorListener:0:',null,null, function() {return Wicket.$('hideLink1') != null;}.bind(this));return !wcall;" id="hideLink1">Hide contents</a> + <div wicket:id="wrapper" id="wrapper2"> + <wicket:body> + Contents <span wicket:id="content">label</span> + </wicket:body> + </div> +</wicket:border></div> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,6 @@ +<html> +<body> +<span wicket:id="label"></span> +<span wicket:id="label2"></span> +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage_ExpectedResult.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage_ExpectedResult.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage_ExpectedResult.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MarkupComponentBorderTestPage_ExpectedResult.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,6 @@ +<html> +<body> +[[<span wicket:id="label">label</span>]] +[[<span wicket:id="label2">label2</span>]] +</body> +</html> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,10 @@ +<html xmlns:wicket="http://wicket.apache.org/"> +<body> + <wicket:border> + <!-- A border within a bordered page --> + <span wicket:id = "boxBorder"> + <wicket:body/> + </span> + </wicket:border> +</body> +</html> Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.java?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/MyApplicationBorder.java Sat Oct 3 10:13:18 2009 @@ -0,0 +1,42 @@ +/* + * 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.baseBorder; + +import org.apache.wicket.markup.html.border.BaseBorder; + + +/** + * + * @author Juergen Donnerstag + */ +public class MyApplicationBorder extends BaseBorder +{ + private static final long serialVersionUID = 1L; + + /** + * @param id + */ + public MyApplicationBorder(final String id) + { + super(id); + + BaseBorder border = new BoxBaseBorder("boxBorder"); + add(border); + + border.add(getBodyContainer()); + } +} \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.html?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.html (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.html Sat Oct 3 10:13:18 2009 @@ -0,0 +1,8 @@ + +<wicket:border> + <h3 class="collapse" wicket:id="title"> + <span class="label" wicket:id="titleLabel">Panel Title</span> + <a class="foldicon"> </a> + </h3> + <wicket:body /> +</wicket:border> \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.java?rev=821287&view=auto ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.java (added) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/TogglePanel.java Sat Oct 3 10:13:18 2009 @@ -0,0 +1,61 @@ +/* + * 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.baseBorder; + +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.border.BaseBorder; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.IModel; + + +/** + * Test the component: PageView + * + * @author Juergen Donnerstag + */ +public class TogglePanel extends BaseBorder +{ + private static final long serialVersionUID = 1L; + + private boolean expanded = true; + + /** + * Construct. + * + * @param id + * @param titleModel + */ + public TogglePanel(String id, IModel<String> titleModel) + { + super(id, titleModel); + + Link<Void> link = new Link<Void>("title") + { + private static final long serialVersionUID = 1L; + + @Override + public void onClick() + { + expanded = !expanded; + getBodyContainer().setVisible(expanded); + } + }; + link.add(new Label("titleLabel", titleModel)); + + add(link); + } +} \ No newline at end of file Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/test.png URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/test.png?rev=821287&view=auto ============================================================================== Binary file - no diff available. Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/baseBorder/test.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java?rev=821287&r1=821286&r2=821287&view=diff ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markupFragments/MarkupFragmentTest.java Sat Oct 3 10:13:18 2009 @@ -23,6 +23,7 @@ import org.apache.wicket.Page; import org.apache.wicket.WicketTestCase; import org.apache.wicket.markup.IMarkupFragment; +import org.apache.wicket.markup.html.WebComponent; import org.apache.wicket.markup.html.border.Border; import org.apache.wicket.markup.html.panel.Fragment; import org.apache.wicket.markup.html.panel.InlinePanelPage_1; @@ -157,6 +158,9 @@ assertNull(border.getBodyContainer().getAssociatedMarkup()); markup = border.getBodyContainer().getMarkup(); + compare(markup, "<span wicket:id=\"border\">test</span>"); + + markup = border.getBodyContainer().getParent().getMarkup(new WebComponent("_body")); compare(markup, "<wicket:body/>"); // getMarkup(null) returns the markup which is used to find a child component @@ -187,9 +191,13 @@ assertNull(border.getBodyContainer().getAssociatedMarkup()); - markup = border.getBodyContainer().getMarkup(); + // See explanation in BaseBorder.BorderBodyContainer.getMarkup() + markup = border.getBodyContainer().getParent().getMarkup(new WebComponent("_body")); compare(markup, "<wicket:body>333</wicket:body>"); + markup = border.getBodyContainer().getMarkup(); + compare(markup, "<span wicket:id=\"border2\">test</span>"); + // getMarkup(null) returns the markup which is used to find a child component markup = border.getBodyContainer().getMarkup(null); compare(markup, "<span wicket:id=\"border2\">test</span>");
