]> source.dussan.org Git - gitblit.git/commitdiff
Hide empty option descriptions
authorJames Moger <james.moger@gitblit.com>
Tue, 3 Jun 2014 13:24:39 +0000 (09:24 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 3 Jun 2014 14:34:51 +0000 (10:34 -0400)
src/main/java/com/gitblit/wicket/panels/CheckboxOption.java
src/main/java/com/gitblit/wicket/panels/ChoiceOption.java
src/main/java/com/gitblit/wicket/panels/TextOption.java

index 086d8ef253d298010db35cce63d749994ac1ca3a..08eeaa2486ea1077d564ebac403b5556be4f1925 100644 (file)
@@ -18,6 +18,7 @@ package com.gitblit.wicket.panels;
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.form.CheckBox;\r
 import org.apache.wicket.model.IModel;\r
+import org.parboiled.common.StringUtils;\r
 \r
 /**\r
  * A re-usable checkbox option panel.\r
@@ -35,14 +36,14 @@ public class CheckboxOption extends BasePanel {
        public CheckboxOption(String wicketId, String title, String description, IModel<Boolean> model) {\r
                super(wicketId);\r
                add(new Label("name", title));\r
-               add(new Label("description", description));\r
+               add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
                add(new CheckBox("checkbox", model));\r
        }\r
 \r
        public CheckboxOption(String wicketId, String title, String description, CheckBox checkbox) {\r
                super(wicketId);\r
                add(new Label("name", title));\r
-               add(new Label("description", description));\r
+               add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
                add(checkbox.setMarkupId("checkbox"));\r
        }\r
 \r
index cc084a7bd709e8710d03a48fd83200daef923c2c..9c25b70a6a906e0e7b0bbb9a1452761e4ae940c8 100644 (file)
@@ -20,6 +20,7 @@ import java.util.List;
 import org.apache.wicket.markup.html.basic.Label;\r
 import org.apache.wicket.markup.html.form.DropDownChoice;\r
 import org.apache.wicket.model.IModel;\r
+import org.parboiled.common.StringUtils;\r
 \r
 /**\r
  * A re-usable choice option panel.\r
@@ -38,14 +39,14 @@ public class ChoiceOption<T> extends BasePanel {
        public ChoiceOption(String wicketId, String title, String description, IModel<T> model, List<T> choices) {\r
                super(wicketId);\r
                add(new Label("name", title));\r
-               add(new Label("description", description));\r
+               add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
                add(new DropDownChoice<>("choice", model, choices).setEnabled(choices.size() > 0));\r
        }\r
 \r
        public ChoiceOption(String wicketId, String title, String description, DropDownChoice<?> choice) {\r
                super(wicketId);\r
                add(new Label("name", title));\r
-               add(new Label("description", description));\r
+               add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
                add(choice.setMarkupId("choice").setEnabled(choice.getChoices().size() > 0));\r
        }\r
 }\r
index dcd465fb44ac46740480921da9f1350de7127b4a..22370f3c8bcc557704a965fcbfda4ec4f8cd72c9 100644 (file)
@@ -43,7 +43,7 @@ public class TextOption extends BasePanel {
        public TextOption(String wicketId, String title, String description, String css, IModel<String> model) {\r
                super(wicketId);\r
                add(new Label("name", title));\r
-               add(new Label("description", description));\r
+               add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));\r
                TextField<String> tf = new TextField<String>("text", model);\r
                if (!StringUtils.isEmpty(css)) {\r
                        WicketUtils.setCssClass(tf, css);\r