From df76a8cb94c7dc552467a067248d14ddb82a0ac7 Mon Sep 17 00:00:00 2001
From: Peter Hormanns < <peter.hormanns@jalin.de>
Date: Wed, 31 Oct 2012 13:55:39 +0100
Subject: [PATCH] show objct name in delete confirm dialog

---
 hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java |   10 +++--
 hsarweb/src/texts/mysqluser.properties                       |    1 
 hsarweb/src/texts/mysqldb.properties                         |    5 +-
 hsarweb/src/texts/emailalias_de.properties                   |    3 +
 hsarweb/src/texts/postgresqluser_de.properties               |    1 
 hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java           |   32 ++++++++++++++++
 hsarweb/src/texts/domain.properties                          |    3 +
 hsarweb/src/texts/user.properties                            |    1 
 hsarweb/src/texts/mysqldb_de.properties                      |    3 +
 hsarweb/src/texts/emailalias.properties                      |    3 +
 hsarweb/src/texts/postgresqluser.properties                  |    1 
 hsarweb/src/texts/emailaddress_de.properties                 |    3 +
 hsarweb/src/texts/emailaddress.properties                    |    3 +
 hsarweb/src/texts/postgresqldb_de.properties                 |    1 
 hsarweb/src/texts/user_de.properties                         |    3 +
 hsarweb/src/texts/domain_de.properties                       |    3 +
 hsarweb/src/texts/postgresqldb.properties                    |    3 +
 hsarweb/src/texts/mysqluser_de.properties                    |    1 
 18 files changed, 65 insertions(+), 15 deletions(-)

diff --git a/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java b/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java
index a854c29..3c3a308 100644
--- a/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java
+++ b/hsarweb/src/de/hsadmin/web/vaadin/GenericForm.java
@@ -75,6 +75,38 @@
 		return null;
 	}
 
+	public Form createDeleteForm() {
+		try {
+			MainApplication application = module.getApplication();
+			ModuleConfig config = module.getModuleConfig();
+			Map<String, String> where = new HashMap<String, String>();
+			where.put(findIdKey(), entityId.toString());
+			Object searchResult = application.getRemote().callSearch(config.getRemoteName(), where);
+			if (searchResult instanceof Object[]) {
+				Map<?, ?> row = (Map<?, ?>) (((Object[]) searchResult)[0]);
+				Form f = new Form();
+				f.setCaption(config.getLabel("delete"));
+				f.setData(entityId);
+				Layout layout = f.getLayout();
+				for (PropertyConfig prop : config.getPropertyList()) {
+					if (prop.getPropFieldFactory().getClass().equals(DefaultPropertyFieldFactory.class)
+							&& prop.getPropTableColumn().equals(PropertyTableColumn.DISPLAY)) {
+						PropertyFieldFactory propFieldFactory = prop.getPropFieldFactory();
+						Object value = row.get(prop.getId());
+						Component component = (Component) propFieldFactory.createFieldComponent(prop, value);
+						component.setReadOnly(true);
+						layout.addComponent(component);
+					}
+				}
+				return f;
+			}
+		} catch (HsarwebException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+
 	private String findIdKey() {
 		List<PropertyConfig> propertyList = module.getModuleConfig().getPropertyList();
 		String idKey = null;
diff --git a/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java b/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java
index fd98b01..83951af 100644
--- a/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java
+++ b/hsarweb/src/de/hsadmin/web/vaadin/TableComponentFactory.java
@@ -13,13 +13,12 @@
 import com.vaadin.terminal.Sizeable;
 import com.vaadin.terminal.ThemeResource;
 import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Form;
 import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
-import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.themes.BaseTheme;
 
 import de.hsadmin.web.DeleteAble;
@@ -260,6 +259,7 @@
 	private Button createDeleteButton(long id) {
 		ThemeResource icon = new ThemeResource("../runo/icons/16/document-delete.png");
 		final Button button = new Button();
+		final Module thisModule = module;
 		button.setIcon(icon);
 		button.setDescription(module.getApplication().getLocaleConfig().getText("delete"));
 		button.setData(id);
@@ -269,14 +269,16 @@
 			private Window childWindow;
 			@Override
 			public void buttonClick(ClickEvent event) {
+				final GenericForm genericForm = new GenericForm(thisModule, (Long) button.getData());
+				final Form form = genericForm.createDeleteForm();
 				final MainApplication application = module.getApplication();
 				LocaleConfig localeConfig = application.getLocaleConfig();
 				childWindow = new Window(module.getModuleConfig().getLabel("moduletitle") + " " + localeConfig.getText("delete"));
-				childWindow.setWidth(320.0f, Sizeable.UNITS_PIXELS);
+				childWindow.setWidth(640.0f, Sizeable.UNITS_PIXELS);
 				VerticalLayout vLayout = new VerticalLayout();
 				vLayout.setMargin(true);
 				vLayout.setSpacing(true);
-				vLayout.addComponent(new Label(localeConfig.getText("confirmdelete")));
+				vLayout.addComponent(form);
 				HorizontalLayout hLayout = new HorizontalLayout();
 				Button btDeleteRow = new Button(localeConfig.getText("delete"));
 				btDeleteRow.addListener(new Button.ClickListener() {
diff --git a/hsarweb/src/texts/domain.properties b/hsarweb/src/texts/domain.properties
index 6f6b42c..6d5a419 100644
--- a/hsarweb/src/texts/domain.properties
+++ b/hsarweb/src/texts/domain.properties
@@ -7,4 +7,5 @@
 moduletitle=domains
 moduleicon=../runo/icons/16/document-web.png
 new=configure domain
-update=update domain
\ No newline at end of file
+update=update domain
+delete=delete domain
\ No newline at end of file
diff --git a/hsarweb/src/texts/domain_de.properties b/hsarweb/src/texts/domain_de.properties
index b6f93f3..c75bfbc 100644
--- a/hsarweb/src/texts/domain_de.properties
+++ b/hsarweb/src/texts/domain_de.properties
@@ -7,4 +7,5 @@
 moduletitle=Domains
 moduleicon=../runo/icons/16/document-web.png
 new=Domain konfigurieren
-update=Domaindaten �ndern
\ No newline at end of file
+update=Domainkonfiguration �ndern
+delete=Domainkonfiguration l�schen
\ No newline at end of file
diff --git a/hsarweb/src/texts/emailaddress.properties b/hsarweb/src/texts/emailaddress.properties
index c307618..6564ba8 100644
--- a/hsarweb/src/texts/emailaddress.properties
+++ b/hsarweb/src/texts/emailaddress.properties
@@ -10,4 +10,5 @@
 moduletitle=email addresses
 moduleicon=../runo/icons/16/email.png
 new=create address
-update=update address
\ No newline at end of file
+update=update address
+delete=delete address
\ No newline at end of file
diff --git a/hsarweb/src/texts/emailaddress_de.properties b/hsarweb/src/texts/emailaddress_de.properties
index 20fef93..c42a41c 100644
--- a/hsarweb/src/texts/emailaddress_de.properties
+++ b/hsarweb/src/texts/emailaddress_de.properties
@@ -10,4 +10,5 @@
 moduletitle=EMail Adressen
 moduleicon=../runo/icons/16/email.png
 new=EMail-Adresse anlegen
-update=EMail-Adresse �ndern
\ No newline at end of file
+update=EMail-Adresse �ndern
+delete=EMail-Adresse l�schen
\ No newline at end of file
diff --git a/hsarweb/src/texts/emailalias.properties b/hsarweb/src/texts/emailalias.properties
index 9f07ec9..02d411d 100644
--- a/hsarweb/src/texts/emailalias.properties
+++ b/hsarweb/src/texts/emailalias.properties
@@ -5,4 +5,5 @@
 moduletitle=email aliases
 moduleicon=../runo/icons/16/email-send.png
 new=create alias
-update=update alias
\ No newline at end of file
+update=update alias
+delete=delete alias
\ No newline at end of file
diff --git a/hsarweb/src/texts/emailalias_de.properties b/hsarweb/src/texts/emailalias_de.properties
index ec50929..6b385f5 100644
--- a/hsarweb/src/texts/emailalias_de.properties
+++ b/hsarweb/src/texts/emailalias_de.properties
@@ -5,4 +5,5 @@
 moduletitle=EMail Aliases
 moduleicon=../runo/icons/16/email-send.png
 new=EMail-Alias anlegen
-update=EMail-Alias �ndern
\ No newline at end of file
+update=EMail-Alias �ndern
+delete=EMail-Alias l�schen
\ No newline at end of file
diff --git a/hsarweb/src/texts/mysqldb.properties b/hsarweb/src/texts/mysqldb.properties
index 4366f23..b4bbda8 100644
--- a/hsarweb/src/texts/mysqldb.properties
+++ b/hsarweb/src/texts/mysqldb.properties
@@ -4,6 +4,7 @@
 encoding=encoding
 owner=owner
 moduletitle=mysql db
-new=create db
-update=update db
+new=create database
+update=database
+delete=delete database
 moduleicon=../hs/icons/table.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/mysqldb_de.properties b/hsarweb/src/texts/mysqldb_de.properties
index dcdf1dc..09fdebd 100644
--- a/hsarweb/src/texts/mysqldb_de.properties
+++ b/hsarweb/src/texts/mysqldb_de.properties
@@ -5,5 +5,6 @@
 owner=Verwalter
 moduletitle=MySQL DB
 new=Datenbank anlegen
-update=Datenbank �ndern
+update=Datenbank
+delete=Datenbank l�schen
 moduleicon=../hs/icons/table.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/mysqluser.properties b/hsarweb/src/texts/mysqluser.properties
index 434f936..cb622f8 100644
--- a/hsarweb/src/texts/mysqluser.properties
+++ b/hsarweb/src/texts/mysqluser.properties
@@ -7,4 +7,5 @@
 moduletitle=mysql user
 new=create user
 update=change password
+delete=delete user
 moduleicon=../hs/icons/table_key.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/mysqluser_de.properties b/hsarweb/src/texts/mysqluser_de.properties
index 6c75274..df73d5c 100644
--- a/hsarweb/src/texts/mysqluser_de.properties
+++ b/hsarweb/src/texts/mysqluser_de.properties
@@ -7,4 +7,5 @@
 moduletitle=MySQL User
 new=User anlegen
 update=Passwort �ndern
+delete=User l�schen
 moduleicon=../hs/icons/table_key.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/postgresqldb.properties b/hsarweb/src/texts/postgresqldb.properties
index fe6c0a9..c8a1333 100644
--- a/hsarweb/src/texts/postgresqldb.properties
+++ b/hsarweb/src/texts/postgresqldb.properties
@@ -4,6 +4,7 @@
 encoding=encoding
 owner=owner
 moduletitle=postgresql db
-new=create db
+new=create database
 update=database
+delete=delete database
 moduleicon=../hs/icons/database.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/postgresqldb_de.properties b/hsarweb/src/texts/postgresqldb_de.properties
index 439285c..0651de5 100644
--- a/hsarweb/src/texts/postgresqldb_de.properties
+++ b/hsarweb/src/texts/postgresqldb_de.properties
@@ -6,4 +6,5 @@
 moduletitle=PostgreSQL DB
 new=Datenbank anlegen
 update=Datenbank
+delete=Datenbank l�schen
 moduleicon=../hs/icons/database.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/postgresqluser.properties b/hsarweb/src/texts/postgresqluser.properties
index 2cef6f8..b163a8d 100644
--- a/hsarweb/src/texts/postgresqluser.properties
+++ b/hsarweb/src/texts/postgresqluser.properties
@@ -7,4 +7,5 @@
 moduletitle=postgres user
 new=create user
 update=change password
+delete=delete user
 moduleicon=../hs/icons/database_key.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/postgresqluser_de.properties b/hsarweb/src/texts/postgresqluser_de.properties
index 9bebc83..34dc4eb 100644
--- a/hsarweb/src/texts/postgresqluser_de.properties
+++ b/hsarweb/src/texts/postgresqluser_de.properties
@@ -7,4 +7,5 @@
 moduletitle=PostgreSQL User
 new=User anlegen
 update=Passwort �ndern
+delete=User l�schen
 moduleicon=../hs/icons/database_key.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/user.properties b/hsarweb/src/texts/user.properties
index 8e5f4fd..dae491c 100644
--- a/hsarweb/src/texts/user.properties
+++ b/hsarweb/src/texts/user.properties
@@ -13,4 +13,5 @@
 moduletitle=unix user
 new=create user
 update=update user
+delete=delete user
 moduleicon=../runo/icons/16/users.png
\ No newline at end of file
diff --git a/hsarweb/src/texts/user_de.properties b/hsarweb/src/texts/user_de.properties
index 9ca69c5..424ef35 100644
--- a/hsarweb/src/texts/user_de.properties
+++ b/hsarweb/src/texts/user_de.properties
@@ -13,4 +13,5 @@
 moduletitle=Unix User
 moduleicon=../runo/icons/16/users.png
 new=Benutzer anlegen
-update=Benutzer �ndern
\ No newline at end of file
+update=Benutzer �ndern
+delete=Benutzer l�schen
\ No newline at end of file

--
Gitblit v1.9.0-SNAPSHOT