WICKET-5640 Reduce the mangling of HTML markup in the Java code as much as 
possible


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/78f42689
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/78f42689
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/78f42689

Branch: refs/heads/master
Commit: 78f426893e74b2f4db021115de605e34e0594431
Parents: e3be2d5
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Tue Jul 22 15:29:21 2014 +0300
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Tue Jul 22 15:29:21 2014 +0300

----------------------------------------------------------------------
 .../wicket/markup/html/form/RadioChoice.java    |  2 +-
 .../html/form/RadioChoiceWicket6Listener.java   | 29 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/78f42689/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java
index aed9ca6..52be5ca 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java
@@ -70,7 +70,7 @@ public class RadioChoice<T> extends 
AbstractSingleSelectChoice<T> implements IOn
        private static final long serialVersionUID = 1L;
 
        private String prefix = "";
-       private String suffix = "<br />\n";
+       private String suffix = "";
 
        private LabelPosition labelPosition = LabelPosition.AFTER;
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/78f42689/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoiceWicket6Listener.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoiceWicket6Listener.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoiceWicket6Listener.java
new file mode 100644
index 0000000..1355220
--- /dev/null
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoiceWicket6Listener.java
@@ -0,0 +1,29 @@
+package org.apache.wicket.markup.html.form;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.application.IComponentInstantiationListener;
+
+/**
+ * Restores the rendering behavior of RadioChoice until Wicket 6.x.
+ * That means:
+ * <ul>
+ *     <li>Uses <xmp><br/></xmp> as a suffix</li>
+ *     <li>renders the label after the checkbox</li>
+ * </ul>
+ *
+ * @deprecated
+ */
+@Deprecated
+public class RadioChoiceWicket6Listener implements 
IComponentInstantiationListener
+{
+       @Override
+       public void onInstantiation(Component component)
+       {
+               if (component instanceof RadioChoice<?>)
+               {
+                       RadioChoice<?> radioChoice = (RadioChoice<?>) component;
+                       radioChoice.setSuffix("<br />\n");
+                       
radioChoice.setLabelPosition(AbstractChoice.LabelPosition.AFTER);
+               }
+       }
+}

Reply via email to