show objct name in delete confirm dialog

This commit is contained in:
Peter Hormanns 2012-10-31 13:55:39 +01:00
parent 2803fcf81a
commit df76a8cb94
18 changed files with 65 additions and 15 deletions

View File

@ -75,6 +75,38 @@ public class GenericForm {
return null; 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() { private String findIdKey() {
List<PropertyConfig> propertyList = module.getModuleConfig().getPropertyList(); List<PropertyConfig> propertyList = module.getModuleConfig().getPropertyList();
String idKey = null; String idKey = null;

View File

@ -13,13 +13,12 @@ import com.vaadin.data.Property;
import com.vaadin.terminal.Sizeable; import com.vaadin.terminal.Sizeable;
import com.vaadin.terminal.ThemeResource; import com.vaadin.terminal.ThemeResource;
import com.vaadin.ui.Button; import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Form; import com.vaadin.ui.Form;
import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table; import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window; import com.vaadin.ui.Window;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.themes.BaseTheme; import com.vaadin.ui.themes.BaseTheme;
import de.hsadmin.web.DeleteAble; import de.hsadmin.web.DeleteAble;
@ -260,6 +259,7 @@ public class TableComponentFactory implements ComponentFactory, Serializable {
private Button createDeleteButton(long id) { private Button createDeleteButton(long id) {
ThemeResource icon = new ThemeResource("../runo/icons/16/document-delete.png"); ThemeResource icon = new ThemeResource("../runo/icons/16/document-delete.png");
final Button button = new Button(); final Button button = new Button();
final Module thisModule = module;
button.setIcon(icon); button.setIcon(icon);
button.setDescription(module.getApplication().getLocaleConfig().getText("delete")); button.setDescription(module.getApplication().getLocaleConfig().getText("delete"));
button.setData(id); button.setData(id);
@ -269,14 +269,16 @@ public class TableComponentFactory implements ComponentFactory, Serializable {
private Window childWindow; private Window childWindow;
@Override @Override
public void buttonClick(ClickEvent event) { public void buttonClick(ClickEvent event) {
final GenericForm genericForm = new GenericForm(thisModule, (Long) button.getData());
final Form form = genericForm.createDeleteForm();
final MainApplication application = module.getApplication(); final MainApplication application = module.getApplication();
LocaleConfig localeConfig = application.getLocaleConfig(); LocaleConfig localeConfig = application.getLocaleConfig();
childWindow = new Window(module.getModuleConfig().getLabel("moduletitle") + " " + localeConfig.getText("delete")); 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(); VerticalLayout vLayout = new VerticalLayout();
vLayout.setMargin(true); vLayout.setMargin(true);
vLayout.setSpacing(true); vLayout.setSpacing(true);
vLayout.addComponent(new Label(localeConfig.getText("confirmdelete"))); vLayout.addComponent(form);
HorizontalLayout hLayout = new HorizontalLayout(); HorizontalLayout hLayout = new HorizontalLayout();
Button btDeleteRow = new Button(localeConfig.getText("delete")); Button btDeleteRow = new Button(localeConfig.getText("delete"));
btDeleteRow.addListener(new Button.ClickListener() { btDeleteRow.addListener(new Button.ClickListener() {

View File

@ -8,3 +8,4 @@ moduletitle=domains
moduleicon=../runo/icons/16/document-web.png moduleicon=../runo/icons/16/document-web.png
new=configure domain new=configure domain
update=update domain update=update domain
delete=delete domain

View File

@ -7,4 +7,5 @@ since=aufgeschaltet seit
moduletitle=Domains moduletitle=Domains
moduleicon=../runo/icons/16/document-web.png moduleicon=../runo/icons/16/document-web.png
new=Domain konfigurieren new=Domain konfigurieren
update=Domaindaten ändern update=Domainkonfiguration ändern
delete=Domainkonfiguration löschen

View File

@ -11,3 +11,4 @@ moduletitle=email addresses
moduleicon=../runo/icons/16/email.png moduleicon=../runo/icons/16/email.png
new=create address new=create address
update=update address update=update address
delete=delete address

View File

@ -11,3 +11,4 @@ moduletitle=EMail Adressen
moduleicon=../runo/icons/16/email.png moduleicon=../runo/icons/16/email.png
new=EMail-Adresse anlegen new=EMail-Adresse anlegen
update=EMail-Adresse ändern update=EMail-Adresse ändern
delete=EMail-Adresse löschen

View File

@ -6,3 +6,4 @@ moduletitle=email aliases
moduleicon=../runo/icons/16/email-send.png moduleicon=../runo/icons/16/email-send.png
new=create alias new=create alias
update=update alias update=update alias
delete=delete alias

View File

@ -6,3 +6,4 @@ moduletitle=EMail Aliases
moduleicon=../runo/icons/16/email-send.png moduleicon=../runo/icons/16/email-send.png
new=EMail-Alias anlegen new=EMail-Alias anlegen
update=EMail-Alias ändern update=EMail-Alias ändern
delete=EMail-Alias löschen

View File

@ -4,6 +4,7 @@ pac=packet
encoding=encoding encoding=encoding
owner=owner owner=owner
moduletitle=mysql db moduletitle=mysql db
new=create db new=create database
update=update db update=database
delete=delete database
moduleicon=../hs/icons/table.png moduleicon=../hs/icons/table.png

View File

@ -5,5 +5,6 @@ encoding=Zeichensatz
owner=Verwalter owner=Verwalter
moduletitle=MySQL DB moduletitle=MySQL DB
new=Datenbank anlegen new=Datenbank anlegen
update=Datenbank ändern update=Datenbank
delete=Datenbank löschen
moduleicon=../hs/icons/table.png moduleicon=../hs/icons/table.png

View File

@ -7,4 +7,5 @@ pac=packet
moduletitle=mysql user moduletitle=mysql user
new=create user new=create user
update=change password update=change password
delete=delete user
moduleicon=../hs/icons/table_key.png moduleicon=../hs/icons/table_key.png

View File

@ -7,4 +7,5 @@ pac=Paket
moduletitle=MySQL User moduletitle=MySQL User
new=User anlegen new=User anlegen
update=Passwort ändern update=Passwort ändern
delete=User löschen
moduleicon=../hs/icons/table_key.png moduleicon=../hs/icons/table_key.png

View File

@ -4,6 +4,7 @@ pac=packet
encoding=encoding encoding=encoding
owner=owner owner=owner
moduletitle=postgresql db moduletitle=postgresql db
new=create db new=create database
update=database update=database
delete=delete database
moduleicon=../hs/icons/database.png moduleicon=../hs/icons/database.png

View File

@ -6,4 +6,5 @@ owner=Verwalter
moduletitle=PostgreSQL DB moduletitle=PostgreSQL DB
new=Datenbank anlegen new=Datenbank anlegen
update=Datenbank update=Datenbank
delete=Datenbank löschen
moduleicon=../hs/icons/database.png moduleicon=../hs/icons/database.png

View File

@ -7,4 +7,5 @@ pac=packet
moduletitle=postgres user moduletitle=postgres user
new=create user new=create user
update=change password update=change password
delete=delete user
moduleicon=../hs/icons/database_key.png moduleicon=../hs/icons/database_key.png

View File

@ -7,4 +7,5 @@ pac=Paket
moduletitle=PostgreSQL User moduletitle=PostgreSQL User
new=User anlegen new=User anlegen
update=Passwort ändern update=Passwort ändern
delete=User löschen
moduleicon=../hs/icons/database_key.png moduleicon=../hs/icons/database_key.png

View File

@ -13,4 +13,5 @@ quota_hardlimit=quota hard limit
moduletitle=unix user moduletitle=unix user
new=create user new=create user
update=update user update=update user
delete=delete user
moduleicon=../runo/icons/16/users.png moduleicon=../runo/icons/16/users.png

View File

@ -14,3 +14,4 @@ moduletitle=Unix User
moduleicon=../runo/icons/16/users.png moduleicon=../runo/icons/16/users.png
new=Benutzer anlegen new=Benutzer anlegen
update=Benutzer ändern update=Benutzer ändern
delete=Benutzer löschen