From 6cc8ec025ad26f1451f0947fa4ad79bb2f9c292a Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 3 Jun 2014 09:24:39 -0400 Subject: Hide empty option descriptions --- src/main/java/com/gitblit/wicket/panels/CheckboxOption.java | 5 +++-- src/main/java/com/gitblit/wicket/panels/ChoiceOption.java | 5 +++-- src/main/java/com/gitblit/wicket/panels/TextOption.java | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/panels/CheckboxOption.java b/src/main/java/com/gitblit/wicket/panels/CheckboxOption.java index 086d8ef2..08eeaa24 100644 --- a/src/main/java/com/gitblit/wicket/panels/CheckboxOption.java +++ b/src/main/java/com/gitblit/wicket/panels/CheckboxOption.java @@ -18,6 +18,7 @@ package com.gitblit.wicket.panels; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.CheckBox; import org.apache.wicket.model.IModel; +import org.parboiled.common.StringUtils; /** * A re-usable checkbox option panel. @@ -35,14 +36,14 @@ public class CheckboxOption extends BasePanel { public CheckboxOption(String wicketId, String title, String description, IModel model) { super(wicketId); add(new Label("name", title)); - add(new Label("description", description)); + add(new Label("description", description).setVisible(!StringUtils.isEmpty(description))); add(new CheckBox("checkbox", model)); } public CheckboxOption(String wicketId, String title, String description, CheckBox checkbox) { super(wicketId); add(new Label("name", title)); - add(new Label("description", description)); + add(new Label("description", description).setVisible(!StringUtils.isEmpty(description))); add(checkbox.setMarkupId("checkbox")); } diff --git a/src/main/java/com/gitblit/wicket/panels/ChoiceOption.java b/src/main/java/com/gitblit/wicket/panels/ChoiceOption.java index cc084a7b..9c25b70a 100644 --- a/src/main/java/com/gitblit/wicket/panels/ChoiceOption.java +++ b/src/main/java/com/gitblit/wicket/panels/ChoiceOption.java @@ -20,6 +20,7 @@ import java.util.List; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.model.IModel; +import org.parboiled.common.StringUtils; /** * A re-usable choice option panel. @@ -38,14 +39,14 @@ public class ChoiceOption extends BasePanel { public ChoiceOption(String wicketId, String title, String description, IModel model, List choices) { super(wicketId); add(new Label("name", title)); - add(new Label("description", description)); + add(new Label("description", description).setVisible(!StringUtils.isEmpty(description))); add(new DropDownChoice<>("choice", model, choices).setEnabled(choices.size() > 0)); } public ChoiceOption(String wicketId, String title, String description, DropDownChoice choice) { super(wicketId); add(new Label("name", title)); - add(new Label("description", description)); + add(new Label("description", description).setVisible(!StringUtils.isEmpty(description))); add(choice.setMarkupId("choice").setEnabled(choice.getChoices().size() > 0)); } } diff --git a/src/main/java/com/gitblit/wicket/panels/TextOption.java b/src/main/java/com/gitblit/wicket/panels/TextOption.java index dcd465fb..22370f3c 100644 --- a/src/main/java/com/gitblit/wicket/panels/TextOption.java +++ b/src/main/java/com/gitblit/wicket/panels/TextOption.java @@ -43,7 +43,7 @@ public class TextOption extends BasePanel { public TextOption(String wicketId, String title, String description, String css, IModel model) { super(wicketId); add(new Label("name", title)); - add(new Label("description", description)); + add(new Label("description", description).setVisible(!StringUtils.isEmpty(description))); TextField tf = new TextField("text", model); if (!StringUtils.isEmpty(css)) { WicketUtils.setCssClass(tf, css); -- cgit v1.2.3