You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/05/06 13:16:42 UTC
[1/5] git commit: Fix for WICKET-4852
Updated Branches:
refs/heads/master af899fcb4 -> 4c43ad591
Fix for WICKET-4852
Modified FeedbackPanel as per comments of the issue.
Modified default css files to reflect this changes.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/5bdc0f44
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/5bdc0f44
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/5bdc0f44
Branch: refs/heads/master
Commit: 5bdc0f44bac4dcba1e9cdcf35de2ac319b342bc4
Parents: af899fc
Author: Cedric Gatay <ce...@gatay.fr>
Authored: Thu May 2 20:33:38 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 6 14:15:25 2013 +0300
----------------------------------------------------------------------
.../wicket-threadtest/src/main/webapp/style.css | 6 +-
.../wicket/markup/html/panel/FeedbackPanel.java | 38 +++++++++++++--
wicket-examples/src/main/webapp/style.css | 6 +-
wicket-examples/src/main/webapp/style_fa_IR.css | 6 +-
4 files changed, 42 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/5bdc0f44/testing/wicket-threadtest/src/main/webapp/style.css
----------------------------------------------------------------------
diff --git a/testing/wicket-threadtest/src/main/webapp/style.css b/testing/wicket-threadtest/src/main/webapp/style.css
index 799b336..2169908 100644
--- a/testing/wicket-threadtest/src/main/webapp/style.css
+++ b/testing/wicket-threadtest/src/main/webapp/style.css
@@ -44,13 +44,13 @@ h1,h2,h3,h4,h5,h6,h7,h8 {
margin: 5px;
}
-.feedbackPanelERROR {
+ul.feedbackPanel li.alert-error {
color: red;
list-style: circle;
font-weight: bold;
}
-.feedbackPanelINFO {
+ul.feedbackPanel li.alert-info {
color: green;
list-style: circle;
font-weight: bold;
@@ -143,7 +143,7 @@ a.none {
width: 300px;
}
-#feedbackPanel {
+ul.feedbackPanel {
width: 600px;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/5bdc0f44/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
index 3ff96fb..46a1a41 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
@@ -99,11 +99,25 @@ public class FeedbackPanel extends Panel implements IFeedback
final Component label = newMessageDisplayComponent("message", message);
final AttributeModifier levelModifier = AttributeModifier.append("class",
getCSSClass(message));
- label.add(levelModifier);
listItem.add(levelModifier);
listItem.add(label);
}
- }
+
+ /**
+ * WICKET-4831 - Overridable to allow customization
+ *
+ * @param index
+ * The index of the item
+ * @param itemModel
+ * object in the list that the item represents
+ * @return
+ */
+ @Override
+ protected ListItem<FeedbackMessage> newItem(int index, IModel<FeedbackMessage> itemModel)
+ {
+ return FeedbackPanel.this.newMessageItem(index, itemModel);
+ }
+ }
private static final long serialVersionUID = 1L;
@@ -272,12 +286,13 @@ public class FeedbackPanel extends Panel implements IFeedback
*
* @param message
* the message
- * @return the css class; by default, this returns feedbackPanel + the message level, eg
- * 'feedbackPanelERROR', but you can override this method to provide your own
+ * @return the css class; by default, this returns 'alert-' + the message
+ * level in lowercase, eg 'alert-error', but you can override this
+ * method to provide your own
*/
protected String getCSSClass(final FeedbackMessage message)
{
- return "feedbackPanel" + message.getLevelAsString();
+ return "alert-" + message.getLevelAsString().toLowerCase();
}
/**
@@ -323,4 +338,17 @@ public class FeedbackPanel extends Panel implements IFeedback
label.setEscapeModelStrings(FeedbackPanel.this.getEscapeModelStrings());
return label;
}
+
+ /**
+ * Allows to define the listItem to use in the feedback's message list.
+ *
+ * @param index
+ * The index of the item
+ * @param itemModel
+ * The model object of the item
+ * @return Container that holds components of the feedback MessageListView.
+ */
+ protected ListItem<FeedbackMessage> newMessageItem(int index, IModel<FeedbackMessage> itemModel){
+ return new ListItem<>(index, itemModel);
+ }
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/5bdc0f44/wicket-examples/src/main/webapp/style.css
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/style.css b/wicket-examples/src/main/webapp/style.css
index ea81568..95aafa8 100644
--- a/wicket-examples/src/main/webapp/style.css
+++ b/wicket-examples/src/main/webapp/style.css
@@ -53,13 +53,13 @@ h1,h2 {
margin: 5px;
}
-.feedbackPanelERROR {
+ul.feedbackPanel li.alert-error {
color: red;
list-style: circle;
font-weight: bold;
}
-.feedbackPanelINFO {
+ul.feedbackPanel li.alert-info {
color: green;
list-style: circle;
font-weight: bold;
@@ -162,7 +162,7 @@ a.none {
width: 300px;
}
-#feedbackPanel {
+ul.feedbackPanel {
width: 600px;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/5bdc0f44/wicket-examples/src/main/webapp/style_fa_IR.css
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/style_fa_IR.css b/wicket-examples/src/main/webapp/style_fa_IR.css
index 956d6ce..8631e2f 100644
--- a/wicket-examples/src/main/webapp/style_fa_IR.css
+++ b/wicket-examples/src/main/webapp/style_fa_IR.css
@@ -44,13 +44,13 @@ h1,h2,h3,h4,h5,h6,h7,h8 {
margin: 5px;
}
-.feedbackPanelERROR {
+ul.feedbackPanel li.alert-error {
color: red;
list-style: circle;
font-weight: bold;
}
-.feedbackPanelINFO {
+ul.feedbackPanel li.alert-info {
color: green;
list-style: circle;
font-weight: bold;
@@ -145,7 +145,7 @@ a.none {
width: 300px;
}
-#feedbackPanel {
+ul.feedbackPanel {
width: 600px;
}
[2/5] git commit: Fix for WICKET-4852
Posted by mg...@apache.org.
Fix for WICKET-4852
Reverted CSS class changes
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/9263a807
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/9263a807
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/9263a807
Branch: refs/heads/master
Commit: 9263a807bc0411128e8f57757642a24a05a26ce7
Parents: 5bdc0f4
Author: Cedric Gatay <ce...@gatay.fr>
Authored: Thu May 2 22:42:41 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 6 14:15:46 2013 +0300
----------------------------------------------------------------------
.../wicket-threadtest/src/main/webapp/style.css | 4 ++--
.../wicket/markup/html/panel/FeedbackPanel.java | 7 +++----
wicket-examples/src/main/webapp/style.css | 4 ++--
wicket-examples/src/main/webapp/style_fa_IR.css | 4 ++--
4 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/9263a807/testing/wicket-threadtest/src/main/webapp/style.css
----------------------------------------------------------------------
diff --git a/testing/wicket-threadtest/src/main/webapp/style.css b/testing/wicket-threadtest/src/main/webapp/style.css
index 2169908..32bb04f 100644
--- a/testing/wicket-threadtest/src/main/webapp/style.css
+++ b/testing/wicket-threadtest/src/main/webapp/style.css
@@ -44,13 +44,13 @@ h1,h2,h3,h4,h5,h6,h7,h8 {
margin: 5px;
}
-ul.feedbackPanel li.alert-error {
+ul.feedbackPanel li.feedbackPanelERROR {
color: red;
list-style: circle;
font-weight: bold;
}
-ul.feedbackPanel li.alert-info {
+ul.feedbackPanel li.feedbackPanelINFO {
color: green;
list-style: circle;
font-weight: bold;
http://git-wip-us.apache.org/repos/asf/wicket/blob/9263a807/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
index 46a1a41..fd4b28d 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
@@ -286,13 +286,12 @@ public class FeedbackPanel extends Panel implements IFeedback
*
* @param message
* the message
- * @return the css class; by default, this returns 'alert-' + the message
- * level in lowercase, eg 'alert-error', but you can override this
- * method to provide your own
+ * @return the css class; by default, this returns feedbackPanel + the message level, eg
+ * 'feedbackPanelERROR', but you can override this method to provide your own
*/
protected String getCSSClass(final FeedbackMessage message)
{
- return "alert-" + message.getLevelAsString().toLowerCase();
+ return "feedbackPanel" + message.getLevelAsString();
}
/**
http://git-wip-us.apache.org/repos/asf/wicket/blob/9263a807/wicket-examples/src/main/webapp/style.css
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/style.css b/wicket-examples/src/main/webapp/style.css
index 95aafa8..cb1453a 100644
--- a/wicket-examples/src/main/webapp/style.css
+++ b/wicket-examples/src/main/webapp/style.css
@@ -53,13 +53,13 @@ h1,h2 {
margin: 5px;
}
-ul.feedbackPanel li.alert-error {
+ul.feedbackPanel li.feedbackPanelERROR {
color: red;
list-style: circle;
font-weight: bold;
}
-ul.feedbackPanel li.alert-info {
+ul.feedbackPanel li.feedbackPanelINFO {
color: green;
list-style: circle;
font-weight: bold;
http://git-wip-us.apache.org/repos/asf/wicket/blob/9263a807/wicket-examples/src/main/webapp/style_fa_IR.css
----------------------------------------------------------------------
diff --git a/wicket-examples/src/main/webapp/style_fa_IR.css b/wicket-examples/src/main/webapp/style_fa_IR.css
index 8631e2f..5488a2a 100644
--- a/wicket-examples/src/main/webapp/style_fa_IR.css
+++ b/wicket-examples/src/main/webapp/style_fa_IR.css
@@ -44,13 +44,13 @@ h1,h2,h3,h4,h5,h6,h7,h8 {
margin: 5px;
}
-ul.feedbackPanel li.alert-error {
+ul.feedbackPanel li.feedbackPanelERROR {
color: red;
list-style: circle;
font-weight: bold;
}
-ul.feedbackPanel li.alert-info {
+ul.feedbackPanel li.feedbackPanelINFO {
color: green;
list-style: circle;
font-weight: bold;
[4/5] git commit: Tests for WICKET-4852
Posted by mg...@apache.org.
Tests for WICKET-4852
Apache License Header was missing
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/27f753ec
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/27f753ec
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/27f753ec
Branch: refs/heads/master
Commit: 27f753ecb04bcb2962a02d220702356a7ca63738
Parents: e0832da
Author: Cedric Gatay <ce...@gatay.fr>
Authored: Mon May 6 11:55:51 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 6 14:16:03 2013 +0300
----------------------------------------------------------------------
.../markup/html/panel/FeedbackPanelTest.java | 16 +++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/27f753ec/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
index c5529de..29a8aad 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
@@ -1,3 +1,19 @@
+/*
+ * 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.panel;
import org.apache.wicket.Component;
[5/5] git commit: WICKET-4852 Do not set CSS class on the li > span
element for a feedback message
Posted by mg...@apache.org.
WICKET-4852 Do not set CSS class on the li > span element for a feedback message
Minor formatting improvements
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/4c43ad59
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/4c43ad59
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/4c43ad59
Branch: refs/heads/master
Commit: 4c43ad591c86e26d7b8dd7a3e82913313e7e7fa0
Parents: 27f753e
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon May 6 14:13:33 2013 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 6 14:16:08 2013 +0300
----------------------------------------------------------------------
.../wicket/markup/html/panel/FeedbackPanel.java | 2 +-
.../markup/html/panel/FeedbackPanelTest.java | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/4c43ad59/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
index fd4b28d..968a93c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FeedbackPanel.java
@@ -347,7 +347,7 @@ public class FeedbackPanel extends Panel implements IFeedback
* The model object of the item
* @return Container that holds components of the feedback MessageListView.
*/
- protected ListItem<FeedbackMessage> newMessageItem(int index, IModel<FeedbackMessage> itemModel){
+ protected ListItem<FeedbackMessage> newMessageItem(int index, IModel<FeedbackMessage> itemModel) {
return new ListItem<>(index, itemModel);
}
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/4c43ad59/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
index 29a8aad..01cb2cf 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
@@ -19,7 +19,6 @@ package org.apache.wicket.markup.html.panel;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.WicketTestCase;
-import org.apache.wicket.feedback.FencedFeedbackPanel;
import org.apache.wicket.markup.IMarkupResourceStreamProvider;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
@@ -34,9 +33,8 @@ import org.junit.Test;
*/
public class FeedbackPanelTest extends WicketTestCase
{
-
@Test
- public void testCssClassesOnFeedbackPanel() throws Exception{
+ public void testCssClassesOnFeedbackPanel() throws Exception {
TestPage testPage = new TestPage();
testPage.label.error("Error message");
testPage.label.info("Info message");
@@ -44,8 +42,7 @@ public class FeedbackPanelTest extends WicketTestCase
executeTest(testPage, "FeedbackPanelTest_cssClasses_expected.html");
}
-
- public static class TestPage extends WebPage implements IMarkupResourceStreamProvider
+ private static class TestPage extends WebPage implements IMarkupResourceStreamProvider
{
FeedbackPanel feedbackPanel;
Component label;
[3/5] git commit: Tests for WICKET-4852
Posted by mg...@apache.org.
Tests for WICKET-4852
Added unit test with expected output
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e0832da9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e0832da9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e0832da9
Branch: refs/heads/master
Commit: e0832da96e860037ef9ab1d20a5456ee45dd8d3f
Parents: 9263a80
Author: Cedric Gatay <ce...@gatay.fr>
Authored: Mon May 6 09:16:39 2013 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon May 6 14:15:55 2013 +0300
----------------------------------------------------------------------
.../markup/html/panel/FeedbackPanelTest.java | 56 +++++++++++++++
.../FeedbackPanelTest_cssClasses_expected.html | 14 ++++
2 files changed, 70 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/e0832da9/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
new file mode 100644
index 0000000..c5529de
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest.java
@@ -0,0 +1,56 @@
+package org.apache.wicket.markup.html.panel;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.feedback.FencedFeedbackPanel;
+import org.apache.wicket.markup.IMarkupResourceStreamProvider;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.resource.IResourceStream;
+import org.apache.wicket.util.resource.StringResourceStream;
+import org.junit.Test;
+
+/**
+ * Tests for {@link FeedbackPanel}
+ *
+ * @author cgatay
+ */
+public class FeedbackPanelTest extends WicketTestCase
+{
+
+ @Test
+ public void testCssClassesOnFeedbackPanel() throws Exception{
+ TestPage testPage = new TestPage();
+ testPage.label.error("Error message");
+ testPage.label.info("Info message");
+ testPage.label.warn("Warn message");
+ executeTest(testPage, "FeedbackPanelTest_cssClasses_expected.html");
+ }
+
+
+ public static class TestPage extends WebPage implements IMarkupResourceStreamProvider
+ {
+ FeedbackPanel feedbackPanel;
+ Component label;
+
+ public TestPage()
+ {
+ feedbackPanel = new FeedbackPanel("feedback");
+ label = new Label("label");
+ add(feedbackPanel, label);
+ }
+
+ @Override
+ public IResourceStream getMarkupResourceStream(MarkupContainer container,
+ Class<?> containerClass)
+ {
+ return new StringResourceStream(
+ "<body>\n" +
+ "<div wicket:id='feedback'/>\n" +
+ "<div wicket:id='label'/>\n" +
+ "</body>");
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/e0832da9/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest_cssClasses_expected.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest_cssClasses_expected.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest_cssClasses_expected.html
new file mode 100644
index 0000000..3aa7018
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/panel/FeedbackPanelTest_cssClasses_expected.html
@@ -0,0 +1,14 @@
+<body>
+<div wicket:id="feedback"><wicket:panel>
+ <ul wicket:id="feedbackul" class="feedbackPanel">
+ <li wicket:id="messages" class="feedbackPanelERROR">
+ <span wicket:id="message">Error message</span>
+ </li><li wicket:id="messages" class="feedbackPanelINFO">
+ <span wicket:id="message">Info message</span>
+ </li><li wicket:id="messages" class="feedbackPanelWARNING">
+ <span wicket:id="message">Warn message</span>
+ </li>
+ </ul>
+</wicket:panel></div>
+<div wicket:id="label"></div>
+</body>
\ No newline at end of file