fix error in email target editor,

now it is possible to remove single targets
This commit is contained in:
Peter Hormanns 2016-07-04 18:52:14 +02:00
parent 51a4a6acf3
commit f6d628486d
3 changed files with 22 additions and 8 deletions

View File

@ -17,6 +17,7 @@
<module>persistence</module> <module>persistence</module>
<module>services</module> <module>services</module>
<module>xmlrpc</module> <module>xmlrpc</module>
<module>web</module>
</modules> </modules>
<build> <build>

View File

@ -2,11 +2,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>net.hostsharing</groupId> <parent>
<artifactId>hs.hsadmin.web</artifactId> <groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>admin-web</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version> <name>HSAdmin Webapp</name>
<name>hs.hsadmin.web</name>
<dependencies> <dependencies>

View File

@ -90,10 +90,16 @@ public class EMailTargetEditor extends CustomComponent implements IHSEditor, Val
if (child instanceof AbstractOrderedLayout) { if (child instanceof AbstractOrderedLayout) {
final Component grandChild = ((AbstractOrderedLayout) child).getComponent(1); final Component grandChild = ((AbstractOrderedLayout) child).getComponent(1);
if (grandChild instanceof TextField) { 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) { 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%"); setWidth("100%");
setSpacing(true); setSpacing(true);
final NativeSelect targetTypeSelect = new NativeSelect(); 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.setWidth("6.0em");
targetTypeSelect.setValue("");
addComponent(targetTypeSelect); addComponent(targetTypeSelect);
setComponentAlignment(targetTypeSelect, Alignment.MIDDLE_LEFT); setComponentAlignment(targetTypeSelect, Alignment.MIDDLE_LEFT);
setExpandRatio(targetTypeSelect, 0.0f); setExpandRatio(targetTypeSelect, 0.0f);