From f6d628486d632c652731012ca04163d530ba22af Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Mon, 4 Jul 2016 18:52:14 +0200 Subject: [PATCH] fix error in email target editor, now it is possible to remove single targets --- pom.xml | 1 + web/pom.xml | 12 ++++++++---- .../java/de/hsadmin/web/EMailTargetEditor.java | 17 +++++++++++++---- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index f236b01..f9c236b 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,7 @@ persistence services xmlrpc + web diff --git a/web/pom.xml b/web/pom.xml index ca5ff23..eac4c67 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -2,11 +2,15 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - net.hostsharing - hs.hsadmin.web + + de.hsadmin + hsadmin-parent + 1.0-SNAPSHOT + + + admin-web war - 0.0.1-SNAPSHOT - hs.hsadmin.web + HSAdmin Webapp diff --git a/web/src/main/java/de/hsadmin/web/EMailTargetEditor.java b/web/src/main/java/de/hsadmin/web/EMailTargetEditor.java index ee73347..150fad9 100644 --- a/web/src/main/java/de/hsadmin/web/EMailTargetEditor.java +++ b/web/src/main/java/de/hsadmin/web/EMailTargetEditor.java @@ -90,10 +90,16 @@ public class EMailTargetEditor extends CustomComponent implements IHSEditor, Val if (child instanceof AbstractOrderedLayout) { final Component grandChild = ((AbstractOrderedLayout) child).getComponent(1); if (grandChild instanceof TextField) { - targetsList.add(((TextField) grandChild).getValue()); + final String value = ((TextField) grandChild).getValue(); + if (value != null && !value.isEmpty()) { + targetsList.add(value); + } } if (grandChild instanceof NativeSelect) { - targetsList.add(((NativeSelect) grandChild).getValue().toString()); + final Object value = ((NativeSelect) grandChild).getValue(); + if (value != null) { + targetsList.add(value.toString()); + } } } } @@ -166,9 +172,12 @@ public class EMailTargetEditor extends CustomComponent implements IHSEditor, Val setWidth("100%"); setSpacing(true); final NativeSelect targetTypeSelect = new NativeSelect(); - targetTypeSelect.addItems(new Object[] { I18N.getText("emailtarget.email"), I18N.getText("emailtarget.postbox"), I18N.getText("emailtarget.alias") }); + targetTypeSelect.setMultiSelect(false); + targetTypeSelect.setNullSelectionAllowed(true); + targetTypeSelect.setNullSelectionItemId(" "); + targetTypeSelect.addItems(new Object[] { " ", I18N.getText("emailtarget.email"), I18N.getText("emailtarget.postbox"), I18N.getText("emailtarget.alias") }); + targetTypeSelect.setValue(" "); targetTypeSelect.setWidth("6.0em"); - targetTypeSelect.setValue(""); addComponent(targetTypeSelect); setComponentAlignment(targetTypeSelect, Alignment.MIDDLE_LEFT); setExpandRatio(targetTypeSelect, 0.0f);