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 2010/11/27 10:56:38 UTC
svn commit: r1039637 - in /wicket/trunk/wicket/src:
main/java/org/apache/wicket/ main/java/org/apache/wicket/markup/html/panel/
test/java/org/apache/wicket/markup/html/header/testing3/
test/java/org/apache/wicket/markup/html/markupId/ test/java/org/apa...
Author: jdonnerstag
Date: Sat Nov 27 09:56:37 2010
New Revision: 1039637
URL: http://svn.apache.org/viewvc?rev=1039637&view=rev
Log:
fixed WICKET-3197: addOrReplace() failed with exception while copying markupId
Issue: WICKET-3197
Added:
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.html
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/TestHomePage.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/WicketApplication.java
Removed:
wicket/trunk/wicket/src/test/java/org/apache/wicket/ng/page/persistent/
wicket/trunk/wicket/src/test/java/org/apache/wicket/ng/request/mapper/
wicket/trunk/wicket/src/test/java/org/apache/wicket/ng/test/
wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/header/testing3/TestPage_ExpectedResult-2.html
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java?rev=1039637&r1=1039636&r2=1039637&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/Component.java Sat Nov 27 09:56:37 2010
@@ -64,6 +64,7 @@ import org.apache.wicket.request.resourc
import org.apache.wicket.settings.IDebugSettings;
import org.apache.wicket.util.IHierarchical;
import org.apache.wicket.util.convert.IConverter;
+import org.apache.wicket.util.lang.Args;
import org.apache.wicket.util.lang.Classes;
import org.apache.wicket.util.lang.WicketObjects;
import org.apache.wicket.util.string.ComponentStrings;
@@ -224,8 +225,6 @@ public abstract class Component
IEventSink,
IEventSource
{
-
-
/** Log. */
private static final Logger log = LoggerFactory.getLogger(Component.class);
@@ -2775,6 +2774,21 @@ public abstract class Component
}
/**
+ * Copy markupId
+ *
+ * @param comp
+ */
+ final void setMarkupId(Component comp)
+ {
+ Args.notNull(comp, "comp");
+
+ generatedMarkupId = comp.generatedMarkupId;
+ setMetaData(MARKUP_ID_KEY, comp.getMetaData(MARKUP_ID_KEY));
+ setOutputMarkupId(comp.getOutputMarkupId());
+ return;
+ }
+
+ /**
* Sets this component's markup id to a user defined value. It is up to the user to ensure this
* value is unique.
* <p>
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java?rev=1039637&r1=1039636&r2=1039637&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/MarkupContainer.java Sat Nov 27 09:56:37 2010
@@ -804,7 +804,7 @@ public abstract class MarkupContainer ex
addedComponent(child);
// The generated markup id remains the same
- child.setMarkupIdImpl(replaced.getMarkupIdImpl());
+ child.setMarkupId(replaced);
}
return this;
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java?rev=1039637&r1=1039636&r2=1039637&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/panel/Panel.java Sat Nov 27 09:56:37 2010
@@ -106,6 +106,13 @@ public abstract class Panel extends WebM
// <span wicket:id="myPanel">...</span>
tag.setType(XmlTag.OPEN);
}
+
+// IMarkupFragment markup = getMarkup(null);
+// ComponentTag panelTag = (ComponentTag)markup.get(0);
+// for (String key : panelTag.getAttributes().keySet())
+// {
+// tag.append(key, panelTag.getAttribute(key), ", ");
+// }
super.onComponentTag(tag);
}
Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/header/testing3/TestPage_ExpectedResult-2.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/header/testing3/TestPage_ExpectedResult-2.html?rev=1039637&r1=1039636&r2=1039637&view=diff
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/header/testing3/TestPage_ExpectedResult-2.html (original)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/header/testing3/TestPage_ExpectedResult-2.html Sat Nov 27 09:56:37 2010
@@ -4,7 +4,7 @@
<title>test page</title>
</head>
<body>
- <span wicket:id="panel" id="panel1"><wicket:panel>
+ <span wicket:id="panel"><wicket:panel>
Panel 2
</wicket:panel></span>
<a wicket:id="link" href="../page?1-2.ILinkListener-link">Replace the panel</a>
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.html?rev=1039637&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.html (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.html Sat Nov 27 09:56:37 2010
@@ -0,0 +1,24 @@
+<!--
+ ====================================================================
+ 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 xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.5-strict.dtd" >
+ <head>
+ <title>Wicket Quickstart Archetype Homepage</title>
+ </head>
+ <body>
+ <strong>Wicket Quickstart Archetype Homepage</strong>
+ <br/><br/>
+ <span wicket:id="message">message will be here</span>
+ </body>
+</html>
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.java?rev=1039637&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/HomePage.java Sat Nov 27 09:56:37 2010
@@ -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.markupId;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+
+/**
+ * Homepage
+ */
+public class HomePage extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor that is invoked when page is invoked without a session.
+ *
+ * @param parameters
+ * Page parameters
+ */
+ public HomePage(final PageParameters parameters)
+ {
+ // Add the simplest type of label
+ add(new MyPanel("message"));
+
+// addOrReplace(new MyPanel("message"));
+ }
+}
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.html
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.html?rev=1039637&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.html (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.html Sat Nov 27 09:56:37 2010
@@ -0,0 +1,5 @@
+<wicket:panel>
+
+ <span wicket:id="label">aaa</span>
+
+</wicket:panel>
\ No newline at end of file
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.java?rev=1039637&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/MyPanel.java Sat Nov 27 09:56:37 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.markupId;
+
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.panel.Panel;
+
+public class MyPanel extends Panel
+{
+ public MyPanel(String id)
+ {
+ super(id);
+
+ add(new Label("label", "text"));
+
+ addOrReplace(new Label("label", "text"));
+ }
+}
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/TestHomePage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/TestHomePage.java?rev=1039637&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/TestHomePage.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/TestHomePage.java Sat Nov 27 09:56:37 2010
@@ -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.markupId;
+
+import junit.framework.TestCase;
+
+import org.apache.wicket.util.tester.WicketTester;
+
+/**
+ * Simple test using the WicketTester
+ */
+public class TestHomePage extends TestCase
+{
+ private WicketTester tester;
+
+ @Override
+ public void setUp()
+ {
+ tester = new WicketTester(new WicketApplication());
+ }
+
+ public void testRenderMyPage()
+ {
+ // start and render the test page
+ tester.startPage(HomePage.class);
+
+ // assert rendered page class
+ tester.assertRenderedPage(HomePage.class);
+ }
+}
Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/WicketApplication.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/WicketApplication.java?rev=1039637&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/WicketApplication.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/markupId/WicketApplication.java Sat Nov 27 09:56:37 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.markupId;
+
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * Application object for your web application. If you want to run this application without
+ * deploying, run the Start class.
+ *
+ * @see com.mycompany.Start#main(String[])
+ */
+public class WicketApplication extends WebApplication
+{
+ /**
+ * Constructor
+ */
+ public WicketApplication()
+ {
+ }
+
+ /**
+ * @see org.apache.wicket.Application#getHomePage()
+ */
+ @Override
+ public Class<HomePage> getHomePage()
+ {
+ return HomePage.class;
+ }
+
+}