summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-06-03 09:24:39 -0400
committerJames Moger <james.moger@gitblit.com>2014-06-03 10:34:51 -0400
commit6cc8ec025ad26f1451f0947fa4ad79bb2f9c292a (patch)
treead2b15a031a39c67ea75bbe45eb4872be7f8dcf7
parent7b8654dec60d378059bd9d765abcfd597b80ab5f (diff)
downloadgitblit-6cc8ec025ad26f1451f0947fa4ad79bb2f9c292a.tar.gz
gitblit-6cc8ec025ad26f1451f0947fa4ad79bb2f9c292a.zip
Hide empty option descriptions
-rw-r--r--src/main/java/com/gitblit/wicket/panels/CheckboxOption.java5
-rw-r--r--src/main/java/com/gitblit/wicket/panels/ChoiceOption.java5
-rw-r--r--src/main/java/com/gitblit/wicket/panels/TextOption.java2
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<Boolean> 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<T> extends BasePanel {
public ChoiceOption(String wicketId, String title, String description, IModel<T> model, List<T> 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<String> model) {
super(wicketId);
add(new Label("name", title));
- add(new Label("description", description));
+ add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));
TextField<String> tf = new TextField<String>("text", model);
if (!StringUtils.isEmpty(css)) {
WicketUtils.setCssClass(tf, css);